-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df532d6
commit 4541211
Showing
48 changed files
with
12,023 additions
and
9,006 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-sdk-go/clustersmgmt/v1 | ||
|
||
// AutoscalerResourceLimitsBuilder contains the data and logic needed to build 'autoscaler_resource_limits' objects. | ||
type AutoscalerResourceLimitsBuilder struct { | ||
bitmap_ uint32 | ||
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 | ||
} | ||
|
||
// 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_ |= 1 | ||
} else { | ||
b.bitmap_ &^= 1 | ||
} | ||
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_ |= 2 | ||
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_ |= 4 | ||
} else { | ||
b.bitmap_ &^= 4 | ||
} | ||
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.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.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 | ||
} |
71 changes: 71 additions & 0 deletions
71
clustersmgmt/v1/autoscaler_resource_limits_list_builder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Copyright (c) 2020 Red Hat, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all | ||
// your changes will be lost when the file is generated again. | ||
|
||
package v1 // github.com/openshift-online/ocm-sdk-go/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 | ||
} |
75 changes: 75 additions & 0 deletions
75
clustersmgmt/v1/autoscaler_resource_limits_list_type_json.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
Copyright (c) 2020 Red Hat, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all | ||
// your changes will be lost when the file is generated again. | ||
|
||
package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1 | ||
|
||
import ( | ||
"io" | ||
|
||
jsoniter "github.com/json-iterator/go" | ||
"github.com/openshift-online/ocm-sdk-go/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 | ||
} |
Oops, something went wrong.