-
Notifications
You must be signed in to change notification settings - Fork 119
/
cluster_authorization_request_builder.go
executable file
·158 lines (142 loc) · 4.65 KB
/
cluster_authorization_request_builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
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.
*/
// IMPORTANT: This file has been generated automatically, refrain 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/accountsmgmt/v1
// ClusterAuthorizationRequestBuilder contains the data and logic needed to build 'cluster_authorization_request' objects.
//
//
type ClusterAuthorizationRequestBuilder struct {
byoc *bool
accountUsername *string
availabilityZone *string
clusterID *string
managed *bool
reserve *bool
resources []*ReservedResourceBuilder
}
// NewClusterAuthorizationRequest creates a new builder of 'cluster_authorization_request' objects.
func NewClusterAuthorizationRequest() *ClusterAuthorizationRequestBuilder {
return new(ClusterAuthorizationRequestBuilder)
}
// BYOC sets the value of the 'BYOC' attribute
// to the given value.
//
//
func (b *ClusterAuthorizationRequestBuilder) BYOC(value bool) *ClusterAuthorizationRequestBuilder {
b.byoc = &value
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
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
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
return b
}
// Managed sets the value of the 'managed' attribute
// to the given value.
//
//
func (b *ClusterAuthorizationRequestBuilder) Managed(value bool) *ClusterAuthorizationRequestBuilder {
b.managed = &value
return b
}
// Reserve sets the value of the 'reserve' attribute
// to the given value.
//
//
func (b *ClusterAuthorizationRequestBuilder) Reserve(value bool) *ClusterAuthorizationRequestBuilder {
b.reserve = &value
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)
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.byoc = object.byoc
b.accountUsername = object.accountUsername
b.availabilityZone = object.availabilityZone
b.clusterID = object.clusterID
b.managed = object.managed
b.reserve = object.reserve
if object.resources != nil && len(object.resources.items) > 0 {
b.resources = make([]*ReservedResourceBuilder, len(object.resources.items))
for i, item := range object.resources.items {
b.resources[i] = NewReservedResource().Copy(item)
}
} else {
b.resources = nil
}
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)
if b.byoc != nil {
object.byoc = b.byoc
}
if b.accountUsername != nil {
object.accountUsername = b.accountUsername
}
if b.availabilityZone != nil {
object.availabilityZone = b.availabilityZone
}
if b.clusterID != nil {
object.clusterID = b.clusterID
}
if b.managed != nil {
object.managed = b.managed
}
if b.reserve != nil {
object.reserve = b.reserve
}
if b.resources != nil {
object.resources = new(ReservedResourceList)
object.resources.items = make([]*ReservedResource, len(b.resources))
for i, item := range b.resources {
object.resources.items[i], err = item.Build()
if err != nil {
return
}
}
}
return
}