diff --git a/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md b/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md index d72b7923ce62..764940ee4519 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md +++ b/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 2.0.0 (2025-04-29) +### Breaking Changes + +- Function `*RecordSetsClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, RecordType, string, RecordSet, *RecordSetsClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, RecordType, RecordSet, *RecordSetsClientCreateOrUpdateOptions)` +- Function `*RecordSetsClient.Delete` parameter(s) have been changed from `(context.Context, string, string, RecordType, string, *RecordSetsClientDeleteOptions)` to `(context.Context, string, string, string, RecordType, *RecordSetsClientDeleteOptions)` +- Function `*RecordSetsClient.Get` parameter(s) have been changed from `(context.Context, string, string, RecordType, string, *RecordSetsClientGetOptions)` to `(context.Context, string, string, string, RecordType, *RecordSetsClientGetOptions)` +- Function `*RecordSetsClient.Update` parameter(s) have been changed from `(context.Context, string, string, RecordType, string, RecordSet, *RecordSetsClientUpdateOptions)` to `(context.Context, string, string, string, RecordType, RecordSet, *RecordSetsClientUpdateOptions)` + +### Features Added + +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponse` +- New struct `SystemData` +- New field `SystemData` in struct `PrivateZone` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `RecordSet` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` +- New field `SystemData` in struct `VirtualNetworkLink` + + ## 1.3.0 (2024-09-27) ### Features Added diff --git a/sdk/resourcemanager/privatedns/armprivatedns/README.md b/sdk/resourcemanager/privatedns/armprivatedns/README.md index ce4901f94880..7e6d2749c2eb 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/README.md +++ b/sdk/resourcemanager/privatedns/armprivatedns/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Private DNS module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/privatedns/armprivatedns/autorest.md b/sdk/resourcemanager/privatedns/armprivatedns/autorest.md index 86976977cadd..d16b4476ac0d 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/autorest.md +++ b/sdk/resourcemanager/privatedns/armprivatedns/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/privatedns/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/privatedns/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.3.0 -tag: package-2024-06 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go b/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go index 13ac4109c9e7..12898a97b82f 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/client_factory.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -22,8 +19,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID -// forms part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { diff --git a/sdk/resourcemanager/privatedns/armprivatedns/constants.go b/sdk/resourcemanager/privatedns/armprivatedns/constants.go index 8f4b211580e8..39458e8de1ac 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/constants.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/constants.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -10,9 +7,29 @@ package armprivatedns const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" - moduleVersion = "v1.3.0" + moduleVersion = "v2.0.0" +) + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" ) +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + // ProvisioningState - The provisioning state of the resource. This is a read-only property and any attempt to set this value // will be ignored. type ProvisioningState string diff --git a/sdk/resourcemanager/privatedns/armprivatedns/fake/internal.go b/sdk/resourcemanager/privatedns/armprivatedns/fake/internal.go index 96339f26b377..aae62d9dd5b9 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/fake/internal.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/fake/internal.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/fake/privatezones_server.go b/sdk/resourcemanager/privatedns/armprivatedns/fake/privatezones_server.go index 89b7f19a6d61..4978169d3f72 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/fake/privatezones_server.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/fake/privatezones_server.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -16,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/v2" "net/http" "net/url" "regexp" @@ -83,31 +80,50 @@ func (p *PrivateZonesServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateZonesClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateZonesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateZonesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateZonesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PrivateZonesClient.NewListByResourceGroupPager": - resp, err = p.dispatchNewListByResourceGroupPager(req) - case "PrivateZonesClient.BeginUpdate": - resp, err = p.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateZonesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateZonesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateZonesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateZonesClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateZonesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateZonesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateZonesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateZonesClient.NewListByResourceGroupPager": + res.resp, res.err = p.dispatchNewListByResourceGroupPager(req) + case "PrivateZonesClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateZonesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -134,8 +150,8 @@ func (p *PrivateZonesServerTransport) dispatchBeginCreateOrUpdate(req *http.Requ if err != nil { return nil, err } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) + ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "if-none-match")) var options *armprivatedns.PrivateZonesClientBeginCreateOrUpdateOptions if ifMatchParam != nil || ifNoneMatchParam != nil { options = &armprivatedns.PrivateZonesClientBeginCreateOrUpdateOptions{ @@ -187,7 +203,7 @@ func (p *PrivateZonesServerTransport) dispatchBeginDelete(req *http.Request) (*h if err != nil { return nil, err } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) var options *armprivatedns.PrivateZonesClientBeginDeleteOptions if ifMatchParam != nil { options = &armprivatedns.PrivateZonesClientBeginDeleteOptions{ @@ -387,7 +403,7 @@ func (p *PrivateZonesServerTransport) dispatchBeginUpdate(req *http.Request) (*h if err != nil { return nil, err } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) var options *armprivatedns.PrivateZonesClientBeginUpdateOptions if ifMatchParam != nil { options = &armprivatedns.PrivateZonesClientBeginUpdateOptions{ @@ -417,3 +433,9 @@ func (p *PrivateZonesServerTransport) dispatchBeginUpdate(req *http.Request) (*h return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateZonesServerTransport +var privateZonesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/privatedns/armprivatedns/fake/recordsets_server.go b/sdk/resourcemanager/privatedns/armprivatedns/fake/recordsets_server.go index 088bcbf0c244..1890cb0bc5e6 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/fake/recordsets_server.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/fake/recordsets_server.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -16,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/v2" "net/http" "net/url" "regexp" @@ -27,15 +24,15 @@ import ( type RecordSetsServer struct { // CreateOrUpdate is the fake for method RecordSetsClient.CreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, privateZoneName string, recordType armprivatedns.RecordType, relativeRecordSetName string, parameters armprivatedns.RecordSet, options *armprivatedns.RecordSetsClientCreateOrUpdateOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + CreateOrUpdate func(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType armprivatedns.RecordType, parameters armprivatedns.RecordSet, options *armprivatedns.RecordSetsClientCreateOrUpdateOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method RecordSetsClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, privateZoneName string, recordType armprivatedns.RecordType, relativeRecordSetName string, options *armprivatedns.RecordSetsClientDeleteOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientDeleteResponse], errResp azfake.ErrorResponder) + Delete func(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType armprivatedns.RecordType, options *armprivatedns.RecordSetsClientDeleteOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method RecordSetsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, privateZoneName string, recordType armprivatedns.RecordType, relativeRecordSetName string, options *armprivatedns.RecordSetsClientGetOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType armprivatedns.RecordType, options *armprivatedns.RecordSetsClientGetOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method RecordSetsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -47,7 +44,7 @@ type RecordSetsServer struct { // Update is the fake for method RecordSetsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, privateZoneName string, recordType armprivatedns.RecordType, relativeRecordSetName string, parameters armprivatedns.RecordSet, options *armprivatedns.RecordSetsClientUpdateOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType armprivatedns.RecordType, parameters armprivatedns.RecordSet, options *armprivatedns.RecordSetsClientUpdateOptions) (resp azfake.Responder[armprivatedns.RecordSetsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewRecordSetsServerTransport creates a new instance of RecordSetsServerTransport with the provided implementation. @@ -77,38 +74,57 @@ func (r *RecordSetsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RecordSetsClient.CreateOrUpdate": - resp, err = r.dispatchCreateOrUpdate(req) - case "RecordSetsClient.Delete": - resp, err = r.dispatchDelete(req) - case "RecordSetsClient.Get": - resp, err = r.dispatchGet(req) - case "RecordSetsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "RecordSetsClient.NewListByTypePager": - resp, err = r.dispatchNewListByTypePager(req) - case "RecordSetsClient.Update": - resp, err = r.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RecordSetsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if recordSetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = recordSetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RecordSetsClient.CreateOrUpdate": + res.resp, res.err = r.dispatchCreateOrUpdate(req) + case "RecordSetsClient.Delete": + res.resp, res.err = r.dispatchDelete(req) + case "RecordSetsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RecordSetsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "RecordSetsClient.NewListByTypePager": + res.resp, res.err = r.dispatchNewListByTypePager(req) + case "RecordSetsClient.Update": + res.resp, res.err = r.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RecordSetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { if r.srv.CreateOrUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/{recordType}` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 5 { @@ -126,6 +142,10 @@ func (r *RecordSetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (* if err != nil { return nil, err } + relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) + if err != nil { + return nil, err + } recordTypeParam, err := parseWithCast(matches[regex.SubexpIndex("recordType")], func(v string) (armprivatedns.RecordType, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { @@ -136,12 +156,8 @@ func (r *RecordSetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (* if err != nil { return nil, err } - relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) + ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "if-none-match")) var options *armprivatedns.RecordSetsClientCreateOrUpdateOptions if ifMatchParam != nil || ifNoneMatchParam != nil { options = &armprivatedns.RecordSetsClientCreateOrUpdateOptions{ @@ -149,7 +165,7 @@ func (r *RecordSetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (* IfNoneMatch: ifNoneMatchParam, } } - respr, errRespr := r.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, privateZoneNameParam, recordTypeParam, relativeRecordSetNameParam, body, options) + respr, errRespr := r.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, privateZoneNameParam, relativeRecordSetNameParam, recordTypeParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -168,7 +184,7 @@ func (r *RecordSetsServerTransport) dispatchDelete(req *http.Request) (*http.Res if r.srv.Delete == nil { return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/{recordType}` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 5 { @@ -182,6 +198,10 @@ func (r *RecordSetsServerTransport) dispatchDelete(req *http.Request) (*http.Res if err != nil { return nil, err } + relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) + if err != nil { + return nil, err + } recordTypeParam, err := parseWithCast(matches[regex.SubexpIndex("recordType")], func(v string) (armprivatedns.RecordType, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { @@ -192,18 +212,14 @@ func (r *RecordSetsServerTransport) dispatchDelete(req *http.Request) (*http.Res if err != nil { return nil, err } - relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) var options *armprivatedns.RecordSetsClientDeleteOptions if ifMatchParam != nil { options = &armprivatedns.RecordSetsClientDeleteOptions{ IfMatch: ifMatchParam, } } - respr, errRespr := r.srv.Delete(req.Context(), resourceGroupNameParam, privateZoneNameParam, recordTypeParam, relativeRecordSetNameParam, options) + respr, errRespr := r.srv.Delete(req.Context(), resourceGroupNameParam, privateZoneNameParam, relativeRecordSetNameParam, recordTypeParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -222,7 +238,7 @@ func (r *RecordSetsServerTransport) dispatchGet(req *http.Request) (*http.Respon if r.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/{recordType}` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 5 { @@ -236,6 +252,10 @@ func (r *RecordSetsServerTransport) dispatchGet(req *http.Request) (*http.Respon if err != nil { return nil, err } + relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) + if err != nil { + return nil, err + } recordTypeParam, err := parseWithCast(matches[regex.SubexpIndex("recordType")], func(v string) (armprivatedns.RecordType, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { @@ -246,11 +266,7 @@ func (r *RecordSetsServerTransport) dispatchGet(req *http.Request) (*http.Respon if err != nil { return nil, err } - relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, privateZoneNameParam, recordTypeParam, relativeRecordSetNameParam, nil) + respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, privateZoneNameParam, relativeRecordSetNameParam, recordTypeParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -271,7 +287,7 @@ func (r *RecordSetsServerTransport) dispatchNewListPager(req *http.Request) (*ht } newListPager := r.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ALL` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/aLL` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -339,7 +355,7 @@ func (r *RecordSetsServerTransport) dispatchNewListByTypePager(req *http.Request } newListByTypePager := r.newListByTypePager.get(req) if newListByTypePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/{recordType}` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 4 { @@ -415,7 +431,7 @@ func (r *RecordSetsServerTransport) dispatchUpdate(req *http.Request) (*http.Res if r.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/privateDnsZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/{recordType}` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 5 { @@ -433,6 +449,10 @@ func (r *RecordSetsServerTransport) dispatchUpdate(req *http.Request) (*http.Res if err != nil { return nil, err } + relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) + if err != nil { + return nil, err + } recordTypeParam, err := parseWithCast(matches[regex.SubexpIndex("recordType")], func(v string) (armprivatedns.RecordType, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { @@ -443,18 +463,14 @@ func (r *RecordSetsServerTransport) dispatchUpdate(req *http.Request) (*http.Res if err != nil { return nil, err } - relativeRecordSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("relativeRecordSetName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) var options *armprivatedns.RecordSetsClientUpdateOptions if ifMatchParam != nil { options = &armprivatedns.RecordSetsClientUpdateOptions{ IfMatch: ifMatchParam, } } - respr, errRespr := r.srv.Update(req.Context(), resourceGroupNameParam, privateZoneNameParam, recordTypeParam, relativeRecordSetNameParam, body, options) + respr, errRespr := r.srv.Update(req.Context(), resourceGroupNameParam, privateZoneNameParam, relativeRecordSetNameParam, recordTypeParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -468,3 +484,9 @@ func (r *RecordSetsServerTransport) dispatchUpdate(req *http.Request) (*http.Res } return resp, nil } + +// set this to conditionally intercept incoming requests to RecordSetsServerTransport +var recordSetsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/privatedns/armprivatedns/fake/server_factory.go b/sdk/resourcemanager/privatedns/armprivatedns/fake/server_factory.go index 934fe1514dd9..298571d04a40 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/fake/server_factory.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/fake/server_factory.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -19,8 +16,13 @@ import ( // ServerFactory is a fake server for instances of the armprivatedns.ClientFactory type. type ServerFactory struct { - PrivateZonesServer PrivateZonesServer - RecordSetsServer RecordSetsServer + // PrivateZonesServer contains the fakes for client PrivateZonesClient + PrivateZonesServer PrivateZonesServer + + // RecordSetsServer contains the fakes for client RecordSetsClient + RecordSetsServer RecordSetsServer + + // VirtualNetworkLinksServer contains the fakes for client VirtualNetworkLinksClient VirtualNetworkLinksServer VirtualNetworkLinksServer } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/fake/virtualnetworklinks_server.go b/sdk/resourcemanager/privatedns/armprivatedns/fake/virtualnetworklinks_server.go index 1cfac60fbe0c..284feb6e572f 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/fake/virtualnetworklinks_server.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/fake/virtualnetworklinks_server.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -16,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/v2" "net/http" "net/url" "regexp" @@ -77,29 +74,48 @@ func (v *VirtualNetworkLinksServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return v.dispatchToMethodFake(req, method) +} - switch method { - case "VirtualNetworkLinksClient.BeginCreateOrUpdate": - resp, err = v.dispatchBeginCreateOrUpdate(req) - case "VirtualNetworkLinksClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VirtualNetworkLinksClient.Get": - resp, err = v.dispatchGet(req) - case "VirtualNetworkLinksClient.NewListPager": - resp, err = v.dispatchNewListPager(req) - case "VirtualNetworkLinksClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VirtualNetworkLinksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if virtualNetworkLinksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualNetworkLinksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualNetworkLinksClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualNetworkLinksClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VirtualNetworkLinksClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VirtualNetworkLinksClient.NewListPager": + res.resp, res.err = v.dispatchNewListPager(req) + case "VirtualNetworkLinksClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (v *VirtualNetworkLinksServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -130,8 +146,8 @@ func (v *VirtualNetworkLinksServerTransport) dispatchBeginCreateOrUpdate(req *ht if err != nil { return nil, err } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) + ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "if-none-match")) var options *armprivatedns.VirtualNetworkLinksClientBeginCreateOrUpdateOptions if ifMatchParam != nil || ifNoneMatchParam != nil { options = &armprivatedns.VirtualNetworkLinksClientBeginCreateOrUpdateOptions{ @@ -187,7 +203,7 @@ func (v *VirtualNetworkLinksServerTransport) dispatchBeginDelete(req *http.Reque if err != nil { return nil, err } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) var options *armprivatedns.VirtualNetworkLinksClientBeginDeleteOptions if ifMatchParam != nil { options = &armprivatedns.VirtualNetworkLinksClientBeginDeleteOptions{ @@ -345,7 +361,7 @@ func (v *VirtualNetworkLinksServerTransport) dispatchBeginUpdate(req *http.Reque if err != nil { return nil, err } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifMatchParam := getOptional(getHeaderValue(req.Header, "if-match")) var options *armprivatedns.VirtualNetworkLinksClientBeginUpdateOptions if ifMatchParam != nil { options = &armprivatedns.VirtualNetworkLinksClientBeginUpdateOptions{ @@ -375,3 +391,9 @@ func (v *VirtualNetworkLinksServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualNetworkLinksServerTransport +var virtualNetworkLinksServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/privatedns/armprivatedns/go.mod b/sdk/resourcemanager/privatedns/armprivatedns/go.mod index 906502a4b4a6..2f0c38e6c891 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/go.mod +++ b/sdk/resourcemanager/privatedns/armprivatedns/go.mod @@ -1,10 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/v2 go 1.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.2 // indirect diff --git a/sdk/resourcemanager/privatedns/armprivatedns/models.go b/sdk/resourcemanager/privatedns/armprivatedns/models.go index e9da11b0a8c0..6df84b7ce10e 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/models.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/models.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -8,6 +5,8 @@ package armprivatedns +import "time" + // ARecord - An A record. type ARecord struct { // The IPv4 address of this A record. @@ -26,6 +25,40 @@ type CnameRecord struct { Cname *string } +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail +} + // MxRecord - An MX record. type MxRecord struct { // The domain name of the mail host for this MX record. @@ -37,34 +70,37 @@ type MxRecord struct { // PrivateZone - Describes a Private DNS zone. type PrivateZone struct { + // REQUIRED; The geo-location where the resource lives + Location *string + // The ETag of the zone. Etag *string - // The Azure Region where the resource lives - Location *string - // Properties of the Private DNS zone. Properties *PrivateZoneProperties // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// PrivateZoneListResult - The response to a Private DNS zone list operation. +// PrivateZoneListResult - The response of a PrivateZone list operation. type PrivateZoneListResult struct { - // Information about the Private DNS zones. + // REQUIRED; The PrivateZone items on this page Value []*PrivateZone - // READ-ONLY; The continuation token for the next page of results. + // The link to the next page of items NextLink *string } @@ -102,15 +138,19 @@ type PrivateZoneProperties struct { ProvisioningState *ProvisioningState } -// ProxyResource - The resource model definition for an ARM proxy resource. +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location type ProxyResource struct { - // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -128,22 +168,25 @@ type RecordSet struct { // The properties of the record set. Properties *RecordSetProperties - // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// RecordSetListResult - The response to a record set list operation. +// RecordSetListResult - The response of a RecordSet list operation. type RecordSetListResult struct { - // Information about the record sets in the response. + // REQUIRED; The RecordSet items on this page Value []*RecordSet - // READ-ONLY; The continuation token for the next page of results. + // The link to the next page of items NextLink *string } @@ -186,15 +229,18 @@ type RecordSetProperties struct { IsAutoRegistered *bool } -// Resource - The core properties of ARM resources +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -243,21 +289,46 @@ type SubResource struct { ID *string } -// TrackedResource - The resource model definition for a ARM tracked top level resource +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' type TrackedResource struct { - // The Azure Region where the resource lives + // REQUIRED; The geo-location where the resource lives Location *string // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -269,34 +340,37 @@ type TxtRecord struct { // VirtualNetworkLink - Describes a link to virtual network for a Private DNS zone. type VirtualNetworkLink struct { + // REQUIRED; The geo-location where the resource lives + Location *string + // The ETag of the virtual network link. Etag *string - // The Azure Region where the resource lives - Location *string - // Properties of the virtual network link to the Private DNS zone. Properties *VirtualNetworkLinkProperties // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource Id for the resource. Example - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateDnsZoneName}'. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource. Example - 'Microsoft.Network/privateDnsZones'. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// VirtualNetworkLinkListResult - The response to a list virtual network link to Private DNS zone operation. +// VirtualNetworkLinkListResult - The response of a VirtualNetworkLink list operation. type VirtualNetworkLinkListResult struct { - // Information about the virtual network links to the Private DNS zones. + // REQUIRED; The VirtualNetworkLink items on this page Value []*VirtualNetworkLink - // READ-ONLY; The continuation token for the next page of results. + // The link to the next page of items NextLink *string } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go b/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go index 1cd765831f22..63124214959d 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/models_serde.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -96,6 +93,107 @@ func (c *CnameRecord) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MxRecord. func (m MxRecord) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -135,6 +233,7 @@ func (p PrivateZone) MarshalJSON() ([]byte, error) { populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "tags", p.Tags) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) @@ -164,6 +263,9 @@ func (p *PrivateZone) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) @@ -269,6 +371,7 @@ func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -288,6 +391,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -333,6 +439,7 @@ func (r RecordSet) MarshalJSON() ([]byte, error) { populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -358,6 +465,9 @@ func (r *RecordSet) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -476,6 +586,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -495,6 +606,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -623,12 +737,60 @@ func (s *SubResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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 TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -652,6 +814,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -701,6 +866,7 @@ func (v VirtualNetworkLink) MarshalJSON() ([]byte, error) { populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) populate(objectMap, "tags", v.Tags) populate(objectMap, "type", v.Type) return json.Marshal(objectMap) @@ -730,6 +896,9 @@ func (v *VirtualNetworkLink) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &v.Tags) delete(rawMsg, key) @@ -828,6 +997,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil diff --git a/sdk/resourcemanager/privatedns/armprivatedns/options.go b/sdk/resourcemanager/privatedns/armprivatedns/options.go index 5a0f148ca7f2..fb15d2870fd5 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/options.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/options.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -19,7 +16,7 @@ type PrivateZonesClientBeginCreateOrUpdateOptions struct { // ignored. IfNoneMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -29,7 +26,7 @@ type PrivateZonesClientBeginDeleteOptions struct { // prevent accidentally deleting any concurrent changes. IfMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -39,7 +36,7 @@ type PrivateZonesClientBeginUpdateOptions struct { // to prevent accidentally overwriting any concurrent changes. IfMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -123,7 +120,7 @@ type VirtualNetworkLinksClientBeginCreateOrUpdateOptions struct { // link. Other values will be ignored. IfNoneMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -135,7 +132,7 @@ type VirtualNetworkLinksClientBeginDeleteOptions struct { // changes. IfMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -147,7 +144,7 @@ type VirtualNetworkLinksClientBeginUpdateOptions struct { // any concurrent changes. IfMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/privatedns_live_test.go b/sdk/resourcemanager/privatedns/armprivatedns/privatedns_live_test.go index db66ab75460d..c3d755f622c4 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/privatedns_live_test.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/privatedns_live_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go b/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go index 7fac51ae3e91..492eaf338708 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -29,8 +26,7 @@ type PrivateZonesClient struct { } // NewPrivateZonesClient creates a new instance of PrivateZonesClient with the specified values. -// - subscriptionID - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID -// forms part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateZonesClient, error) { @@ -50,7 +46,7 @@ func NewPrivateZonesClient(subscriptionID string, credential azcore.TokenCredent // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - parameters - Parameters supplied to the CreateOrUpdate operation. // - options - PrivateZonesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateZonesClient.BeginCreateOrUpdate @@ -62,7 +58,8 @@ func (client *PrivateZonesClient) BeginCreateOrUpdate(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateZonesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -101,6 +98,10 @@ func (client *PrivateZonesClient) createOrUpdate(ctx context.Context, resourceGr // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *PrivateZonesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -109,10 +110,6 @@ func (client *PrivateZonesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -122,10 +119,10 @@ func (client *PrivateZonesClient) createOrUpdateCreateRequest(ctx context.Contex req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } if options != nil && options.IfNoneMatch != nil { - req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + req.Raw().Header["if-none-match"] = []string{*options.IfNoneMatch} } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err @@ -139,7 +136,7 @@ func (client *PrivateZonesClient) createOrUpdateCreateRequest(ctx context.Contex // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - options - PrivateZonesClientBeginDeleteOptions contains the optional parameters for the PrivateZonesClient.BeginDelete // method. @@ -150,7 +147,8 @@ func (client *PrivateZonesClient) BeginDelete(ctx context.Context, resourceGroup return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateZonesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -190,6 +188,10 @@ func (client *PrivateZonesClient) deleteOperation(ctx context.Context, resourceG // deleteCreateRequest creates the Delete request. func (client *PrivateZonesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -198,10 +200,6 @@ func (client *PrivateZonesClient) deleteCreateRequest(ctx context.Context, resou return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -211,7 +209,7 @@ func (client *PrivateZonesClient) deleteCreateRequest(ctx context.Context, resou req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } return req, nil } @@ -221,7 +219,7 @@ func (client *PrivateZonesClient) deleteCreateRequest(ctx context.Context, resou // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - options - PrivateZonesClientGetOptions contains the optional parameters for the PrivateZonesClient.Get method. func (client *PrivateZonesClient) Get(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientGetOptions) (PrivateZonesClientGetResponse, error) { @@ -247,8 +245,12 @@ func (client *PrivateZonesClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *PrivateZonesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *PrivateZonesClientGetOptions) (*policy.Request, error) { +func (client *PrivateZonesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, _ *PrivateZonesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -257,10 +259,6 @@ func (client *PrivateZonesClient) getCreateRequest(ctx context.Context, resource return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -341,7 +339,7 @@ func (client *PrivateZonesClient) listHandleResponse(resp *http.Response) (Priva // NewListByResourceGroupPager - Lists the Private DNS zones within a resource group. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PrivateZonesClientListByResourceGroupOptions contains the optional parameters for the PrivateZonesClient.NewListByResourceGroupPager // method. func (client *PrivateZonesClient) NewListByResourceGroupPager(resourceGroupName string, options *PrivateZonesClientListByResourceGroupOptions) *runtime.Pager[PrivateZonesClientListByResourceGroupResponse] { @@ -370,14 +368,14 @@ func (client *PrivateZonesClient) NewListByResourceGroupPager(resourceGroupName // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *PrivateZonesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateZonesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -405,7 +403,7 @@ func (client *PrivateZonesClient) listByResourceGroupHandleResponse(resp *http.R // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - parameters - Parameters supplied to the Update operation. // - options - PrivateZonesClientBeginUpdateOptions contains the optional parameters for the PrivateZonesClient.BeginUpdate @@ -417,7 +415,8 @@ func (client *PrivateZonesClient) BeginUpdate(ctx context.Context, resourceGroup return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateZonesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -455,6 +454,10 @@ func (client *PrivateZonesClient) update(ctx context.Context, resourceGroupName // updateCreateRequest creates the Update request. func (client *PrivateZonesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, parameters PrivateZone, options *PrivateZonesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -463,10 +466,6 @@ func (client *PrivateZonesClient) updateCreateRequest(ctx context.Context, resou return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -476,7 +475,7 @@ func (client *PrivateZonesClient) updateCreateRequest(ctx context.Context, resou req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err diff --git a/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client_example_test.go b/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client_example_test.go deleted file mode 100644 index 43fc58407f36..000000000000 --- a/sdk/resourcemanager/privatedns/armprivatedns/privatezones_client_example_test.go +++ /dev/null @@ -1,302 +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. -// DO NOT EDIT. - -package armprivatedns_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/privatedns/armprivatedns" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/PrivateZonePut.json -func ExamplePrivateZonesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateZonesClient().BeginCreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.PrivateZone{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, &armprivatedns.PrivateZonesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateZone = armprivatedns.PrivateZone{ - // Name: to.Ptr("privatezone1.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/PrivateZonePatch.json -func ExamplePrivateZonesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateZonesClient().BeginUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.PrivateZone{ - Tags: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, &armprivatedns.PrivateZonesClientBeginUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateZone = armprivatedns.PrivateZone{ - // Name: to.Ptr("privatezone1.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/PrivateZoneDelete.json -func ExamplePrivateZonesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateZonesClient().BeginDelete(ctx, "resourceGroup1", "privatezone1.com", &armprivatedns.PrivateZonesClientBeginDeleteOptions{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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/PrivateZoneGet.json -func ExamplePrivateZonesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateZonesClient().Get(ctx, "resourceGroup1", "privatezone1.com", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateZone = armprivatedns.PrivateZone{ - // Name: to.Ptr("privatezone1.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/PrivateZoneListInSubscription.json -func ExamplePrivateZonesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateZonesClient().NewListPager(&armprivatedns.PrivateZonesClientListOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateZoneListResult = armprivatedns.PrivateZoneListResult{ - // Value: []*armprivatedns.PrivateZone{ - // { - // Name: to.Ptr("privatezone1.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("privatezone2.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup2/providers/Microsoft.Network/privateDnsZones/privatezone2.com"), - // Location: to.Ptr("global"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/PrivateZoneListInResourceGroup.json -func ExamplePrivateZonesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateZonesClient().NewListByResourceGroupPager("resourceGroup1", &armprivatedns.PrivateZonesClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateZoneListResult = armprivatedns.PrivateZoneListResult{ - // Value: []*armprivatedns.PrivateZone{ - // { - // Name: to.Ptr("privatezone1.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("privatezone2.com"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone2.com"), - // Location: to.Ptr("global"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.PrivateZoneProperties{ - // MaxNumberOfRecordSets: to.Ptr[int64](5000), - // MaxNumberOfVirtualNetworkLinks: to.Ptr[int64](100), - // MaxNumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](50), - // NumberOfRecordSets: to.Ptr[int64](1), - // NumberOfVirtualNetworkLinks: to.Ptr[int64](0), - // NumberOfVirtualNetworkLinksWithRegistration: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go b/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go index 786776c6184b..69676f29aa1b 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -29,8 +26,7 @@ type RecordSetsClient struct { } // NewRecordSetsClient creates a new instance of RecordSetsClient with the specified values. -// - subscriptionID - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID -// forms part of the URI for every service call. +// - subscriptionID - The ID of the target 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) { @@ -49,21 +45,21 @@ func NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredentia // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private 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 Private DNS zone is created). -// - relativeRecordSetName - The name of the record set, relative to the name of the zone. // - 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, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (RecordSetsClientCreateOrUpdateResponse, error) { +func (client *RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (RecordSetsClientCreateOrUpdateResponse, error) { var err error const operationName = "RecordSetsClient.CreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, parameters, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateZoneName, relativeRecordSetName, recordType, parameters, options) if err != nil { return RecordSetsClientCreateOrUpdateResponse{}, err } @@ -80,8 +76,12 @@ func (client *RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" +func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}/{recordType}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -90,15 +90,14 @@ func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if relativeRecordSetName == "" { + return nil, errors.New("parameter relativeRecordSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", url.PathEscape(relativeRecordSetName)) if recordType == "" { return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -108,10 +107,10 @@ func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } if options != nil && options.IfNoneMatch != nil { - req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + req.Raw().Header["if-none-match"] = []string{*options.IfNoneMatch} } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err @@ -132,19 +131,19 @@ func (client *RecordSetsClient) createOrUpdateHandleResponse(resp *http.Response // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private 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 Private DNS zone is deleted). -// - relativeRecordSetName - The name of the record set, relative to the name of the zone. // - options - RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method. -func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientDeleteOptions) (RecordSetsClientDeleteResponse, error) { +func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientDeleteOptions) (RecordSetsClientDeleteResponse, error) { var err error const operationName = "RecordSetsClient.Delete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, options) + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateZoneName, relativeRecordSetName, recordType, options) if err != nil { return RecordSetsClientDeleteResponse{}, err } @@ -160,8 +159,12 @@ func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName st } // deleteCreateRequest creates the Delete request. -func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" +func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}/{recordType}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -170,15 +173,14 @@ func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if relativeRecordSetName == "" { + return nil, errors.New("parameter relativeRecordSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", url.PathEscape(relativeRecordSetName)) if recordType == "" { return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -188,7 +190,7 @@ func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourc req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } return req, nil } @@ -197,18 +199,18 @@ func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourc // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). -// - recordType - The type of DNS record in this record set. // - 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, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientGetOptions) (RecordSetsClientGetResponse, error) { +func (client *RecordSetsClient) Get(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientGetOptions) (RecordSetsClientGetResponse, error) { var err error const operationName = "RecordSetsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, privateZoneName, relativeRecordSetName, recordType, options) if err != nil { return RecordSetsClientGetResponse{}, err } @@ -225,8 +227,12 @@ func (client *RecordSetsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, options *RecordSetsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" +func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, _ *RecordSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}/{recordType}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -235,15 +241,14 @@ func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGr return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if relativeRecordSetName == "" { + return nil, errors.New("parameter relativeRecordSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", url.PathEscape(relativeRecordSetName)) if recordType == "" { return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -267,7 +272,7 @@ func (client *RecordSetsClient) getHandleResponse(resp *http.Response) (RecordSe // NewListPager - Lists all record sets in a Private DNS zone. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - options - RecordSetsClientListOptions contains the optional parameters for the RecordSetsClient.NewListPager method. func (client *RecordSetsClient) NewListPager(resourceGroupName string, privateZoneName string, options *RecordSetsClientListOptions) *runtime.Pager[RecordSetsClientListResponse] { @@ -295,7 +300,11 @@ func (client *RecordSetsClient) NewListPager(resourceGroupName string, privateZo // listCreateRequest creates the List request. func (client *RecordSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *RecordSetsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/ALL" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/aLL" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -304,10 +313,6 @@ func (client *RecordSetsClient) listCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -337,7 +342,7 @@ func (client *RecordSetsClient) listHandleResponse(resp *http.Response) (RecordS // NewListByTypePager - Lists the record sets of a specified type in a Private DNS zone. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - recordType - The type of record sets to enumerate. // - options - RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager @@ -367,7 +372,11 @@ func (client *RecordSetsClient) NewListByTypePager(resourceGroupName string, pri // listByTypeCreateRequest creates the ListByType request. func (client *RecordSetsClient) listByTypeCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, options *RecordSetsClientListByTypeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{recordType}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -380,10 +389,6 @@ func (client *RecordSetsClient) listByTypeCreateRequest(ctx context.Context, res return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -414,19 +419,19 @@ func (client *RecordSetsClient) listByTypeHandleResponse(resp *http.Response) (R // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). -// - recordType - The type of DNS record in this record set. // - 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, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientUpdateOptions) (RecordSetsClientUpdateResponse, error) { +func (client *RecordSetsClient) Update(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientUpdateOptions) (RecordSetsClientUpdateResponse, error) { var err error const operationName = "RecordSetsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, privateZoneName, recordType, relativeRecordSetName, parameters, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, privateZoneName, relativeRecordSetName, recordType, parameters, options) if err != nil { return RecordSetsClientUpdateResponse{}, err } @@ -443,8 +448,12 @@ func (client *RecordSetsClient) Update(ctx context.Context, resourceGroupName st } // updateCreateRequest creates the Update request. -func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string, parameters RecordSet, options *RecordSetsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}" +func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/{recordType}/{relativeRecordSetName}/{recordType}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -453,15 +462,14 @@ func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) + if relativeRecordSetName == "" { + return nil, errors.New("parameter relativeRecordSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", url.PathEscape(relativeRecordSetName)) if recordType == "" { return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -471,7 +479,7 @@ func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourc req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err diff --git a/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client_example_test.go b/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client_example_test.go deleted file mode 100644 index 67f8d4ff7306..000000000000 --- a/sdk/resourcemanager/privatedns/armprivatedns/recordsets_client_example_test.go +++ /dev/null @@ -1,1766 +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. -// DO NOT EDIT. - -package armprivatedns_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/privatedns/armprivatedns" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneARecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeA, "recordA", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - ARecords: []*armprivatedns.ARecord{ - { - IPv4Address: to.Ptr("1.2.3.4"), - }}, - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recorda"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/A"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/A/recorda"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // ARecords: []*armprivatedns.ARecord{ - // { - // IPv4Address: to.Ptr("1.2.3.4"), - // }}, - // Fqdn: to.Ptr("recorda.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAAAAPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneAaaaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeAAAA, "recordAAAA", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - AaaaRecords: []*armprivatedns.AaaaRecord{ - { - IPv6Address: to.Ptr("::1"), - }}, - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordaaaa"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/AAAA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/AAAA/recordaaaa"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // AaaaRecords: []*armprivatedns.AaaaRecord{ - // { - // IPv6Address: to.Ptr("::1"), - // }}, - // Fqdn: to.Ptr("recordaaaa.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetCNAMEPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneCnameRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeCNAME, "recordCNAME", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - CnameRecord: &armprivatedns.CnameRecord{ - Cname: to.Ptr("contoso.com"), - }, - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordcname"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/CNAME"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/CNAME/recordcname"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // CnameRecord: &armprivatedns.CnameRecord{ - // Cname: to.Ptr("contoso.com"), - // }, - // Fqdn: to.Ptr("recordcname.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetMXPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneMxRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeMX, "recordMX", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - MxRecords: []*armprivatedns.MxRecord{ - { - Exchange: to.Ptr("mail.privatezone1.com"), - Preference: to.Ptr[int32](0), - }}, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordmx"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/MX"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/MX/recordmx"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordmx.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // MxRecords: []*armprivatedns.MxRecord{ - // { - // Exchange: to.Ptr("mail.privatezone1.com"), - // Preference: to.Ptr[int32](0), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetPTRPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZonePtrRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "0.0.127.in-addr.arpa", armprivatedns.RecordTypePTR, "1", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - PtrRecords: []*armprivatedns.PtrRecord{ - { - Ptrdname: to.Ptr("localhost"), - }}, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/PTR"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/0.0.127.in-addr.arpa/PTR/1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("1.0.0.127.in-addr.arpa."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // PtrRecords: []*armprivatedns.PtrRecord{ - // { - // Ptrdname: to.Ptr("localhost"), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSOAPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneSoaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSOA, "@", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - SoaRecord: &armprivatedns.SoaRecord{ - Email: to.Ptr("azureprivatedns-hostmaster.microsoft.com"), - ExpireTime: to.Ptr[int64](2419200), - Host: to.Ptr("azureprivatedns.net"), - MinimumTTL: to.Ptr[int64](300), - RefreshTime: to.Ptr[int64](3600), - RetryTime: to.Ptr[int64](300), - SerialNumber: to.Ptr[int64](1), - }, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("@"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SOA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SOA/@"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // SoaRecord: &armprivatedns.SoaRecord{ - // Email: to.Ptr("azureprivatedns-hostmaster.microsoft.com"), - // ExpireTime: to.Ptr[int64](2419200), - // Host: to.Ptr("azureprivatedns.net"), - // MinimumTTL: to.Ptr[int64](300), - // RefreshTime: to.Ptr[int64](3600), - // RetryTime: to.Ptr[int64](300), - // SerialNumber: to.Ptr[int64](1), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSRVPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneSrvRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSRV, "recordSRV", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - SrvRecords: []*armprivatedns.SrvRecord{ - { - Port: to.Ptr[int32](80), - Priority: to.Ptr[int32](0), - Target: to.Ptr("contoso.com"), - Weight: to.Ptr[int32](10), - }}, - TTL: to.Ptr[int64](3600), - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordsrv"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SRV"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SRV/recordsrv"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordsrv.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // SrvRecords: []*armprivatedns.SrvRecord{ - // { - // Port: to.Ptr[int32](80), - // Priority: to.Ptr[int32](0), - // Target: to.Ptr("contoso.com"), - // Weight: to.Ptr[int32](10), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetTXTPut.json -func ExampleRecordSetsClient_CreateOrUpdate_putPrivateDnsZoneTxtRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().CreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeTXT, "recordTXT", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key1": to.Ptr("value1"), - }, - TTL: to.Ptr[int64](3600), - TxtRecords: []*armprivatedns.TxtRecord{ - { - Value: []*string{ - to.Ptr("string1"), - to.Ptr("string2")}, - }}, - }, - }, &armprivatedns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordtxt"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/TXT"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/TXT/recordtxt"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordtxt.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // TxtRecords: []*armprivatedns.TxtRecord{ - // { - // Value: []*string{ - // to.Ptr("string1"), - // to.Ptr("string2")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneARecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeA, "recordA", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recorda"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/A"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/A/recorda"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // ARecords: []*armprivatedns.ARecord{ - // { - // IPv4Address: to.Ptr("1.2.3.4"), - // }}, - // Fqdn: to.Ptr("recorda.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAAAAPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneAaaaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeAAAA, "recordAAAA", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordaaaa"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/AAAA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/AAAA/recordaaaa"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // AaaaRecords: []*armprivatedns.AaaaRecord{ - // { - // IPv6Address: to.Ptr("::1"), - // }}, - // Fqdn: to.Ptr("recordaaaa.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetCNAMEPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneCnameRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeCNAME, "recordCNAME", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordcname"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/CNAME"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/CNAME/recordcname"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // CnameRecord: &armprivatedns.CnameRecord{ - // Cname: to.Ptr("contoso.com"), - // }, - // Fqdn: to.Ptr("recordcname.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetMXPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneMxRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeMX, "recordMX", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordmx"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/MX"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/MX/recordmx"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordmx.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // MxRecords: []*armprivatedns.MxRecord{ - // { - // Exchange: to.Ptr("mail.privatezone1.com"), - // Preference: to.Ptr[int32](0), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetPTRPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZonePtrRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "0.0.127.in-addr.arpa", armprivatedns.RecordTypePTR, "1", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/PTR"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/0.0.127.in-addr.arpa/PTR/1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("1.0.0.127.in-addr.arpa."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // PtrRecords: []*armprivatedns.PtrRecord{ - // { - // Ptrdname: to.Ptr("localhost"), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSOAPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneSoaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSOA, "@", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("@"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SOA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SOA/@"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // SoaRecord: &armprivatedns.SoaRecord{ - // Email: to.Ptr("azureprivatedns-hostmaster.microsoft.com"), - // ExpireTime: to.Ptr[int64](2419200), - // Host: to.Ptr("azureprivatedns.net"), - // MinimumTTL: to.Ptr[int64](300), - // RefreshTime: to.Ptr[int64](3600), - // RetryTime: to.Ptr[int64](300), - // SerialNumber: to.Ptr[int64](1), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSRVPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneSrvRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSRV, "recordSRV", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordsrv"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SRV"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SRV/recordsrv"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordsrv.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // SrvRecords: []*armprivatedns.SrvRecord{ - // { - // Port: to.Ptr[int32](80), - // Priority: to.Ptr[int32](0), - // Target: to.Ptr("contoso.com"), - // Weight: to.Ptr[int32](10), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetTXTPatch.json -func ExampleRecordSetsClient_Update_patchPrivateDnsZoneTxtRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Update(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeTXT, "recordTXT", armprivatedns.RecordSet{ - Properties: &armprivatedns.RecordSetProperties{ - Metadata: map[string]*string{ - "key2": to.Ptr("value2"), - }, - }, - }, &armprivatedns.RecordSetsClientUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordtxt"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/TXT"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/TXT/recordtxt"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordtxt.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // TTL: to.Ptr[int64](3600), - // TxtRecords: []*armprivatedns.TxtRecord{ - // { - // Value: []*string{ - // to.Ptr("string1"), - // to.Ptr("string2")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetADelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZoneARecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeA, "recordA", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAAAADelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZoneAaaaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeAAAA, "recordAAAA", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetCNAMEDelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZoneCnameRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeCNAME, "recordCNAME", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetMXDelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZoneMxRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeMX, "recordMX", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetPTRDelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZonePtrRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "0.0.127.in-addr.arpa", armprivatedns.RecordTypePTR, "1", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSRVDelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZoneSrvRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSRV, "recordSRV", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetTXTDelete.json -func ExampleRecordSetsClient_Delete_deletePrivateDnsZoneTxtRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecordSetsClient().Delete(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeTXT, "recordTXT", &armprivatedns.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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneARecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeA, "recordA", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recorda"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/A"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/A/recorda"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // ARecords: []*armprivatedns.ARecord{ - // { - // IPv4Address: to.Ptr("1.2.3.4"), - // }}, - // Fqdn: to.Ptr("recorda.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAAAAGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneAaaaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeAAAA, "recordAAAA", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordaaaa"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/AAAA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/AAAA/recordaaaa"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // AaaaRecords: []*armprivatedns.AaaaRecord{ - // { - // IPv6Address: to.Ptr("::1"), - // }}, - // Fqdn: to.Ptr("recordaaaa.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetCNAMEGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneCnameRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeCNAME, "recordCNAME", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordcname"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/CNAME"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/CNAME/recordcname"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // CnameRecord: &armprivatedns.CnameRecord{ - // Cname: to.Ptr("contoso.com"), - // }, - // Fqdn: to.Ptr("recordcname.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetMXGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneMxRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeMX, "recordMX", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordmx"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/MX"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/MX/recordmx"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordmx.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // MxRecords: []*armprivatedns.MxRecord{ - // { - // Exchange: to.Ptr("mail.privatezone1.com"), - // Preference: to.Ptr[int32](0), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetPTRGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZonePtrRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "0.0.127.in-addr.arpa", armprivatedns.RecordTypePTR, "1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/PTR"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/0.0.127.in-addr.arpa/PTR/1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("1.0.0.127.in-addr.arpa."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // PtrRecords: []*armprivatedns.PtrRecord{ - // { - // Ptrdname: to.Ptr("localhost"), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSOAGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneSoaRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSOA, "@", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("@"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SOA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SOA/@"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // SoaRecord: &armprivatedns.SoaRecord{ - // Email: to.Ptr("azureprivatedns-hostmaster.microsoft.com"), - // ExpireTime: to.Ptr[int64](2419200), - // Host: to.Ptr("azureprivatedns.net"), - // MinimumTTL: to.Ptr[int64](300), - // RefreshTime: to.Ptr[int64](3600), - // RetryTime: to.Ptr[int64](300), - // SerialNumber: to.Ptr[int64](1), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSRVGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneSrvRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSRV, "recordSRV", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordsrv"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SRV"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SRV/recordsrv"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordsrv.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // SrvRecords: []*armprivatedns.SrvRecord{ - // { - // Port: to.Ptr[int32](80), - // Priority: to.Ptr[int32](0), - // Target: to.Ptr("contoso.com"), - // Weight: to.Ptr[int32](10), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetTXTGet.json -func ExampleRecordSetsClient_Get_getPrivateDnsZoneTxtRecordSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecordSetsClient().Get(ctx, "resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeTXT, "recordTXT", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecordSet = armprivatedns.RecordSet{ - // Name: to.Ptr("recordtxt"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/TXT"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/TXT/recordtxt"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordtxt.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // TxtRecords: []*armprivatedns.TxtRecord{ - // { - // Value: []*string{ - // to.Ptr("string1"), - // to.Ptr("string2")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneARecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeA, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recorda1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/A"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/A/recorda1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // ARecords: []*armprivatedns.ARecord{ - // { - // IPv4Address: to.Ptr("1.2.3.4"), - // }}, - // Fqdn: to.Ptr("recorda1.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // }, - // { - // Name: to.Ptr("recorda2"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/A"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/A/recorda2"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // ARecords: []*armprivatedns.ARecord{ - // { - // IPv4Address: to.Ptr("5.6.7.8"), - // }}, - // Fqdn: to.Ptr("recorda2.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetAAAAList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneAaaaRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeAAAA, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recordaaaa1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/AAAA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/AAAA/recordaaaa1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // AaaaRecords: []*armprivatedns.AaaaRecord{ - // { - // IPv6Address: to.Ptr("::1"), - // }}, - // Fqdn: to.Ptr("recordaaaa1.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // }, - // { - // Name: to.Ptr("recordaaaa2"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/AAAA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/AAAA/recordaaaa2"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // AaaaRecords: []*armprivatedns.AaaaRecord{ - // { - // IPv6Address: to.Ptr("::1"), - // }}, - // Fqdn: to.Ptr("recordaaaa2.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetCNAMEList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneCnameRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeCNAME, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recordcname"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/CNAME"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/CNAME/recordcname"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // CnameRecord: &armprivatedns.CnameRecord{ - // Cname: to.Ptr("contoso.com"), - // }, - // Fqdn: to.Ptr("recordcname.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetMXList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneMxRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeMX, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recordmx1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/MX"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/MX/recordmx1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordmx1.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // MxRecords: []*armprivatedns.MxRecord{ - // { - // Exchange: to.Ptr("mail.contoso1.com"), - // Preference: to.Ptr[int32](0), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // }, - // { - // Name: to.Ptr("recordmx2"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/MX"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/MX/recordmx2"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordmx2.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // MxRecords: []*armprivatedns.MxRecord{ - // { - // Exchange: to.Ptr("mail.contoso2.com"), - // Preference: to.Ptr[int32](0), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetPTRList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZonePtrRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "0.0.127.in-addr.arpa", armprivatedns.RecordTypePTR, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/PTR"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/0.0.127.in-addr.arpa/PTR/1"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("1.0.0.127.in-addr.arpa."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // PtrRecords: []*armprivatedns.PtrRecord{ - // { - // Ptrdname: to.Ptr("localhost"), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSOAList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneSoaRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSOA, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("@"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SOA"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SOA/@"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // SoaRecord: &armprivatedns.SoaRecord{ - // Email: to.Ptr("azureprivatedns-hostmaster.microsoft.com"), - // ExpireTime: to.Ptr[int64](2419200), - // Host: to.Ptr("azureprivatedns.net"), - // MinimumTTL: to.Ptr[int64](300), - // RefreshTime: to.Ptr[int64](3600), - // RetryTime: to.Ptr[int64](300), - // SerialNumber: to.Ptr[int64](1), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetSRVList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneSrvRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeSRV, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recordsrv"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/SRV"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/SRV/recordsrv"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordsrv.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // SrvRecords: []*armprivatedns.SrvRecord{ - // { - // Port: to.Ptr[int32](80), - // Priority: to.Ptr[int32](0), - // Target: to.Ptr("contoso.com"), - // Weight: to.Ptr[int32](10), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetTXTList.json -func ExampleRecordSetsClient_NewListByTypePager_getPrivateDnsZoneTxtRecordSets() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListByTypePager("resourceGroup1", "privatezone1.com", armprivatedns.RecordTypeTXT, &armprivatedns.RecordSetsClientListByTypeOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recordtxt"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/TXT"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/TXT/recordtxt"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordtxt.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // TxtRecords: []*armprivatedns.TxtRecord{ - // { - // Value: []*string{ - // to.Ptr("string1"), - // to.Ptr("string2")}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/RecordSetALLList.json -func ExampleRecordSetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecordSetsClient().NewListPager("resourceGroup1", "privatezone1.com", &armprivatedns.RecordSetsClientListOptions{Top: nil, - Recordsetnamesuffix: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecordSetListResult = armprivatedns.RecordSetListResult{ - // Value: []*armprivatedns.RecordSet{ - // { - // Name: to.Ptr("recorda"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/A"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/A/recorda"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // ARecords: []*armprivatedns.ARecord{ - // { - // IPv4Address: to.Ptr("1.2.3.4"), - // }}, - // Fqdn: to.Ptr("recorda.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // }, - // { - // Name: to.Ptr("recordcname"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/CNAME"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/CNAME/recordcname"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // CnameRecord: &armprivatedns.CnameRecord{ - // Cname: to.Ptr("contoso.com"), - // }, - // Fqdn: to.Ptr("recordcname.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // TTL: to.Ptr[int64](3600), - // }, - // }, - // { - // Name: to.Ptr("recordmx"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/MX"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/MX/recordmx"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.RecordSetProperties{ - // Fqdn: to.Ptr("recordmx.privatezone1.com."), - // IsAutoRegistered: to.Ptr(false), - // Metadata: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // MxRecords: []*armprivatedns.MxRecord{ - // { - // Exchange: to.Ptr("mail.contoso1.com"), - // Preference: to.Ptr[int32](0), - // }}, - // TTL: to.Ptr[int64](3600), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/privatedns/armprivatedns/responses.go b/sdk/resourcemanager/privatedns/armprivatedns/responses.go index 8b5cff426aad..e36e1963df31 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/responses.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/responses.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -27,13 +24,13 @@ type PrivateZonesClientGetResponse struct { // PrivateZonesClientListByResourceGroupResponse contains the response from method PrivateZonesClient.NewListByResourceGroupPager. type PrivateZonesClientListByResourceGroupResponse struct { - // The response to a Private DNS zone list operation. + // The response of a PrivateZone list operation. PrivateZoneListResult } // PrivateZonesClientListResponse contains the response from method PrivateZonesClient.NewListPager. type PrivateZonesClientListResponse struct { - // The response to a Private DNS zone list operation. + // The response of a PrivateZone list operation. PrivateZoneListResult } @@ -62,13 +59,13 @@ type RecordSetsClientGetResponse struct { // RecordSetsClientListByTypeResponse contains the response from method RecordSetsClient.NewListByTypePager. type RecordSetsClientListByTypeResponse struct { - // The response to a record set list operation. + // The response of a RecordSet list operation. RecordSetListResult } // RecordSetsClientListResponse contains the response from method RecordSetsClient.NewListPager. type RecordSetsClientListResponse struct { - // The response to a record set list operation. + // The response of a RecordSet list operation. RecordSetListResult } @@ -97,7 +94,7 @@ type VirtualNetworkLinksClientGetResponse struct { // VirtualNetworkLinksClientListResponse contains the response from method VirtualNetworkLinksClient.NewListPager. type VirtualNetworkLinksClientListResponse struct { - // The response to a list virtual network link to Private DNS zone operation. + // The response of a VirtualNetworkLink list operation. VirtualNetworkLinkListResult } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/time_rfc3339.go b/sdk/resourcemanager/privatedns/armprivatedns/time_rfc3339.go new file mode 100644 index 000000000000..ee3efb8a4dac --- /dev/null +++ b/sdk/resourcemanager/privatedns/armprivatedns/time_rfc3339.go @@ -0,0 +1,110 @@ +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armprivatedns + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go b/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go index 7f45d18c30a9..adb53eb03a32 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client.go @@ -1,6 +1,3 @@ -//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. DO NOT EDIT. @@ -29,8 +26,7 @@ type VirtualNetworkLinksClient struct { } // NewVirtualNetworkLinksClient creates a new instance of VirtualNetworkLinksClient with the specified values. -// - subscriptionID - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID -// forms part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVirtualNetworkLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkLinksClient, error) { @@ -49,7 +45,7 @@ func NewVirtualNetworkLinksClient(subscriptionID string, credential azcore.Token // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - virtualNetworkLinkName - The name of the virtual network link. // - parameters - Parameters supplied to the CreateOrUpdate operation. @@ -62,7 +58,8 @@ func (client *VirtualNetworkLinksClient) BeginCreateOrUpdate(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkLinksClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -100,6 +97,10 @@ func (client *VirtualNetworkLinksClient) createOrUpdate(ctx context.Context, res // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *VirtualNetworkLinksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -112,10 +113,6 @@ func (client *VirtualNetworkLinksClient) createOrUpdateCreateRequest(ctx context return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -125,10 +122,10 @@ func (client *VirtualNetworkLinksClient) createOrUpdateCreateRequest(ctx context req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } if options != nil && options.IfNoneMatch != nil { - req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + req.Raw().Header["if-none-match"] = []string{*options.IfNoneMatch} } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err @@ -142,7 +139,7 @@ func (client *VirtualNetworkLinksClient) createOrUpdateCreateRequest(ctx context // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - virtualNetworkLinkName - The name of the virtual network link. // - options - VirtualNetworkLinksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkLinksClient.BeginDelete @@ -154,7 +151,8 @@ func (client *VirtualNetworkLinksClient) BeginDelete(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkLinksClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -194,6 +192,10 @@ func (client *VirtualNetworkLinksClient) deleteOperation(ctx context.Context, re // deleteCreateRequest creates the Delete request. func (client *VirtualNetworkLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -206,10 +208,6 @@ func (client *VirtualNetworkLinksClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -219,7 +217,7 @@ func (client *VirtualNetworkLinksClient) deleteCreateRequest(ctx context.Context req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } return req, nil } @@ -228,7 +226,7 @@ func (client *VirtualNetworkLinksClient) deleteCreateRequest(ctx context.Context // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - virtualNetworkLinkName - The name of the virtual network link. // - options - VirtualNetworkLinksClientGetOptions contains the optional parameters for the VirtualNetworkLinksClient.Get method. @@ -255,8 +253,12 @@ func (client *VirtualNetworkLinksClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *VirtualNetworkLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, options *VirtualNetworkLinksClientGetOptions) (*policy.Request, error) { +func (client *VirtualNetworkLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, _ *VirtualNetworkLinksClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -269,10 +271,6 @@ func (client *VirtualNetworkLinksClient) getCreateRequest(ctx context.Context, r return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -296,7 +294,7 @@ func (client *VirtualNetworkLinksClient) getHandleResponse(resp *http.Response) // NewListPager - Lists the virtual network links to the specified Private DNS zone. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - options - VirtualNetworkLinksClientListOptions contains the optional parameters for the VirtualNetworkLinksClient.NewListPager // method. @@ -326,6 +324,10 @@ func (client *VirtualNetworkLinksClient) NewListPager(resourceGroupName string, // listCreateRequest creates the List request. func (client *VirtualNetworkLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, options *VirtualNetworkLinksClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -334,10 +336,6 @@ func (client *VirtualNetworkLinksClient) listCreateRequest(ctx context.Context, return nil, errors.New("parameter privateZoneName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateZoneName}", url.PathEscape(privateZoneName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -365,7 +363,7 @@ func (client *VirtualNetworkLinksClient) listHandleResponse(resp *http.Response) // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-06-01 -// - resourceGroupName - The name of the resource group. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - privateZoneName - The name of the Private DNS zone (without a terminating dot). // - virtualNetworkLinkName - The name of the virtual network link. // - parameters - Parameters supplied to the Update operation. @@ -378,7 +376,8 @@ func (client *VirtualNetworkLinksClient) BeginUpdate(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkLinksClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -416,6 +415,10 @@ func (client *VirtualNetworkLinksClient) update(ctx context.Context, resourceGro // updateCreateRequest creates the Update request. func (client *VirtualNetworkLinksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string, parameters VirtualNetworkLink, options *VirtualNetworkLinksClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -428,10 +431,6 @@ func (client *VirtualNetworkLinksClient) updateCreateRequest(ctx context.Context return nil, errors.New("parameter virtualNetworkLinkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkLinkName}", url.PathEscape(virtualNetworkLinkName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -441,7 +440,7 @@ func (client *VirtualNetworkLinksClient) updateCreateRequest(ctx context.Context req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { - req.Raw().Header["If-Match"] = []string{*options.IfMatch} + req.Raw().Header["if-match"] = []string{*options.IfMatch} } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err diff --git a/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client_example_test.go b/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client_example_test.go deleted file mode 100644 index cf25272b0ccc..000000000000 --- a/sdk/resourcemanager/privatedns/armprivatedns/virtualnetworklinks_client_example_test.go +++ /dev/null @@ -1,247 +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. -// DO NOT EDIT. - -package armprivatedns_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/privatedns/armprivatedns" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/VirtualNetworkLinkPut.json -func ExampleVirtualNetworkLinksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkLinksClient().BeginCreateOrUpdate(ctx, "resourceGroup1", "privatezone1.com", "virtualNetworkLink1", armprivatedns.VirtualNetworkLink{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armprivatedns.VirtualNetworkLinkProperties{ - RegistrationEnabled: to.Ptr(false), - VirtualNetwork: &armprivatedns.SubResource{ - ID: to.Ptr("/subscriptions/virtualNetworkSubscriptionId/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/virtualNetworkName"), - }, - }, - }, &armprivatedns.VirtualNetworkLinksClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkLink = armprivatedns.VirtualNetworkLink{ - // Name: to.Ptr("virtualNetworkLink1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/virtualNetworkLinks"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/virtualNetworkLinks/virtualNetworkLink1"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.VirtualNetworkLinkProperties{ - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // RegistrationEnabled: to.Ptr(false), - // VirtualNetwork: &armprivatedns.SubResource{ - // ID: to.Ptr("/subscriptions/virtualNetworkSubscriptionId/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/virtualNetworkName"), - // }, - // VirtualNetworkLinkState: to.Ptr(armprivatedns.VirtualNetworkLinkStateCompleted), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/VirtualNetworkLinkPatch.json -func ExampleVirtualNetworkLinksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkLinksClient().BeginUpdate(ctx, "resourceGroup1", "privatelink.contoso.com", "virtualNetworkLink1", armprivatedns.VirtualNetworkLink{ - Tags: map[string]*string{ - "key2": to.Ptr("value2"), - }, - Properties: &armprivatedns.VirtualNetworkLinkProperties{ - RegistrationEnabled: to.Ptr(true), - ResolutionPolicy: to.Ptr(armprivatedns.ResolutionPolicyNxDomainRedirect), - }, - }, &armprivatedns.VirtualNetworkLinksClientBeginUpdateOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkLink = armprivatedns.VirtualNetworkLink{ - // Name: to.Ptr("virtualNetworkLink1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/virtualNetworkLinks"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatelink.contoso.com/virtualNetworkLinks/virtualNetworkLink1"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key2": to.Ptr("value2"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.VirtualNetworkLinkProperties{ - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // RegistrationEnabled: to.Ptr(true), - // ResolutionPolicy: to.Ptr(armprivatedns.ResolutionPolicyNxDomainRedirect), - // VirtualNetwork: &armprivatedns.SubResource{ - // ID: to.Ptr("/subscriptions/virtualNetworkSubscriptionId/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/virtualNetworkName"), - // }, - // VirtualNetworkLinkState: to.Ptr(armprivatedns.VirtualNetworkLinkStateCompleted), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/VirtualNetworkLinkDelete.json -func ExampleVirtualNetworkLinksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkLinksClient().BeginDelete(ctx, "resourceGroup1", "privatezone1.com", "virtualNetworkLink1", &armprivatedns.VirtualNetworkLinksClientBeginDeleteOptions{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/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/VirtualNetworkLinkGet.json -func ExampleVirtualNetworkLinksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkLinksClient().Get(ctx, "resourceGroup1", "privatezone1.com", "virtualNetworkLink1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkLink = armprivatedns.VirtualNetworkLink{ - // Name: to.Ptr("virtualNetworkLink1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/virtualNetworkLinks"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatezone1.com/virtualNetworkLinks/virtualNetworkLink1"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.VirtualNetworkLinkProperties{ - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // RegistrationEnabled: to.Ptr(false), - // VirtualNetwork: &armprivatedns.SubResource{ - // ID: to.Ptr("/subscriptions/virtualNetworkSubscriptionId/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/virtualNetworkName"), - // }, - // VirtualNetworkLinkState: to.Ptr(armprivatedns.VirtualNetworkLinkStateCompleted), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4991356eec55985c1af47096c9c2091126a7d0f/specification/privatedns/resource-manager/Microsoft.Network/stable/2024-06-01/examples/VirtualNetworkLinkList.json -func ExampleVirtualNetworkLinksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armprivatedns.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkLinksClient().NewListPager("resourceGroup1", "privatelink.contoso.com", &armprivatedns.VirtualNetworkLinksClientListOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkLinkListResult = armprivatedns.VirtualNetworkLinkListResult{ - // Value: []*armprivatedns.VirtualNetworkLink{ - // { - // Name: to.Ptr("virtualNetworkLink1"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/virtualNetworkLinks"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatelink.contoso.com/virtualNetworkLinks/virtualNetworkLink1"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.VirtualNetworkLinkProperties{ - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // RegistrationEnabled: to.Ptr(false), - // ResolutionPolicy: to.Ptr(armprivatedns.ResolutionPolicyNxDomainRedirect), - // VirtualNetwork: &armprivatedns.SubResource{ - // ID: to.Ptr("/subscriptions/virtualNetworkSubscriptionId/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/virtualNetworkName"), - // }, - // VirtualNetworkLinkState: to.Ptr(armprivatedns.VirtualNetworkLinkStateCompleted), - // }, - // }, - // { - // Name: to.Ptr("virtualNetworkLink2"), - // Type: to.Ptr("Microsoft.Network/privateDnsZones/virtualNetworkLinks"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.Network/privateDnsZones/privatelink.contoso.com/virtualNetworkLinks/virtualNetworkLink2"), - // Location: to.Ptr("global"), - // Etag: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Properties: &armprivatedns.VirtualNetworkLinkProperties{ - // ProvisioningState: to.Ptr(armprivatedns.ProvisioningStateSucceeded), - // RegistrationEnabled: to.Ptr(true), - // ResolutionPolicy: to.Ptr(armprivatedns.ResolutionPolicyDefault), - // VirtualNetwork: &armprivatedns.SubResource{ - // ID: to.Ptr("/subscriptions/virtualNetworkSubscriptionId/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/virtualNetworkName"), - // }, - // VirtualNetworkLinkState: to.Ptr(armprivatedns.VirtualNetworkLinkStateInProgress), - // }, - // }}, - // } - } -}