diff --git a/v2/api/network/v1api20180501/storage/dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20180501/storage/dns_zones_aaaa_record_types_gen.go index 78b633552be..e1d2d94f4db 100644 --- a/v2/api/network/v1api20180501/storage/dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20180501/storage/dns_zones_aaaa_record_types_gen.go @@ -403,6 +403,13 @@ func (record *ARecord) AssignProperties_From_ARecord(source *storage.ARecord) er // Ipv4Address record.Ipv4Address = genruntime.ClonePointerToString(source.Ipv4Address) + // Ipv4AddressFromConfig + if source.Ipv4AddressFromConfig != nil { + propertyBag.Add("Ipv4AddressFromConfig", *source.Ipv4AddressFromConfig) + } else { + propertyBag.Remove("Ipv4AddressFromConfig") + } + // Update the property bag if len(propertyBag) > 0 { record.PropertyBag = propertyBag @@ -431,6 +438,19 @@ func (record *ARecord) AssignProperties_To_ARecord(destination *storage.ARecord) // Ipv4Address destination.Ipv4Address = genruntime.ClonePointerToString(record.Ipv4Address) + // Ipv4AddressFromConfig + if propertyBag.Contains("Ipv4AddressFromConfig") { + var ipv4AddressFromConfig genruntime.ConfigMapReference + err := propertyBag.Pull("Ipv4AddressFromConfig", &ipv4AddressFromConfig) + if err != nil { + return eris.Wrap(err, "pulling 'Ipv4AddressFromConfig' from propertyBag") + } + + destination.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + destination.Ipv4AddressFromConfig = nil + } + // Update the property bag if len(propertyBag) > 0 { destination.PropertyBag = propertyBag diff --git a/v2/api/network/v1api20200601/arm/private_dns_zones_aaaa_record_spec_types_gen.go b/v2/api/network/v1api20200601/arm/private_dns_zones_aaaa_record_spec_types_gen.go index 7a990473bcb..40667e80d79 100644 --- a/v2/api/network/v1api20200601/arm/private_dns_zones_aaaa_record_spec_types_gen.go +++ b/v2/api/network/v1api20200601/arm/private_dns_zones_aaaa_record_spec_types_gen.go @@ -73,7 +73,7 @@ type AaaaRecord struct { // An A record. type ARecord struct { // Ipv4Address: The IPv4 address of this A record. - Ipv4Address *string `json:"ipv4Address,omitempty"` + Ipv4Address *string `json:"ipv4Address,omitempty" optionalConfigMapPair:"Ipv4Address"` } // A CNAME record. diff --git a/v2/api/network/v1api20200601/private_dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20200601/private_dns_zones_aaaa_record_types_gen.go index 6b68c7ab212..45aeef8fda8 100644 --- a/v2/api/network/v1api20200601/private_dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20200601/private_dns_zones_aaaa_record_types_gen.go @@ -1709,7 +1709,10 @@ func (record *AaaaRecord_STATUS) AssignProperties_To_AaaaRecord_STATUS(destinati // An A record. type ARecord struct { // Ipv4Address: The IPv4 address of this A record. - Ipv4Address *string `json:"ipv4Address,omitempty"` + Ipv4Address *string `json:"ipv4Address,omitempty" optionalConfigMapPair:"Ipv4Address"` + + // Ipv4AddressFromConfig: The IPv4 address of this A record. + Ipv4AddressFromConfig *genruntime.ConfigMapReference `json:"ipv4AddressFromConfig,omitempty" optionalConfigMapPair:"Ipv4Address"` } var _ genruntime.ARMTransformer = &ARecord{} @@ -1726,6 +1729,14 @@ func (record *ARecord) ConvertToARM(resolved genruntime.ConvertToARMResolvedDeta ipv4Address := *record.Ipv4Address result.Ipv4Address = &ipv4Address } + if record.Ipv4AddressFromConfig != nil { + ipv4AddressValue, err := resolved.ResolvedConfigMaps.Lookup(*record.Ipv4AddressFromConfig) + if err != nil { + return nil, eris.Wrap(err, "looking up configmap for property Ipv4Address") + } + ipv4Address := ipv4AddressValue + result.Ipv4Address = &ipv4Address + } return result, nil } @@ -1747,6 +1758,8 @@ func (record *ARecord) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, record.Ipv4Address = &ipv4Address } + // no assignment for property "Ipv4AddressFromConfig" + // No error return nil } @@ -1757,6 +1770,14 @@ func (record *ARecord) AssignProperties_From_ARecord(source *storage.ARecord) er // Ipv4Address record.Ipv4Address = genruntime.ClonePointerToString(source.Ipv4Address) + // Ipv4AddressFromConfig + if source.Ipv4AddressFromConfig != nil { + ipv4AddressFromConfig := source.Ipv4AddressFromConfig.Copy() + record.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + record.Ipv4AddressFromConfig = nil + } + // No error return nil } @@ -1769,6 +1790,14 @@ func (record *ARecord) AssignProperties_To_ARecord(destination *storage.ARecord) // Ipv4Address destination.Ipv4Address = genruntime.ClonePointerToString(record.Ipv4Address) + // Ipv4AddressFromConfig + if record.Ipv4AddressFromConfig != nil { + ipv4AddressFromConfig := record.Ipv4AddressFromConfig.Copy() + destination.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + destination.Ipv4AddressFromConfig = nil + } + // Update the property bag if len(propertyBag) > 0 { destination.PropertyBag = propertyBag diff --git a/v2/api/network/v1api20200601/storage/private_dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20200601/storage/private_dns_zones_aaaa_record_types_gen.go index a6b458150fd..623387e02a7 100644 --- a/v2/api/network/v1api20200601/storage/private_dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20200601/storage/private_dns_zones_aaaa_record_types_gen.go @@ -1278,8 +1278,9 @@ func (record *AaaaRecord_STATUS) AssignProperties_To_AaaaRecord_STATUS(destinati // Storage version of v1api20200601.ARecord // An A record. type ARecord struct { - Ipv4Address *string `json:"ipv4Address,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Ipv4Address *string `json:"ipv4Address,omitempty" optionalConfigMapPair:"Ipv4Address"` + Ipv4AddressFromConfig *genruntime.ConfigMapReference `json:"ipv4AddressFromConfig,omitempty" optionalConfigMapPair:"Ipv4Address"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } // AssignProperties_From_ARecord populates our ARecord from the provided source ARecord @@ -1290,6 +1291,14 @@ func (record *ARecord) AssignProperties_From_ARecord(source *storage.ARecord) er // Ipv4Address record.Ipv4Address = genruntime.ClonePointerToString(source.Ipv4Address) + // Ipv4AddressFromConfig + if source.Ipv4AddressFromConfig != nil { + ipv4AddressFromConfig := source.Ipv4AddressFromConfig.Copy() + record.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + record.Ipv4AddressFromConfig = nil + } + // Update the property bag if len(propertyBag) > 0 { record.PropertyBag = propertyBag @@ -1318,6 +1327,14 @@ func (record *ARecord) AssignProperties_To_ARecord(destination *storage.ARecord) // Ipv4Address destination.Ipv4Address = genruntime.ClonePointerToString(record.Ipv4Address) + // Ipv4AddressFromConfig + if record.Ipv4AddressFromConfig != nil { + ipv4AddressFromConfig := record.Ipv4AddressFromConfig.Copy() + destination.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + destination.Ipv4AddressFromConfig = nil + } + // Update the property bag if len(propertyBag) > 0 { destination.PropertyBag = propertyBag diff --git a/v2/api/network/v1api20200601/storage/structure.txt b/v2/api/network/v1api20200601/storage/structure.txt index ac46f7c1319..59c491e31b9 100644 --- a/v2/api/network/v1api20200601/storage/structure.txt +++ b/v2/api/network/v1api20200601/storage/structure.txt @@ -7,8 +7,9 @@ APIVersion: Enum (1 value) PrivateDnsZonesAAAARecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -101,8 +102,9 @@ PrivateDnsZonesAAAARecord: Resource PrivateDnsZonesARecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -195,8 +197,9 @@ PrivateDnsZonesARecord: Resource PrivateDnsZonesCNAMERecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -289,8 +292,9 @@ PrivateDnsZonesCNAMERecord: Resource PrivateDnsZonesMXRecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -383,8 +387,9 @@ PrivateDnsZonesMXRecord: Resource PrivateDnsZonesPTRRecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -477,8 +482,9 @@ PrivateDnsZonesPTRRecord: Resource PrivateDnsZonesSRVRecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -571,8 +577,9 @@ PrivateDnsZonesSRVRecord: Resource PrivateDnsZonesTXTRecord: Resource ├── Owner: network/v1api20200601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string diff --git a/v2/api/network/v1api20200601/storage/zz_generated.deepcopy.go b/v2/api/network/v1api20200601/storage/zz_generated.deepcopy.go index 557fb5738ee..eadf9d9e8b2 100644 --- a/v2/api/network/v1api20200601/storage/zz_generated.deepcopy.go +++ b/v2/api/network/v1api20200601/storage/zz_generated.deepcopy.go @@ -24,6 +24,11 @@ func (in *ARecord) DeepCopyInto(out *ARecord) { *out = new(string) **out = **in } + if in.Ipv4AddressFromConfig != nil { + in, out := &in.Ipv4AddressFromConfig, &out.Ipv4AddressFromConfig + *out = new(genruntime.ConfigMapReference) + **out = **in + } if in.PropertyBag != nil { in, out := &in.PropertyBag, &out.PropertyBag *out = make(genruntime.PropertyBag, len(*in)) diff --git a/v2/api/network/v1api20200601/structure.txt b/v2/api/network/v1api20200601/structure.txt index 51952b15c40..dc8fb94f50c 100644 --- a/v2/api/network/v1api20200601/structure.txt +++ b/v2/api/network/v1api20200601/structure.txt @@ -7,8 +7,9 @@ APIVersion: Enum (1 value) PrivateDnsZonesAAAARecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -81,8 +82,9 @@ PrivateDnsZonesAAAARecord: Resource PrivateDnsZonesARecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -155,8 +157,9 @@ PrivateDnsZonesARecord: Resource PrivateDnsZonesCNAMERecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -229,8 +232,9 @@ PrivateDnsZonesCNAMERecord: Resource PrivateDnsZonesMXRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -303,8 +307,9 @@ PrivateDnsZonesMXRecord: Resource PrivateDnsZonesPTRRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -377,8 +382,9 @@ PrivateDnsZonesPTRRecord: Resource PrivateDnsZonesSRVRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -451,8 +457,9 @@ PrivateDnsZonesSRVRecord: Resource PrivateDnsZonesTXTRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_a_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_a_record_types_gen.go index f9f858af1de..8ca38c1669c 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_a_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_a_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesARecord) createValidations() []func(ctx context.Con record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesARecord) updateValidations() []func(ctx context.Con func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesARecord, newObj *v20200601.PrivateDnsZonesARecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesARecord, newObj *v20200601.PrivateDnsZonesARecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesARecord) validateConfigMapDestinations(ctx context. return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesARecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesARecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesARecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesARecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_aaaa_record_types_gen.go index fc5eaf1e840..19e82de96fa 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_aaaa_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesAAAARecord) createValidations() []func(ctx context. record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesAAAARecord) updateValidations() []func(ctx context. func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesAAAARecord, newObj *v20200601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesAAAARecord, newObj *v20200601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesAAAARecord) validateConfigMapDestinations(ctx conte return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesAAAARecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesAAAARecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_cname_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_cname_record_types_gen.go index 0b5125923e7..8731078171e 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_cname_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_cname_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesCNAMERecord) createValidations() []func(ctx context record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesCNAMERecord) updateValidations() []func(ctx context func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesCNAMERecord, newObj *v20200601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesCNAMERecord, newObj *v20200601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesCNAMERecord) validateConfigMapDestinations(ctx cont return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesCNAMERecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesCNAMERecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_mx_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_mx_record_types_gen.go index a6d294cba7c..aae1306f050 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_mx_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_mx_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesMXRecord) createValidations() []func(ctx context.Co record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesMXRecord) updateValidations() []func(ctx context.Co func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesMXRecord, newObj *v20200601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesMXRecord, newObj *v20200601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesMXRecord) validateConfigMapDestinations(ctx context return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesMXRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesMXRecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_ptr_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_ptr_record_types_gen.go index 9d490a8d70f..1bc3cfd4d40 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_ptr_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_ptr_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesPTRRecord) createValidations() []func(ctx context.C record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesPTRRecord) updateValidations() []func(ctx context.C func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesPTRRecord, newObj *v20200601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesPTRRecord, newObj *v20200601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesPTRRecord) validateConfigMapDestinations(ctx contex return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesPTRRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesPTRRecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_srv_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_srv_record_types_gen.go index 8bdd44df352..3d5c1724a99 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_srv_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_srv_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesSRVRecord) createValidations() []func(ctx context.C record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesSRVRecord) updateValidations() []func(ctx context.C func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesSRVRecord, newObj *v20200601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesSRVRecord, newObj *v20200601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesSRVRecord) validateConfigMapDestinations(ctx contex return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesSRVRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesSRVRecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/webhook/private_dns_zones_txt_record_types_gen.go b/v2/api/network/v1api20200601/webhook/private_dns_zones_txt_record_types_gen.go index 5f925f82adb..feb458888cd 100644 --- a/v2/api/network/v1api20200601/webhook/private_dns_zones_txt_record_types_gen.go +++ b/v2/api/network/v1api20200601/webhook/private_dns_zones_txt_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesTXTRecord) createValidations() []func(ctx context.C record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesTXTRecord) updateValidations() []func(ctx context.C func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesTXTRecord, newObj *v20200601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20200601.PrivateDnsZonesTXTRecord, newObj *v20200601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesTXTRecord) validateConfigMapDestinations(ctx contex return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesTXTRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20200601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesTXTRecord) validateOwnerReference(ctx context.Context, obj *v20200601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20200601/zz_generated.deepcopy.go b/v2/api/network/v1api20200601/zz_generated.deepcopy.go index 2688f1839f9..b1210ab4a7c 100644 --- a/v2/api/network/v1api20200601/zz_generated.deepcopy.go +++ b/v2/api/network/v1api20200601/zz_generated.deepcopy.go @@ -24,6 +24,11 @@ func (in *ARecord) DeepCopyInto(out *ARecord) { *out = new(string) **out = **in } + if in.Ipv4AddressFromConfig != nil { + in, out := &in.Ipv4AddressFromConfig, &out.Ipv4AddressFromConfig + *out = new(genruntime.ConfigMapReference) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ARecord. diff --git a/v2/api/network/v1api20240601/arm/private_dns_zones_aaaa_record_spec_types_gen.go b/v2/api/network/v1api20240601/arm/private_dns_zones_aaaa_record_spec_types_gen.go index 9bf0273f9f8..48f4b8afc8c 100644 --- a/v2/api/network/v1api20240601/arm/private_dns_zones_aaaa_record_spec_types_gen.go +++ b/v2/api/network/v1api20240601/arm/private_dns_zones_aaaa_record_spec_types_gen.go @@ -73,7 +73,7 @@ type AaaaRecord struct { // An A record. type ARecord struct { // Ipv4Address: The IPv4 address of this A record. - Ipv4Address *string `json:"ipv4Address,omitempty"` + Ipv4Address *string `json:"ipv4Address,omitempty" optionalConfigMapPair:"Ipv4Address"` } // A CNAME record. diff --git a/v2/api/network/v1api20240601/private_dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20240601/private_dns_zones_aaaa_record_types_gen.go index 78f5fbd576e..c91a79efef1 100644 --- a/v2/api/network/v1api20240601/private_dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20240601/private_dns_zones_aaaa_record_types_gen.go @@ -1885,7 +1885,10 @@ func (record *AaaaRecord_STATUS) AssignProperties_To_AaaaRecord_STATUS(destinati // An A record. type ARecord struct { // Ipv4Address: The IPv4 address of this A record. - Ipv4Address *string `json:"ipv4Address,omitempty"` + Ipv4Address *string `json:"ipv4Address,omitempty" optionalConfigMapPair:"Ipv4Address"` + + // Ipv4AddressFromConfig: The IPv4 address of this A record. + Ipv4AddressFromConfig *genruntime.ConfigMapReference `json:"ipv4AddressFromConfig,omitempty" optionalConfigMapPair:"Ipv4Address"` } var _ genruntime.ARMTransformer = &ARecord{} @@ -1902,6 +1905,14 @@ func (record *ARecord) ConvertToARM(resolved genruntime.ConvertToARMResolvedDeta ipv4Address := *record.Ipv4Address result.Ipv4Address = &ipv4Address } + if record.Ipv4AddressFromConfig != nil { + ipv4AddressValue, err := resolved.ResolvedConfigMaps.Lookup(*record.Ipv4AddressFromConfig) + if err != nil { + return nil, eris.Wrap(err, "looking up configmap for property Ipv4Address") + } + ipv4Address := ipv4AddressValue + result.Ipv4Address = &ipv4Address + } return result, nil } @@ -1923,6 +1934,8 @@ func (record *ARecord) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, record.Ipv4Address = &ipv4Address } + // no assignment for property "Ipv4AddressFromConfig" + // No error return nil } @@ -1933,6 +1946,14 @@ func (record *ARecord) AssignProperties_From_ARecord(source *storage.ARecord) er // Ipv4Address record.Ipv4Address = genruntime.ClonePointerToString(source.Ipv4Address) + // Ipv4AddressFromConfig + if source.Ipv4AddressFromConfig != nil { + ipv4AddressFromConfig := source.Ipv4AddressFromConfig.Copy() + record.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + record.Ipv4AddressFromConfig = nil + } + // No error return nil } @@ -1945,6 +1966,14 @@ func (record *ARecord) AssignProperties_To_ARecord(destination *storage.ARecord) // Ipv4Address destination.Ipv4Address = genruntime.ClonePointerToString(record.Ipv4Address) + // Ipv4AddressFromConfig + if record.Ipv4AddressFromConfig != nil { + ipv4AddressFromConfig := record.Ipv4AddressFromConfig.Copy() + destination.Ipv4AddressFromConfig = &ipv4AddressFromConfig + } else { + destination.Ipv4AddressFromConfig = nil + } + // Update the property bag if len(propertyBag) > 0 { destination.PropertyBag = propertyBag diff --git a/v2/api/network/v1api20240601/storage/private_dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20240601/storage/private_dns_zones_aaaa_record_types_gen.go index a63a8b93cf8..e906b83b48e 100644 --- a/v2/api/network/v1api20240601/storage/private_dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20240601/storage/private_dns_zones_aaaa_record_types_gen.go @@ -274,8 +274,9 @@ type AaaaRecord_STATUS struct { // Storage version of v1api20240601.ARecord // An A record. type ARecord struct { - Ipv4Address *string `json:"ipv4Address,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Ipv4Address *string `json:"ipv4Address,omitempty" optionalConfigMapPair:"Ipv4Address"` + Ipv4AddressFromConfig *genruntime.ConfigMapReference `json:"ipv4AddressFromConfig,omitempty" optionalConfigMapPair:"Ipv4Address"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } // Storage version of v1api20240601.ARecord_STATUS diff --git a/v2/api/network/v1api20240601/storage/structure.txt b/v2/api/network/v1api20240601/storage/structure.txt index 0355f7dcfc7..cfa00e634ef 100644 --- a/v2/api/network/v1api20240601/storage/structure.txt +++ b/v2/api/network/v1api20240601/storage/structure.txt @@ -47,8 +47,9 @@ PrivateDnsZone: Resource PrivateDnsZonesAAAARecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -149,8 +150,9 @@ PrivateDnsZonesAAAARecord: Resource PrivateDnsZonesARecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -251,8 +253,9 @@ PrivateDnsZonesARecord: Resource PrivateDnsZonesCNAMERecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -353,8 +356,9 @@ PrivateDnsZonesCNAMERecord: Resource PrivateDnsZonesMXRecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -455,8 +459,9 @@ PrivateDnsZonesMXRecord: Resource PrivateDnsZonesPTRRecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -557,8 +562,9 @@ PrivateDnsZonesPTRRecord: Resource PrivateDnsZonesSRVRecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string @@ -659,8 +665,9 @@ PrivateDnsZonesSRVRecord: Resource PrivateDnsZonesTXTRecord: Resource ├── Owner: network/v1api20240601.PrivateDnsZone ├── Spec: Object (16 properties) -│ ├── ARecords: Object (2 properties)[] +│ ├── ARecords: Object (3 properties)[] │ │ ├── Ipv4Address: *string +│ │ ├── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ │ └── PropertyBag: genruntime.PropertyBag │ ├── AaaaRecords: Object (2 properties)[] │ │ ├── Ipv6Address: *string diff --git a/v2/api/network/v1api20240601/storage/zz_generated.deepcopy.go b/v2/api/network/v1api20240601/storage/zz_generated.deepcopy.go index 5e2f7fe4f5e..3f8d2fa6264 100644 --- a/v2/api/network/v1api20240601/storage/zz_generated.deepcopy.go +++ b/v2/api/network/v1api20240601/storage/zz_generated.deepcopy.go @@ -24,6 +24,11 @@ func (in *ARecord) DeepCopyInto(out *ARecord) { *out = new(string) **out = **in } + if in.Ipv4AddressFromConfig != nil { + in, out := &in.Ipv4AddressFromConfig, &out.Ipv4AddressFromConfig + *out = new(genruntime.ConfigMapReference) + **out = **in + } if in.PropertyBag != nil { in, out := &in.PropertyBag, &out.PropertyBag *out = make(genruntime.PropertyBag, len(*in)) diff --git a/v2/api/network/v1api20240601/structure.txt b/v2/api/network/v1api20240601/structure.txt index 55363e28594..b7d64511517 100644 --- a/v2/api/network/v1api20240601/structure.txt +++ b/v2/api/network/v1api20240601/structure.txt @@ -56,8 +56,9 @@ PrivateDnsZone: Resource PrivateDnsZonesAAAARecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -145,8 +146,9 @@ PrivateDnsZonesAAAARecord: Resource PrivateDnsZonesARecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -234,8 +236,9 @@ PrivateDnsZonesARecord: Resource PrivateDnsZonesCNAMERecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -323,8 +326,9 @@ PrivateDnsZonesCNAMERecord: Resource PrivateDnsZonesMXRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -412,8 +416,9 @@ PrivateDnsZonesMXRecord: Resource PrivateDnsZonesPTRRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -501,8 +506,9 @@ PrivateDnsZonesPTRRecord: Resource PrivateDnsZonesSRVRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string @@ -590,8 +596,9 @@ PrivateDnsZonesSRVRecord: Resource PrivateDnsZonesTXTRecord: Resource ├── Owner: PrivateDnsZone ├── Spec: Object (14 properties) -│ ├── ARecords: Object (1 property)[] -│ │ └── Ipv4Address: *string +│ ├── ARecords: Object (2 properties)[] +│ │ ├── Ipv4Address: *string +│ │ └── Ipv4AddressFromConfig: *genruntime.ConfigMapReference │ ├── AaaaRecords: Object (1 property)[] │ │ └── Ipv6Address: *string │ ├── AzureName: string diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_a_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_a_record_types_gen.go index 8492d6582b6..ba86a347bda 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_a_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_a_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesARecord) createValidations() []func(ctx context.Con record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesARecord) updateValidations() []func(ctx context.Con func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesARecord, newObj *v20240601.PrivateDnsZonesARecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesARecord, newObj *v20240601.PrivateDnsZonesARecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesARecord) validateConfigMapDestinations(ctx context. return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesARecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesARecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesARecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesARecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_aaaa_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_aaaa_record_types_gen.go index bac3318aab2..d1cc8af020a 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_aaaa_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_aaaa_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesAAAARecord) createValidations() []func(ctx context. record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesAAAARecord) updateValidations() []func(ctx context. func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesAAAARecord, newObj *v20240601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesAAAARecord, newObj *v20240601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesAAAARecord) validateConfigMapDestinations(ctx conte return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesAAAARecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesAAAARecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesAAAARecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_cname_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_cname_record_types_gen.go index 2ae9be15b33..0bcb154d935 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_cname_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_cname_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesCNAMERecord) createValidations() []func(ctx context record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesCNAMERecord) updateValidations() []func(ctx context func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesCNAMERecord, newObj *v20240601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesCNAMERecord, newObj *v20240601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesCNAMERecord) validateConfigMapDestinations(ctx cont return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesCNAMERecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesCNAMERecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesCNAMERecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_mx_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_mx_record_types_gen.go index 1fae2595a7a..a7d502d91cb 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_mx_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_mx_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesMXRecord) createValidations() []func(ctx context.Co record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesMXRecord) updateValidations() []func(ctx context.Co func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesMXRecord, newObj *v20240601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesMXRecord, newObj *v20240601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesMXRecord) validateConfigMapDestinations(ctx context return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesMXRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesMXRecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesMXRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_ptr_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_ptr_record_types_gen.go index ea61ed2e02b..2d6d693607d 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_ptr_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_ptr_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesPTRRecord) createValidations() []func(ctx context.C record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesPTRRecord) updateValidations() []func(ctx context.C func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesPTRRecord, newObj *v20240601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesPTRRecord, newObj *v20240601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesPTRRecord) validateConfigMapDestinations(ctx contex return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesPTRRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesPTRRecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesPTRRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_srv_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_srv_record_types_gen.go index 575c0d3fc48..cb5f3ee1e58 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_srv_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_srv_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesSRVRecord) createValidations() []func(ctx context.C record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesSRVRecord) updateValidations() []func(ctx context.C func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesSRVRecord, newObj *v20240601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesSRVRecord, newObj *v20240601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesSRVRecord) validateConfigMapDestinations(ctx contex return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesSRVRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesSRVRecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesSRVRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/webhook/private_dns_zones_txt_record_types_gen.go b/v2/api/network/v1api20240601/webhook/private_dns_zones_txt_record_types_gen.go index e6e055e749b..d0d27f9d60d 100644 --- a/v2/api/network/v1api20240601/webhook/private_dns_zones_txt_record_types_gen.go +++ b/v2/api/network/v1api20240601/webhook/private_dns_zones_txt_record_types_gen.go @@ -121,6 +121,7 @@ func (record *PrivateDnsZonesTXTRecord) createValidations() []func(ctx context.C record.validateOwnerReference, record.validateSecretDestinations, record.validateConfigMapDestinations, + record.validateOptionalConfigMapReferences, } } @@ -145,6 +146,9 @@ func (record *PrivateDnsZonesTXTRecord) updateValidations() []func(ctx context.C func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesTXTRecord, newObj *v20240601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { return record.validateConfigMapDestinations(ctx, newObj) }, + func(ctx context.Context, oldObj *v20240601.PrivateDnsZonesTXTRecord, newObj *v20240601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { + return record.validateOptionalConfigMapReferences(ctx, newObj) + }, } } @@ -156,6 +160,15 @@ func (record *PrivateDnsZonesTXTRecord) validateConfigMapDestinations(ctx contex return configmaps.ValidateDestinations(obj, nil, obj.Spec.OperatorSpec.ConfigMapExpressions) } +// validateOptionalConfigMapReferences validates all optional configmap reference pairs to ensure that at most 1 is set +func (record *PrivateDnsZonesTXTRecord) validateOptionalConfigMapReferences(ctx context.Context, obj *v20240601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { + refs, err := reflecthelpers.FindOptionalConfigMapReferences(&obj.Spec) + if err != nil { + return nil, err + } + return configmaps.ValidateOptionalReferences(refs) +} + // validateOwnerReference validates the owner field func (record *PrivateDnsZonesTXTRecord) validateOwnerReference(ctx context.Context, obj *v20240601.PrivateDnsZonesTXTRecord) (admission.Warnings, error) { return genruntime.ValidateOwner(obj) diff --git a/v2/api/network/v1api20240601/zz_generated.deepcopy.go b/v2/api/network/v1api20240601/zz_generated.deepcopy.go index 69797e5a85d..420580f6d17 100644 --- a/v2/api/network/v1api20240601/zz_generated.deepcopy.go +++ b/v2/api/network/v1api20240601/zz_generated.deepcopy.go @@ -24,6 +24,11 @@ func (in *ARecord) DeepCopyInto(out *ARecord) { *out = new(string) **out = **in } + if in.Ipv4AddressFromConfig != nil { + in, out := &in.Ipv4AddressFromConfig, &out.Ipv4AddressFromConfig + *out = new(genruntime.ConfigMapReference) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ARecord. diff --git a/v2/azure-arm.yaml b/v2/azure-arm.yaml index 8bb3578a70a..eba4c2efa27 100644 --- a/v2/azure-arm.yaml +++ b/v2/azure-arm.yaml @@ -3919,6 +3919,9 @@ objectModelConfiguration: PrivateDnsZones_TXT: $exportAs: PrivateDnsZonesTXTRecord $supportedFrom: v2.0.0 + ARecord: + Ipv4Address: + $importConfigMapMode: optional 2020-11-01: BackendAddressPool: # TODO[breaking]: This is actually a real resource that can be created as a child of a loadbalancer, @@ -4401,6 +4404,9 @@ objectModelConfiguration: PrivateDnsZones_TXT: $exportAs: PrivateDnsZonesTXTRecord $supportedFrom: v2.11.0 + ARecord: + Ipv4Address: + $importConfigMapMode: optional SubResource: Id: $referenceType: arm diff --git a/v2/internal/controllers/controller_resources_gen.go b/v2/internal/controllers/controller_resources_gen.go index 6df6969d5f9..14bb425df88 100644 --- a/v2/internal/controllers/controller_resources_gen.go +++ b/v2/internal/controllers/controller_resources_gen.go @@ -1909,13 +1909,139 @@ func getKnownStorageTypes() []*registration.StorageType { result = append(result, ®istration.StorageType{Obj: new(network_v20240301s.VirtualNetworksSubnet)}) result = append(result, ®istration.StorageType{Obj: new(network_v20240301s.VirtualNetworksVirtualNetworkPeering)}) result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZone)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesAAAARecord)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesARecord)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesCNAMERecord)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesMXRecord)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesPTRRecord)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesSRVRecord)}) - result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesTXTRecord)}) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesAAAARecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesAAAARecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesAAAARecordList{}), + }, + }, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesARecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesARecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesARecordList{}), + }, + }, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesCNAMERecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesCNAMERecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesCNAMERecordList{}), + }, + }, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesMXRecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesMXRecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesMXRecordList{}), + }, + }, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesPTRRecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesPTRRecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesPTRRecordList{}), + }, + }, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesSRVRecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesSRVRecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesSRVRecordList{}), + }, + }, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20240601s.PrivateDnsZonesTXTRecord), + Indexes: []registration.Index{ + { + Key: ".spec.aRecords.ipv4AddressFromConfig", + Func: indexNetworkPrivateDnsZonesTXTRecordIpv4AddressFromConfig, + }, + }, + Watches: []registration.Watch{ + { + Type: &v1.ConfigMap{}, + MakeEventHandler: watchConfigMapsFactory( + []string{ + ".spec.aRecords.ipv4AddressFromConfig", + }, + &network_v20240601s.PrivateDnsZonesTXTRecordList{}), + }, + }, + }) result = append(result, ®istration.StorageType{Obj: new(network_v20240601s.PrivateDnsZonesVirtualNetworkLink)}) result = append(result, ®istration.StorageType{Obj: new(network_v20241001s.NetworkWatcher)}) result = append(result, ®istration.StorageType{Obj: new(network_v20241001s.NetworkWatchersFlowLog)}) @@ -8619,6 +8745,118 @@ func indexNetworkDnsForwardingRuleSetsForwardingRuleIpAddressFromConfig(rawObj c return result } +// indexNetworkPrivateDnsZonesAAAARecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesAAAARecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesAAAARecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesAAAARecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + +// indexNetworkPrivateDnsZonesARecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesARecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesARecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesARecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + +// indexNetworkPrivateDnsZonesCNAMERecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesCNAMERecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesCNAMERecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesCNAMERecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + +// indexNetworkPrivateDnsZonesMXRecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesMXRecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesMXRecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesMXRecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + +// indexNetworkPrivateDnsZonesPTRRecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesPTRRecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesPTRRecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesPTRRecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + +// indexNetworkPrivateDnsZonesSRVRecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesSRVRecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesSRVRecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesSRVRecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + +// indexNetworkPrivateDnsZonesTXTRecordIpv4AddressFromConfig an index function for network_v20240601s.PrivateDnsZonesTXTRecord .spec.aRecords.ipv4AddressFromConfig +func indexNetworkPrivateDnsZonesTXTRecordIpv4AddressFromConfig(rawObj client.Object) []string { + obj, ok := rawObj.(*network_v20240601s.PrivateDnsZonesTXTRecord) + if !ok { + return nil + } + var result []string + for _, aRecordItem := range obj.Spec.ARecords { + if aRecordItem.Ipv4AddressFromConfig == nil { + continue + } + result = append(result, aRecordItem.Ipv4AddressFromConfig.Index()...) + } + return result +} + // indexNotificationhubsNamespaceApnsCredentialApnsCertificate an index function for notificationhubs_v20230901s.Namespace .spec.properties.pnsCredentials.apnsCredential.properties.apnsCertificate func indexNotificationhubsNamespaceApnsCredentialApnsCertificate(rawObj client.Object) []string { obj, ok := rawObj.(*notificationhubs_v20230901s.Namespace) diff --git a/v2/samples/network/v1api20200601/v1api20200601_privatednszonesarecord_configmap.yaml b/v2/samples/network/v1api20200601/v1api20200601_privatednszonesarecord_configmap.yaml new file mode 100644 index 00000000000..99b66867a1a --- /dev/null +++ b/v2/samples/network/v1api20200601/v1api20200601_privatednszonesarecord_configmap.yaml @@ -0,0 +1,32 @@ +# Example showing how to use a ConfigMap to provide the IPv4 address for a PrivateDnsZonesARecord +# This is useful when: +# - Private Endpoints are managed in different subscriptions +# - Private Endpoints are managed by other tools (Terraform, Azure Portal) +# - IP addresses need to be dynamically updated without modifying the DNS record manifest + +--- +# ConfigMap containing the IP address(es) +apiVersion: v1 +kind: ConfigMap +metadata: + name: private-endpoint-ips + namespace: default +data: + external-service-ip: "10.10.0.50" + database-endpoint-ip: "10.10.0.51" + +--- +# PrivateDnsZonesARecord using ConfigMap reference +apiVersion: network.azure.com/v1api20200601 +kind: PrivateDnsZonesARecord +metadata: + name: external-service + namespace: default +spec: + aRecords: + - ipv4AddressFromConfig: + name: private-endpoint-ips + key: external-service-ip + owner: + name: aso-sample-pdz.com + ttl: 300 diff --git a/v2/samples/network/v1api20240601/v1api20240601_privatednszonesarecord_configmap.yaml b/v2/samples/network/v1api20240601/v1api20240601_privatednszonesarecord_configmap.yaml new file mode 100644 index 00000000000..b1b32f7a656 --- /dev/null +++ b/v2/samples/network/v1api20240601/v1api20240601_privatednszonesarecord_configmap.yaml @@ -0,0 +1,32 @@ +# Example showing how to use a ConfigMap to provide the IPv4 address for a PrivateDnsZonesARecord +# This is useful when: +# - Private Endpoints are managed in different subscriptions +# - Private Endpoints are managed by other tools (Terraform, Azure Portal) +# - IP addresses need to be dynamically updated without modifying the DNS record manifest + +--- +# ConfigMap containing the IP address(es) +apiVersion: v1 +kind: ConfigMap +metadata: + name: private-endpoint-ips + namespace: default +data: + external-service-ip: "10.10.0.50" + database-endpoint-ip: "10.10.0.51" + +--- +# PrivateDnsZonesARecord using ConfigMap reference +apiVersion: network.azure.com/v1api20240601 +kind: PrivateDnsZonesARecord +metadata: + name: external-service + namespace: default +spec: + aRecords: + - ipv4AddressFromConfig: + name: private-endpoint-ips + key: external-service-ip + owner: + name: aso-sample-pdz.com + ttl: 300