Skip to content

Commit e51fd18

Browse files
authored
Merge pull request #1145 from miguelhbrito/OCM-21264-api-model-gcp-dns-domain
OCM-21264 | feat: api model for gcp dns domain
2 parents a657d65 + 54ea939 commit e51fd18

File tree

11 files changed

+738
-27
lines changed

11 files changed

+738
-27
lines changed

clientapi/clustersmgmt/v1/dns_domain_builder.go

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type DNSDomainBuilder struct {
3131
cloudProvider DnsCloudProvider
3232
cluster *ClusterLinkBuilder
3333
clusterArch ClusterArchitecture
34+
gcp *GcpDnsDomainBuilder
3435
organization *OrganizationLinkBuilder
3536
reservedAtTimestamp time.Time
3637
userDefined bool
@@ -39,14 +40,14 @@ type DNSDomainBuilder struct {
3940
// NewDNSDomain creates a new builder of 'DNS_domain' objects.
4041
func NewDNSDomain() *DNSDomainBuilder {
4142
return &DNSDomainBuilder{
42-
fieldSet_: make([]bool, 9),
43+
fieldSet_: make([]bool, 10),
4344
}
4445
}
4546

4647
// Link sets the flag that indicates if this is a link.
4748
func (b *DNSDomainBuilder) Link(value bool) *DNSDomainBuilder {
4849
if len(b.fieldSet_) == 0 {
49-
b.fieldSet_ = make([]bool, 9)
50+
b.fieldSet_ = make([]bool, 10)
5051
}
5152
b.fieldSet_[0] = true
5253
return b
@@ -55,7 +56,7 @@ func (b *DNSDomainBuilder) Link(value bool) *DNSDomainBuilder {
5556
// ID sets the identifier of the object.
5657
func (b *DNSDomainBuilder) ID(value string) *DNSDomainBuilder {
5758
if len(b.fieldSet_) == 0 {
58-
b.fieldSet_ = make([]bool, 9)
59+
b.fieldSet_ = make([]bool, 10)
5960
}
6061
b.id = value
6162
b.fieldSet_[1] = true
@@ -65,7 +66,7 @@ func (b *DNSDomainBuilder) ID(value string) *DNSDomainBuilder {
6566
// HREF sets the link to the object.
6667
func (b *DNSDomainBuilder) HREF(value string) *DNSDomainBuilder {
6768
if len(b.fieldSet_) == 0 {
68-
b.fieldSet_ = make([]bool, 9)
69+
b.fieldSet_ = make([]bool, 10)
6970
}
7071
b.href = value
7172
b.fieldSet_[2] = true
@@ -89,7 +90,7 @@ func (b *DNSDomainBuilder) Empty() bool {
8990
// CloudProvider sets the value of the 'cloud_provider' attribute to the given value.
9091
func (b *DNSDomainBuilder) CloudProvider(value DnsCloudProvider) *DNSDomainBuilder {
9192
if len(b.fieldSet_) == 0 {
92-
b.fieldSet_ = make([]bool, 9)
93+
b.fieldSet_ = make([]bool, 10)
9394
}
9495
b.cloudProvider = value
9596
b.fieldSet_[3] = true
@@ -101,7 +102,7 @@ func (b *DNSDomainBuilder) CloudProvider(value DnsCloudProvider) *DNSDomainBuild
101102
// Definition of a cluster link.
102103
func (b *DNSDomainBuilder) Cluster(value *ClusterLinkBuilder) *DNSDomainBuilder {
103104
if len(b.fieldSet_) == 0 {
104-
b.fieldSet_ = make([]bool, 9)
105+
b.fieldSet_ = make([]bool, 10)
105106
}
106107
b.cluster = value
107108
if value != nil {
@@ -117,46 +118,63 @@ func (b *DNSDomainBuilder) Cluster(value *ClusterLinkBuilder) *DNSDomainBuilder
117118
// Possible cluster architectures.
118119
func (b *DNSDomainBuilder) ClusterArch(value ClusterArchitecture) *DNSDomainBuilder {
119120
if len(b.fieldSet_) == 0 {
120-
b.fieldSet_ = make([]bool, 9)
121+
b.fieldSet_ = make([]bool, 10)
121122
}
122123
b.clusterArch = value
123124
b.fieldSet_[5] = true
124125
return b
125126
}
126127

128+
// Gcp sets the value of the 'gcp' attribute to the given value.
129+
//
130+
// GcpDnsDomain represents configuration for Google Cloud Platform DNS domain settings
131+
// used in cluster DNS configuration for GCP-hosted clusters.
132+
func (b *DNSDomainBuilder) Gcp(value *GcpDnsDomainBuilder) *DNSDomainBuilder {
133+
if len(b.fieldSet_) == 0 {
134+
b.fieldSet_ = make([]bool, 10)
135+
}
136+
b.gcp = value
137+
if value != nil {
138+
b.fieldSet_[6] = true
139+
} else {
140+
b.fieldSet_[6] = false
141+
}
142+
return b
143+
}
144+
127145
// Organization sets the value of the 'organization' attribute to the given value.
128146
//
129147
// Definition of an organization link.
130148
func (b *DNSDomainBuilder) Organization(value *OrganizationLinkBuilder) *DNSDomainBuilder {
131149
if len(b.fieldSet_) == 0 {
132-
b.fieldSet_ = make([]bool, 9)
150+
b.fieldSet_ = make([]bool, 10)
133151
}
134152
b.organization = value
135153
if value != nil {
136-
b.fieldSet_[6] = true
154+
b.fieldSet_[7] = true
137155
} else {
138-
b.fieldSet_[6] = false
156+
b.fieldSet_[7] = false
139157
}
140158
return b
141159
}
142160

143161
// ReservedAtTimestamp sets the value of the 'reserved_at_timestamp' attribute to the given value.
144162
func (b *DNSDomainBuilder) ReservedAtTimestamp(value time.Time) *DNSDomainBuilder {
145163
if len(b.fieldSet_) == 0 {
146-
b.fieldSet_ = make([]bool, 9)
164+
b.fieldSet_ = make([]bool, 10)
147165
}
148166
b.reservedAtTimestamp = value
149-
b.fieldSet_[7] = true
167+
b.fieldSet_[8] = true
150168
return b
151169
}
152170

153171
// UserDefined sets the value of the 'user_defined' attribute to the given value.
154172
func (b *DNSDomainBuilder) UserDefined(value bool) *DNSDomainBuilder {
155173
if len(b.fieldSet_) == 0 {
156-
b.fieldSet_ = make([]bool, 9)
174+
b.fieldSet_ = make([]bool, 10)
157175
}
158176
b.userDefined = value
159-
b.fieldSet_[8] = true
177+
b.fieldSet_[9] = true
160178
return b
161179
}
162180

@@ -178,6 +196,11 @@ func (b *DNSDomainBuilder) Copy(object *DNSDomain) *DNSDomainBuilder {
178196
b.cluster = nil
179197
}
180198
b.clusterArch = object.clusterArch
199+
if object.gcp != nil {
200+
b.gcp = NewGcpDnsDomain().Copy(object.gcp)
201+
} else {
202+
b.gcp = nil
203+
}
181204
if object.organization != nil {
182205
b.organization = NewOrganizationLink().Copy(object.organization)
183206
} else {
@@ -205,6 +228,12 @@ func (b *DNSDomainBuilder) Build() (object *DNSDomain, err error) {
205228
}
206229
}
207230
object.clusterArch = b.clusterArch
231+
if b.gcp != nil {
232+
object.gcp, err = b.gcp.Build()
233+
if err != nil {
234+
return
235+
}
236+
}
208237
if b.organization != nil {
209238
object.organization, err = b.organization.Build()
210239
if err != nil {

clientapi/clustersmgmt/v1/dns_domain_type.go

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type DNSDomain struct {
4545
cloudProvider DnsCloudProvider
4646
cluster *ClusterLink
4747
clusterArch ClusterArchitecture
48+
gcp *GcpDnsDomain
4849
organization *OrganizationLink
4950
reservedAtTimestamp time.Time
5051
userDefined bool
@@ -186,12 +187,35 @@ func (o *DNSDomain) GetClusterArch() (value ClusterArchitecture, ok bool) {
186187
return
187188
}
188189

190+
// Gcp returns the value of the 'gcp' attribute, or
191+
// the zero value of the type if the attribute doesn't have a value.
192+
//
193+
// Gcp contains Google Cloud Platform-specific DNS domain configuration.
194+
func (o *DNSDomain) Gcp() *GcpDnsDomain {
195+
if o != nil && len(o.fieldSet_) > 6 && o.fieldSet_[6] {
196+
return o.gcp
197+
}
198+
return nil
199+
}
200+
201+
// GetGcp returns the value of the 'gcp' attribute and
202+
// a flag indicating if the attribute has a value.
203+
//
204+
// Gcp contains Google Cloud Platform-specific DNS domain configuration.
205+
func (o *DNSDomain) GetGcp() (value *GcpDnsDomain, ok bool) {
206+
ok = o != nil && len(o.fieldSet_) > 6 && o.fieldSet_[6]
207+
if ok {
208+
value = o.gcp
209+
}
210+
return
211+
}
212+
189213
// Organization returns the value of the 'organization' attribute, or
190214
// the zero value of the type if the attribute doesn't have a value.
191215
//
192216
// Link to the organization that reserved the DNS domain.
193217
func (o *DNSDomain) Organization() *OrganizationLink {
194-
if o != nil && len(o.fieldSet_) > 6 && o.fieldSet_[6] {
218+
if o != nil && len(o.fieldSet_) > 7 && o.fieldSet_[7] {
195219
return o.organization
196220
}
197221
return nil
@@ -202,7 +226,7 @@ func (o *DNSDomain) Organization() *OrganizationLink {
202226
//
203227
// Link to the organization that reserved the DNS domain.
204228
func (o *DNSDomain) GetOrganization() (value *OrganizationLink, ok bool) {
205-
ok = o != nil && len(o.fieldSet_) > 6 && o.fieldSet_[6]
229+
ok = o != nil && len(o.fieldSet_) > 7 && o.fieldSet_[7]
206230
if ok {
207231
value = o.organization
208232
}
@@ -214,7 +238,7 @@ func (o *DNSDomain) GetOrganization() (value *OrganizationLink, ok bool) {
214238
//
215239
// Date and time when the DNS domain was reserved.
216240
func (o *DNSDomain) ReservedAtTimestamp() time.Time {
217-
if o != nil && len(o.fieldSet_) > 7 && o.fieldSet_[7] {
241+
if o != nil && len(o.fieldSet_) > 8 && o.fieldSet_[8] {
218242
return o.reservedAtTimestamp
219243
}
220244
return time.Time{}
@@ -225,7 +249,7 @@ func (o *DNSDomain) ReservedAtTimestamp() time.Time {
225249
//
226250
// Date and time when the DNS domain was reserved.
227251
func (o *DNSDomain) GetReservedAtTimestamp() (value time.Time, ok bool) {
228-
ok = o != nil && len(o.fieldSet_) > 7 && o.fieldSet_[7]
252+
ok = o != nil && len(o.fieldSet_) > 8 && o.fieldSet_[8]
229253
if ok {
230254
value = o.reservedAtTimestamp
231255
}
@@ -237,7 +261,7 @@ func (o *DNSDomain) GetReservedAtTimestamp() (value time.Time, ok bool) {
237261
//
238262
// Indicates if this dns domain is user defined.
239263
func (o *DNSDomain) UserDefined() bool {
240-
if o != nil && len(o.fieldSet_) > 8 && o.fieldSet_[8] {
264+
if o != nil && len(o.fieldSet_) > 9 && o.fieldSet_[9] {
241265
return o.userDefined
242266
}
243267
return false
@@ -248,7 +272,7 @@ func (o *DNSDomain) UserDefined() bool {
248272
//
249273
// Indicates if this dns domain is user defined.
250274
func (o *DNSDomain) GetUserDefined() (value bool, ok bool) {
251-
ok = o != nil && len(o.fieldSet_) > 8 && o.fieldSet_[8]
275+
ok = o != nil && len(o.fieldSet_) > 9 && o.fieldSet_[9]
252276
if ok {
253277
value = o.userDefined
254278
}

clientapi/clustersmgmt/v1/dns_domain_type_json.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ func WriteDNSDomain(object *DNSDomain, stream *jsoniter.Stream) {
9393
stream.WriteString(string(object.clusterArch))
9494
count++
9595
}
96-
present_ = len(object.fieldSet_) > 6 && object.fieldSet_[6] && object.organization != nil
96+
present_ = len(object.fieldSet_) > 6 && object.fieldSet_[6] && object.gcp != nil
97+
if present_ {
98+
if count > 0 {
99+
stream.WriteMore()
100+
}
101+
stream.WriteObjectField("gcp")
102+
WriteGcpDnsDomain(object.gcp, stream)
103+
count++
104+
}
105+
present_ = len(object.fieldSet_) > 7 && object.fieldSet_[7] && object.organization != nil
97106
if present_ {
98107
if count > 0 {
99108
stream.WriteMore()
@@ -102,7 +111,7 @@ func WriteDNSDomain(object *DNSDomain, stream *jsoniter.Stream) {
102111
WriteOrganizationLink(object.organization, stream)
103112
count++
104113
}
105-
present_ = len(object.fieldSet_) > 7 && object.fieldSet_[7]
114+
present_ = len(object.fieldSet_) > 8 && object.fieldSet_[8]
106115
if present_ {
107116
if count > 0 {
108117
stream.WriteMore()
@@ -111,7 +120,7 @@ func WriteDNSDomain(object *DNSDomain, stream *jsoniter.Stream) {
111120
stream.WriteString((object.reservedAtTimestamp).Format(time.RFC3339))
112121
count++
113122
}
114-
present_ = len(object.fieldSet_) > 8 && object.fieldSet_[8]
123+
present_ = len(object.fieldSet_) > 9 && object.fieldSet_[9]
115124
if present_ {
116125
if count > 0 {
117126
stream.WriteMore()
@@ -137,7 +146,7 @@ func UnmarshalDNSDomain(source interface{}) (object *DNSDomain, err error) {
137146
// ReadDNSDomain reads a value of the 'DNS_domain' type from the given iterator.
138147
func ReadDNSDomain(iterator *jsoniter.Iterator) *DNSDomain {
139148
object := &DNSDomain{
140-
fieldSet_: make([]bool, 9),
149+
fieldSet_: make([]bool, 10),
141150
}
142151
for {
143152
field := iterator.ReadObject()
@@ -170,22 +179,26 @@ func ReadDNSDomain(iterator *jsoniter.Iterator) *DNSDomain {
170179
value := ClusterArchitecture(text)
171180
object.clusterArch = value
172181
object.fieldSet_[5] = true
182+
case "gcp":
183+
value := ReadGcpDnsDomain(iterator)
184+
object.gcp = value
185+
object.fieldSet_[6] = true
173186
case "organization":
174187
value := ReadOrganizationLink(iterator)
175188
object.organization = value
176-
object.fieldSet_[6] = true
189+
object.fieldSet_[7] = true
177190
case "reserved_at_timestamp":
178191
text := iterator.ReadString()
179192
value, err := time.Parse(time.RFC3339, text)
180193
if err != nil {
181194
iterator.ReportError("", err.Error())
182195
}
183196
object.reservedAtTimestamp = value
184-
object.fieldSet_[7] = true
197+
object.fieldSet_[8] = true
185198
case "user_defined":
186199
value := iterator.ReadBool()
187200
object.userDefined = value
188-
object.fieldSet_[8] = true
201+
object.fieldSet_[9] = true
189202
default:
190203
iterator.ReadAny()
191204
}

0 commit comments

Comments
 (0)