diff --git a/sdk/resourcemanager/dns/armdns/CHANGELOG.md b/sdk/resourcemanager/dns/armdns/CHANGELOG.md index b4c7be0b86fe..53ffd7ee1798 100644 --- a/sdk/resourcemanager/dns/armdns/CHANGELOG.md +++ b/sdk/resourcemanager/dns/armdns/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 2.0.0 (2023-02-10) +### Breaking Changes + +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` has been removed + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/dns/armdns/autorest.md b/sdk/resourcemanager/dns/armdns/autorest.md index 3cf263d9ae2d..5727fba203a7 100644 --- a/sdk/resourcemanager/dns/armdns/autorest.md +++ b/sdk/resourcemanager/dns/armdns/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dns/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dns/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_constants.go b/sdk/resourcemanager/dns/armdns/constants.go similarity index 97% rename from sdk/resourcemanager/dns/armdns/zz_generated_constants.go rename to sdk/resourcemanager/dns/armdns/constants.go index d6394999e52b..d44e857fe988 100644 --- a/sdk/resourcemanager/dns/armdns/zz_generated_constants.go +++ b/sdk/resourcemanager/dns/armdns/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdns const ( moduleName = "armdns" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) type RecordType string diff --git a/sdk/resourcemanager/dns/armdns/go.mod b/sdk/resourcemanager/dns/armdns/go.mod index 90b1a0d5dc26..626c000689cc 100644 --- a/sdk/resourcemanager/dns/armdns/go.mod +++ b/sdk/resourcemanager/dns/armdns/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/dns/armdns/go.sum b/sdk/resourcemanager/dns/armdns/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/dns/armdns/go.sum +++ b/sdk/resourcemanager/dns/armdns/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_models.go b/sdk/resourcemanager/dns/armdns/models.go similarity index 93% rename from sdk/resourcemanager/dns/armdns/zz_generated_models.go rename to sdk/resourcemanager/dns/armdns/models.go index fb5d6469486a..0308c8edd4b6 100644 --- a/sdk/resourcemanager/dns/armdns/zz_generated_models.go +++ b/sdk/resourcemanager/dns/armdns/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdns @@ -32,27 +33,6 @@ type CaaRecord struct { Value *string `json:"value,omitempty"` } -// CloudError - An error response from the service. -type CloudError struct { - // Cloud error body. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A list of additional details about the error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - - // The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` -} - // CnameRecord - A CNAME record. type CnameRecord struct { // The canonical name for this CNAME record. @@ -183,7 +163,8 @@ type RecordSetsClientGetOptions struct { // placeholder for future optional parameters } -// RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.ListAllByDNSZone method. +// RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListAllByDNSZonePager +// method. type RecordSetsClientListAllByDNSZoneOptions struct { // The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is // specified, Enumeration will return only records that end with . @@ -192,7 +173,7 @@ type RecordSetsClientListAllByDNSZoneOptions struct { Top *int32 } -// RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.ListByDNSZone method. +// RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListByDNSZonePager method. type RecordSetsClientListByDNSZoneOptions struct { // The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is // specified, Enumeration will return only records that end with . @@ -201,7 +182,7 @@ type RecordSetsClientListByDNSZoneOptions struct { Top *int32 } -// RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.ListByType method. +// RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager method. type RecordSetsClientListByTypeOptions struct { // The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is // specified, Enumeration will return only records that end with . @@ -416,13 +397,14 @@ type ZonesClientGetOptions struct { // placeholder for future optional parameters } -// ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.ListByResourceGroup method. +// ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.NewListByResourceGroupPager +// method. type ZonesClientListByResourceGroupOptions struct { // The maximum number of record sets to return. If not specified, returns up to 100 record sets. Top *int32 } -// ZonesClientListOptions contains the optional parameters for the ZonesClient.List method. +// ZonesClientListOptions contains the optional parameters for the ZonesClient.NewListPager method. type ZonesClientListOptions struct { // The maximum number of DNS zones to return. If not specified, returns up to 100 zones. Top *int32 diff --git a/sdk/resourcemanager/dns/armdns/models_serde.go b/sdk/resourcemanager/dns/armdns/models_serde.go new file mode 100644 index 000000000000..37a7b669b8ee --- /dev/null +++ b/sdk/resourcemanager/dns/armdns/models_serde.go @@ -0,0 +1,908 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armdns + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ARecord. +func (a ARecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv4Address", a.IPv4Address) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ARecord. +func (a *ARecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipv4Address": + err = unpopulate(val, "IPv4Address", &a.IPv4Address) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AaaaRecord. +func (a AaaaRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv6Address", a.IPv6Address) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AaaaRecord. +func (a *AaaaRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipv6Address": + err = unpopulate(val, "IPv6Address", &a.IPv6Address) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CaaRecord. +func (c CaaRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "flags", c.Flags) + populate(objectMap, "tag", c.Tag) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CaaRecord. +func (c *CaaRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "flags": + err = unpopulate(val, "Flags", &c.Flags) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &c.Tag) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CnameRecord. +func (c CnameRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cname", c.Cname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CnameRecord. +func (c *CnameRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cname": + err = unpopulate(val, "Cname", &c.Cname) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MxRecord. +func (m MxRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exchange", m.Exchange) + populate(objectMap, "preference", m.Preference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MxRecord. +func (m *MxRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exchange": + err = unpopulate(val, "Exchange", &m.Exchange) + delete(rawMsg, key) + case "preference": + err = unpopulate(val, "Preference", &m.Preference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NsRecord. +func (n NsRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nsdname", n.Nsdname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NsRecord. +func (n *NsRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nsdname": + err = unpopulate(val, "Nsdname", &n.Nsdname) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PtrRecord. +func (p PtrRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ptrdname", p.Ptrdname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PtrRecord. +func (p *PtrRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ptrdname": + err = unpopulate(val, "Ptrdname", &p.Ptrdname) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecordSet. +func (r RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSet. +func (r *RecordSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecordSetListResult. +func (r RecordSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetListResult. +func (r *RecordSetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecordSetProperties. +func (r RecordSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ARecords", r.ARecords) + populate(objectMap, "AAAARecords", r.AaaaRecords) + populate(objectMap, "caaRecords", r.CaaRecords) + populate(objectMap, "CNAMERecord", r.CnameRecord) + populate(objectMap, "fqdn", r.Fqdn) + populate(objectMap, "metadata", r.Metadata) + populate(objectMap, "MXRecords", r.MxRecords) + populate(objectMap, "NSRecords", r.NsRecords) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "PTRRecords", r.PtrRecords) + populate(objectMap, "SOARecord", r.SoaRecord) + populate(objectMap, "SRVRecords", r.SrvRecords) + populate(objectMap, "TTL", r.TTL) + populate(objectMap, "targetResource", r.TargetResource) + populate(objectMap, "TXTRecords", r.TxtRecords) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetProperties. +func (r *RecordSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ARecords": + err = unpopulate(val, "ARecords", &r.ARecords) + delete(rawMsg, key) + case "AAAARecords": + err = unpopulate(val, "AaaaRecords", &r.AaaaRecords) + delete(rawMsg, key) + case "caaRecords": + err = unpopulate(val, "CaaRecords", &r.CaaRecords) + delete(rawMsg, key) + case "CNAMERecord": + err = unpopulate(val, "CnameRecord", &r.CnameRecord) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &r.Fqdn) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &r.Metadata) + delete(rawMsg, key) + case "MXRecords": + err = unpopulate(val, "MxRecords", &r.MxRecords) + delete(rawMsg, key) + case "NSRecords": + err = unpopulate(val, "NsRecords", &r.NsRecords) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "PTRRecords": + err = unpopulate(val, "PtrRecords", &r.PtrRecords) + delete(rawMsg, key) + case "SOARecord": + err = unpopulate(val, "SoaRecord", &r.SoaRecord) + delete(rawMsg, key) + case "SRVRecords": + err = unpopulate(val, "SrvRecords", &r.SrvRecords) + delete(rawMsg, key) + case "TTL": + err = unpopulate(val, "TTL", &r.TTL) + delete(rawMsg, key) + case "targetResource": + err = unpopulate(val, "TargetResource", &r.TargetResource) + delete(rawMsg, key) + case "TXTRecords": + err = unpopulate(val, "TxtRecords", &r.TxtRecords) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecordSetUpdateParameters. +func (r RecordSetUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "RecordSet", r.RecordSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetUpdateParameters. +func (r *RecordSetUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "RecordSet": + err = unpopulate(val, "RecordSet", &r.RecordSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceReference. +func (r ResourceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsResources", r.DNSResources) + populate(objectMap, "targetResource", r.TargetResource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReference. +func (r *ResourceReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsResources": + err = unpopulate(val, "DNSResources", &r.DNSResources) + delete(rawMsg, key) + case "targetResource": + err = unpopulate(val, "TargetResource", &r.TargetResource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceReferenceRequest. +func (r ResourceReferenceRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceRequest. +func (r *ResourceReferenceRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceReferenceRequestProperties. +func (r ResourceReferenceRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetResources", r.TargetResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceRequestProperties. +func (r *ResourceReferenceRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetResources": + err = unpopulate(val, "TargetResources", &r.TargetResources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceReferenceResult. +func (r ResourceReferenceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceResult. +func (r *ResourceReferenceResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceReferenceResultProperties. +func (r ResourceReferenceResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsResourceReferences", r.DNSResourceReferences) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceResultProperties. +func (r *ResourceReferenceResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsResourceReferences": + err = unpopulate(val, "DNSResourceReferences", &r.DNSResourceReferences) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoaRecord. +func (s SoaRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "email", s.Email) + populate(objectMap, "expireTime", s.ExpireTime) + populate(objectMap, "host", s.Host) + populate(objectMap, "minimumTTL", s.MinimumTTL) + populate(objectMap, "refreshTime", s.RefreshTime) + populate(objectMap, "retryTime", s.RetryTime) + populate(objectMap, "serialNumber", s.SerialNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoaRecord. +func (s *SoaRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &s.Email) + delete(rawMsg, key) + case "expireTime": + err = unpopulate(val, "ExpireTime", &s.ExpireTime) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &s.Host) + delete(rawMsg, key) + case "minimumTTL": + err = unpopulate(val, "MinimumTTL", &s.MinimumTTL) + delete(rawMsg, key) + case "refreshTime": + err = unpopulate(val, "RefreshTime", &s.RefreshTime) + delete(rawMsg, key) + case "retryTime": + err = unpopulate(val, "RetryTime", &s.RetryTime) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &s.SerialNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SrvRecord. +func (s SrvRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "port", s.Port) + populate(objectMap, "priority", s.Priority) + populate(objectMap, "target", s.Target) + populate(objectMap, "weight", s.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SrvRecord. +func (s *SrvRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &s.Port) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &s.Priority) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &s.Target) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &s.Weight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResource. +func (s SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResource. +func (s *SubResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TxtRecord. +func (t TxtRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TxtRecord. +func (t *TxtRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Zone. +func (z Zone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", z.Etag) + populate(objectMap, "id", z.ID) + populate(objectMap, "location", z.Location) + populate(objectMap, "name", z.Name) + populate(objectMap, "properties", z.Properties) + populate(objectMap, "tags", z.Tags) + populate(objectMap, "type", z.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Zone. +func (z *Zone) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &z.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &z.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &z.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &z.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &z.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &z.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &z.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ZoneListResult. +func (z ZoneListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", z.NextLink) + populate(objectMap, "value", z.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ZoneListResult. +func (z *ZoneListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &z.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &z.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ZoneProperties. +func (z ZoneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxNumberOfRecordSets", z.MaxNumberOfRecordSets) + populate(objectMap, "maxNumberOfRecordsPerRecordSet", z.MaxNumberOfRecordsPerRecordSet) + populate(objectMap, "nameServers", z.NameServers) + populate(objectMap, "numberOfRecordSets", z.NumberOfRecordSets) + populate(objectMap, "registrationVirtualNetworks", z.RegistrationVirtualNetworks) + populate(objectMap, "resolutionVirtualNetworks", z.ResolutionVirtualNetworks) + populate(objectMap, "zoneType", z.ZoneType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ZoneProperties. +func (z *ZoneProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxNumberOfRecordSets": + err = unpopulate(val, "MaxNumberOfRecordSets", &z.MaxNumberOfRecordSets) + delete(rawMsg, key) + case "maxNumberOfRecordsPerRecordSet": + err = unpopulate(val, "MaxNumberOfRecordsPerRecordSet", &z.MaxNumberOfRecordsPerRecordSet) + delete(rawMsg, key) + case "nameServers": + err = unpopulate(val, "NameServers", &z.NameServers) + delete(rawMsg, key) + case "numberOfRecordSets": + err = unpopulate(val, "NumberOfRecordSets", &z.NumberOfRecordSets) + delete(rawMsg, key) + case "registrationVirtualNetworks": + err = unpopulate(val, "RegistrationVirtualNetworks", &z.RegistrationVirtualNetworks) + delete(rawMsg, key) + case "resolutionVirtualNetworks": + err = unpopulate(val, "ResolutionVirtualNetworks", &z.ResolutionVirtualNetworks) + delete(rawMsg, key) + case "zoneType": + err = unpopulate(val, "ZoneType", &z.ZoneType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ZoneUpdate. +func (z ZoneUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", z.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ZoneUpdate. +func (z *ZoneUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &z.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", z, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_recordsets_client.go b/sdk/resourcemanager/dns/armdns/recordsets_client.go similarity index 88% rename from sdk/resourcemanager/dns/armdns/zz_generated_recordsets_client.go rename to sdk/resourcemanager/dns/armdns/recordsets_client.go index be19d9878ba8..6440e2b2ac1c 100644 --- a/sdk/resourcemanager/dns/armdns/zz_generated_recordsets_client.go +++ b/sdk/resourcemanager/dns/armdns/recordsets_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdns @@ -32,9 +33,9 @@ type RecordSetsClient struct { } // NewRecordSetsClient creates a new instance of RecordSetsClient with the specified values. -// subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecordSetsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,15 +58,16 @@ func NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates or updates a record set within a DNS zone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// relativeRecordSetName - The name of the record set, relative to the name of the zone. -// recordType - The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are -// created when the DNS zone is created). -// parameters - Parameters supplied to the CreateOrUpdate operation. -// options - RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - recordType - The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are +// created when the DNS zone is created). +// - parameters - Parameters supplied to the CreateOrUpdate operation. +// - options - RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate +// method. func (client *RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (RecordSetsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options) if err != nil { @@ -129,13 +131,14 @@ func (client *RecordSetsClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes a record set from a DNS zone. This operation cannot be undone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// relativeRecordSetName - The name of the record set, relative to the name of the zone. -// recordType - The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when -// the DNS zone is deleted). -// options - RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - recordType - The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when +// the DNS zone is deleted). +// - options - RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method. func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientDeleteOptions) (RecordSetsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, options) if err != nil { @@ -187,12 +190,13 @@ func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets a record set. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// relativeRecordSetName - The name of the record set, relative to the name of the zone. -// recordType - The type of DNS record in this record set. -// options - RecordSetsClientGetOptions contains the optional parameters for the RecordSetsClient.Get method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - recordType - The type of DNS record in this record set. +// - options - RecordSetsClientGetOptions contains the optional parameters for the RecordSetsClient.Get method. func (client *RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientGetOptions) (RecordSetsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, options) if err != nil { @@ -249,12 +253,12 @@ func (client *RecordSetsClient) getHandleResponse(resp *http.Response) (RecordSe } // NewListAllByDNSZonePager - Lists all record sets in a DNS zone. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// options - RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.ListAllByDNSZone -// method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - options - RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListAllByDNSZonePager +// method. func (client *RecordSetsClient) NewListAllByDNSZonePager(resourceGroupName string, zoneName string, options *RecordSetsClientListAllByDNSZoneOptions) *runtime.Pager[RecordSetsClientListAllByDNSZoneResponse] { return runtime.NewPager(runtime.PagingHandler[RecordSetsClientListAllByDNSZoneResponse]{ More: func(page RecordSetsClientListAllByDNSZoneResponse) bool { @@ -325,12 +329,12 @@ func (client *RecordSetsClient) listAllByDNSZoneHandleResponse(resp *http.Respon } // NewListByDNSZonePager - Lists all record sets in a DNS zone. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// options - RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.ListByDNSZone -// method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - options - RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListByDNSZonePager +// method. func (client *RecordSetsClient) NewListByDNSZonePager(resourceGroupName string, zoneName string, options *RecordSetsClientListByDNSZoneOptions) *runtime.Pager[RecordSetsClientListByDNSZoneResponse] { return runtime.NewPager(runtime.PagingHandler[RecordSetsClientListByDNSZoneResponse]{ More: func(page RecordSetsClientListByDNSZoneResponse) bool { @@ -401,12 +405,13 @@ func (client *RecordSetsClient) listByDNSZoneHandleResponse(resp *http.Response) } // NewListByTypePager - Lists the record sets of a specified type in a DNS zone. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// recordType - The type of record sets to enumerate. -// options - RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.ListByType method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - recordType - The type of record sets to enumerate. +// - options - RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager +// method. func (client *RecordSetsClient) NewListByTypePager(resourceGroupName string, zoneName string, recordType RecordType, options *RecordSetsClientListByTypeOptions) *runtime.Pager[RecordSetsClientListByTypeResponse] { return runtime.NewPager(runtime.PagingHandler[RecordSetsClientListByTypeResponse]{ More: func(page RecordSetsClientListByTypeResponse) bool { @@ -482,13 +487,14 @@ func (client *RecordSetsClient) listByTypeHandleResponse(resp *http.Response) (R // Update - Updates a record set within a DNS zone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// relativeRecordSetName - The name of the record set, relative to the name of the zone. -// recordType - The type of DNS record in this record set. -// parameters - Parameters supplied to the Update operation. -// options - RecordSetsClientUpdateOptions contains the optional parameters for the RecordSetsClient.Update method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - relativeRecordSetName - The name of the record set, relative to the name of the zone. +// - recordType - The type of DNS record in this record set. +// - parameters - Parameters supplied to the Update operation. +// - options - RecordSetsClientUpdateOptions contains the optional parameters for the RecordSetsClient.Update method. func (client *RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientUpdateOptions) (RecordSetsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options) if err != nil { diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_resourcereference_client.go b/sdk/resourcemanager/dns/armdns/resourcereference_client.go similarity index 89% rename from sdk/resourcemanager/dns/armdns/zz_generated_resourcereference_client.go rename to sdk/resourcemanager/dns/armdns/resourcereference_client.go index c2f7f67e677c..2883da0172db 100644 --- a/sdk/resourcemanager/dns/armdns/zz_generated_resourcereference_client.go +++ b/sdk/resourcemanager/dns/armdns/resourcereference_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdns @@ -31,9 +32,9 @@ type ResourceReferenceClient struct { } // NewResourceReferenceClient creates a new instance of ResourceReferenceClient with the specified values. -// subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewResourceReferenceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceReferenceClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,10 +57,11 @@ func NewResourceReferenceClient(subscriptionID string, credential azcore.TokenCr // GetByTargetResources - Returns the DNS records specified by the referencing targetResourceIds. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// parameters - Properties for dns resource reference request. -// options - ResourceReferenceClientGetByTargetResourcesOptions contains the optional parameters for the ResourceReferenceClient.GetByTargetResources -// method. +// - parameters - Properties for dns resource reference request. +// - options - ResourceReferenceClientGetByTargetResourcesOptions contains the optional parameters for the ResourceReferenceClient.GetByTargetResources +// method. func (client *ResourceReferenceClient) GetByTargetResources(ctx context.Context, parameters ResourceReferenceRequest, options *ResourceReferenceClientGetByTargetResourcesOptions) (ResourceReferenceClientGetByTargetResourcesResponse, error) { req, err := client.getByTargetResourcesCreateRequest(ctx, parameters, options) if err != nil { diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_response_types.go b/sdk/resourcemanager/dns/armdns/response_types.go similarity index 90% rename from sdk/resourcemanager/dns/armdns/zz_generated_response_types.go rename to sdk/resourcemanager/dns/armdns/response_types.go index 75b0f90fc2c1..2823f0193016 100644 --- a/sdk/resourcemanager/dns/armdns/zz_generated_response_types.go +++ b/sdk/resourcemanager/dns/armdns/response_types.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdns @@ -23,17 +24,17 @@ type RecordSetsClientGetResponse struct { RecordSet } -// RecordSetsClientListAllByDNSZoneResponse contains the response from method RecordSetsClient.ListAllByDNSZone. +// RecordSetsClientListAllByDNSZoneResponse contains the response from method RecordSetsClient.NewListAllByDNSZonePager. type RecordSetsClientListAllByDNSZoneResponse struct { RecordSetListResult } -// RecordSetsClientListByDNSZoneResponse contains the response from method RecordSetsClient.ListByDNSZone. +// RecordSetsClientListByDNSZoneResponse contains the response from method RecordSetsClient.NewListByDNSZonePager. type RecordSetsClientListByDNSZoneResponse struct { RecordSetListResult } -// RecordSetsClientListByTypeResponse contains the response from method RecordSetsClient.ListByType. +// RecordSetsClientListByTypeResponse contains the response from method RecordSetsClient.NewListByTypePager. type RecordSetsClientListByTypeResponse struct { RecordSetListResult } @@ -53,7 +54,7 @@ type ZonesClientCreateOrUpdateResponse struct { Zone } -// ZonesClientDeleteResponse contains the response from method ZonesClient.Delete. +// ZonesClientDeleteResponse contains the response from method ZonesClient.BeginDelete. type ZonesClientDeleteResponse struct { // placeholder for future response values } @@ -63,12 +64,12 @@ type ZonesClientGetResponse struct { Zone } -// ZonesClientListByResourceGroupResponse contains the response from method ZonesClient.ListByResourceGroup. +// ZonesClientListByResourceGroupResponse contains the response from method ZonesClient.NewListByResourceGroupPager. type ZonesClientListByResourceGroupResponse struct { ZoneListResult } -// ZonesClientListResponse contains the response from method ZonesClient.List. +// ZonesClientListResponse contains the response from method ZonesClient.NewListPager. type ZonesClientListResponse struct { ZoneListResult } diff --git a/sdk/resourcemanager/dns/armdns/ze_generated_example_dnsresourcereference_client_test.go b/sdk/resourcemanager/dns/armdns/ze_generated_example_dnsresourcereference_client_test.go deleted file mode 100644 index 0adee515c612..000000000000 --- a/sdk/resourcemanager/dns/armdns/ze_generated_example_dnsresourcereference_client_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdns_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetDnsResourceReference.json -func ExampleResourceReferenceClient_GetByTargetResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewResourceReferenceClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByTargetResources(ctx, - armdns.ResourceReferenceRequest{ - Properties: &armdns.ResourceReferenceRequestProperties{ - TargetResources: []*armdns.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/trafficManagerProfiles/testpp2"), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dns/armdns/ze_generated_example_recordsets_client_test.go b/sdk/resourcemanager/dns/armdns/ze_generated_example_recordsets_client_test.go deleted file mode 100644 index 4ff81a76d167..000000000000 --- a/sdk/resourcemanager/dns/armdns/ze_generated_example_recordsets_client_test.go +++ /dev/null @@ -1,162 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdns_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchARecordset.json -func ExampleRecordSetsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewRecordSetsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "rg1", - "zone1", - "record1", - armdns.RecordTypeA, - armdns.RecordSet{ - Properties: &armdns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, - &armdns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordset.json -func ExampleRecordSetsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewRecordSetsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "rg1", - "zone1", - "record1", - armdns.RecordTypeA, - armdns.RecordSet{ - Properties: &armdns.RecordSetProperties{ - ARecords: []*armdns.ARecord{ - { - IPv4Address: to.Ptr("127.0.0.1"), - }}, - TTL: to.Ptr[int64](3600), - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, - }, - &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json -func ExampleRecordSetsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewRecordSetsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "rg1", - "zone1", - "record1", - armdns.RecordTypeA, - &armdns.RecordSetsClientDeleteOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json -func ExampleRecordSetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewRecordSetsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "zone1", - "record1", - armdns.RecordTypeA, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListARecordset.json -func ExampleRecordSetsClient_NewListByTypePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewRecordSetsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByTypePager("rg1", - "zone1", - armdns.RecordTypeA, - &armdns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dns/armdns/ze_generated_example_zones_client_test.go b/sdk/resourcemanager/dns/armdns/ze_generated_example_zones_client_test.go deleted file mode 100644 index 415e225f105d..000000000000 --- a/sdk/resourcemanager/dns/armdns/ze_generated_example_zones_client_test.go +++ /dev/null @@ -1,170 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdns_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateZone.json -func ExampleZonesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewZonesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "rg1", - "zone1", - armdns.Zone{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, - &armdns.ZonesClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteZone.json -func ExampleZonesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewZonesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "zone1", - &armdns.ZonesClientBeginDeleteOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetZone.json -func ExampleZonesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewZonesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "zone1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchZone.json -func ExampleZonesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewZonesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "rg1", - "zone1", - armdns.ZoneUpdate{ - Tags: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - &armdns.ZonesClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesByResourceGroup.json -func ExampleZonesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewZonesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", - &armdns.ZonesClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesBySubscription.json -func ExampleZonesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdns.NewZonesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armdns.ZonesClientListOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_zones_client.go b/sdk/resourcemanager/dns/armdns/zones_client.go similarity index 90% rename from sdk/resourcemanager/dns/armdns/zz_generated_zones_client.go rename to sdk/resourcemanager/dns/armdns/zones_client.go index 72da125f7ef5..70f77e881719 100644 --- a/sdk/resourcemanager/dns/armdns/zz_generated_zones_client.go +++ b/sdk/resourcemanager/dns/armdns/zones_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdns @@ -32,9 +33,9 @@ type ZonesClient struct { } // NewZonesClient creates a new instance of ZonesClient with the specified values. -// subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ZonesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +58,12 @@ func NewZonesClient(subscriptionID string, credential azcore.TokenCredential, op // CreateOrUpdate - Creates or updates a DNS zone. Does not modify DNS records within the zone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// parameters - Parameters supplied to the CreateOrUpdate operation. -// options - ZonesClientCreateOrUpdateOptions contains the optional parameters for the ZonesClient.CreateOrUpdate method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - parameters - Parameters supplied to the CreateOrUpdate operation. +// - options - ZonesClientCreateOrUpdateOptions contains the optional parameters for the ZonesClient.CreateOrUpdate method. func (client *ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, options *ZonesClientCreateOrUpdateOptions) (ZonesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, zoneName, parameters, options) if err != nil { @@ -120,10 +122,11 @@ func (client *ZonesClient) createOrUpdateHandleResponse(resp *http.Response) (Zo // BeginDelete - Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// options - ZonesClientBeginDeleteOptions contains the optional parameters for the ZonesClient.BeginDelete method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - options - ZonesClientBeginDeleteOptions contains the optional parameters for the ZonesClient.BeginDelete method. func (client *ZonesClient) BeginDelete(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientBeginDeleteOptions) (*runtime.Poller[ZonesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, zoneName, options) @@ -138,6 +141,7 @@ func (client *ZonesClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 func (client *ZonesClient) deleteOperation(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, zoneName, options) @@ -185,10 +189,11 @@ func (client *ZonesClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// options - ZonesClientGetOptions contains the optional parameters for the ZonesClient.Get method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - options - ZonesClientGetOptions contains the optional parameters for the ZonesClient.Get method. func (client *ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientGetOptions) (ZonesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, zoneName, options) if err != nil { @@ -240,9 +245,9 @@ func (client *ZonesClient) getHandleResponse(resp *http.Response) (ZonesClientGe } // NewListPager - Lists the DNS zones in all resource groups in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// options - ZonesClientListOptions contains the optional parameters for the ZonesClient.List method. +// - options - ZonesClientListOptions contains the optional parameters for the ZonesClient.NewListPager method. func (client *ZonesClient) NewListPager(options *ZonesClientListOptions) *runtime.Pager[ZonesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ZonesClientListResponse]{ More: func(page ZonesClientListResponse) bool { @@ -302,11 +307,11 @@ func (client *ZonesClient) listHandleResponse(resp *http.Response) (ZonesClientL } // NewListByResourceGroupPager - Lists the DNS zones within a resource group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// options - ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. +// - options - ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.NewListByResourceGroupPager +// method. func (client *ZonesClient) NewListByResourceGroupPager(resourceGroupName string, options *ZonesClientListByResourceGroupOptions) *runtime.Pager[ZonesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ZonesClientListByResourceGroupResponse]{ More: func(page ZonesClientListByResourceGroupResponse) bool { @@ -371,11 +376,12 @@ func (client *ZonesClient) listByResourceGroupHandleResponse(resp *http.Response // Update - Updates a DNS zone. Does not modify DNS records within the zone. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-05-01 -// resourceGroupName - The name of the resource group. -// zoneName - The name of the DNS zone (without a terminating dot). -// parameters - Parameters supplied to the Update operation. -// options - ZonesClientUpdateOptions contains the optional parameters for the ZonesClient.Update method. +// - resourceGroupName - The name of the resource group. +// - zoneName - The name of the DNS zone (without a terminating dot). +// - parameters - Parameters supplied to the Update operation. +// - options - ZonesClientUpdateOptions contains the optional parameters for the ZonesClient.Update method. func (client *ZonesClient) Update(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, options *ZonesClientUpdateOptions) (ZonesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, zoneName, parameters, options) if err != nil { diff --git a/sdk/resourcemanager/dns/armdns/zz_generated_models_serde.go b/sdk/resourcemanager/dns/armdns/zz_generated_models_serde.go deleted file mode 100644 index 9e93a4ecb78a..000000000000 --- a/sdk/resourcemanager/dns/armdns/zz_generated_models_serde.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdns - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type RecordSet. -func (r RecordSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", r.Etag) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RecordSetProperties. -func (r RecordSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ARecords", r.ARecords) - populate(objectMap, "AAAARecords", r.AaaaRecords) - populate(objectMap, "caaRecords", r.CaaRecords) - populate(objectMap, "CNAMERecord", r.CnameRecord) - populate(objectMap, "fqdn", r.Fqdn) - populate(objectMap, "metadata", r.Metadata) - populate(objectMap, "MXRecords", r.MxRecords) - populate(objectMap, "NSRecords", r.NsRecords) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "PTRRecords", r.PtrRecords) - populate(objectMap, "SOARecord", r.SoaRecord) - populate(objectMap, "SRVRecords", r.SrvRecords) - populate(objectMap, "TTL", r.TTL) - populate(objectMap, "targetResource", r.TargetResource) - populate(objectMap, "TXTRecords", r.TxtRecords) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceReferenceRequestProperties. -func (r ResourceReferenceRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "targetResources", r.TargetResources) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TxtRecord. -func (t TxtRecord) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Zone. -func (z Zone) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", z.Etag) - populate(objectMap, "id", z.ID) - populate(objectMap, "location", z.Location) - populate(objectMap, "name", z.Name) - populate(objectMap, "properties", z.Properties) - populate(objectMap, "tags", z.Tags) - populate(objectMap, "type", z.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ZoneProperties. -func (z ZoneProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "maxNumberOfRecordSets", z.MaxNumberOfRecordSets) - populate(objectMap, "maxNumberOfRecordsPerRecordSet", z.MaxNumberOfRecordsPerRecordSet) - populate(objectMap, "nameServers", z.NameServers) - populate(objectMap, "numberOfRecordSets", z.NumberOfRecordSets) - populate(objectMap, "registrationVirtualNetworks", z.RegistrationVirtualNetworks) - populate(objectMap, "resolutionVirtualNetworks", z.ResolutionVirtualNetworks) - populate(objectMap, "zoneType", z.ZoneType) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ZoneUpdate. -func (z ZoneUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", z.Tags) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -}