-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathgcp_builder.go
228 lines (205 loc) · 6.51 KB
/
gcp_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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
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-sdk-go/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
}