[Release] sdk/resourcemanager/dns/armdns/1.3.0-beta.1 (#23539)

* [Release] sdk/resourcemanager/dns/armdns/1.3.0-beta.1 generation from spec commit: 987a8f38ab2a8359d085e149be042267a9ecc66f

* update recording

---------

Co-authored-by: ReleaseHelper <ReleaseHelper>
Co-authored-by: tadelesh <tadelesh.shi@live.cn>
This commit is contained in:
Azure SDK Bot 2024-10-22 22:36:36 -07:00 коммит произвёл GitHub
Родитель 24d040f500
Коммит ddd6b6de22
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
22 изменённых файлов: 2629 добавлений и 141 удалений

Просмотреть файл

@ -1,5 +1,31 @@
# Release History
## 1.3.0-beta.1 (2024-10-25)
### Features Added
- New value `RecordTypeDS`, `RecordTypeNAPTR`, `RecordTypeTLSA` added to enum type `RecordType`
- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser`
- New function `*ClientFactory.NewDnssecConfigsClient() *DnssecConfigsClient`
- New function `NewDnssecConfigsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DnssecConfigsClient, error)`
- New function `*DnssecConfigsClient.BeginCreateOrUpdate(context.Context, string, string, *DnssecConfigsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DnssecConfigsClientCreateOrUpdateResponse], error)`
- New function `*DnssecConfigsClient.BeginDelete(context.Context, string, string, *DnssecConfigsClientBeginDeleteOptions) (*runtime.Poller[DnssecConfigsClientDeleteResponse], error)`
- New function `*DnssecConfigsClient.Get(context.Context, string, string, *DnssecConfigsClientGetOptions) (DnssecConfigsClientGetResponse, error)`
- New function `*DnssecConfigsClient.NewListByDNSZonePager(string, string, *DnssecConfigsClientListByDNSZoneOptions) *runtime.Pager[DnssecConfigsClientListByDNSZoneResponse]`
- New struct `DelegationSignerInfo`
- New struct `Digest`
- New struct `DnssecConfig`
- New struct `DnssecConfigListResult`
- New struct `DnssecProperties`
- New struct `DsRecord`
- New struct `NaptrRecord`
- New struct `SigningKey`
- New struct `SystemData`
- New struct `TlsaRecord`
- New field `DsRecords`, `NaptrRecords`, `TlsaRecords`, `TrafficManagementProfile` in struct `RecordSetProperties`
- New field `SystemData` in struct `Zone`
- New field `SigningKeys` in struct `ZoneProperties`
## 1.2.0 (2023-11-24)
### Features Added

Просмотреть файл

@ -57,7 +57,7 @@ clientFactory, err := armdns.NewClientFactory(<subscription ID>, cred, &options)
A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.
```go
client := clientFactory.NewRecordSetsClient()
client := clientFactory.NewDnssecConfigsClient()
```
## Fakes

Просмотреть файл

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "go",
"TagPrefix": "go/resourcemanager/dns/armdns",
"Tag": "go/resourcemanager/dns/armdns_b3feaf35b5"
"Tag": "go/resourcemanager/dns/armdns_5a664bd542"
}

Просмотреть файл

@ -5,9 +5,9 @@
``` yaml
azure-arm: true
require:
- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/readme.go.md
- https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 1.2.0
module-version: 1.3.0-beta.1
tag: package-2023-07-preview
```

Просмотреть файл

@ -17,40 +17,53 @@ import (
// Don't use this type directly, use NewClientFactory instead.
type ClientFactory struct {
subscriptionID string
credential azcore.TokenCredential
options *arm.ClientOptions
internal *arm.Client
}
// 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 - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
// - 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) {
_, err := arm.NewClient(moduleName, moduleVersion, credential, options)
internal, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
return &ClientFactory{
subscriptionID: subscriptionID, credential: credential,
options: options.Clone(),
subscriptionID: subscriptionID,
internal: internal,
}, nil
}
// NewDnssecConfigsClient creates a new instance of DnssecConfigsClient.
func (c *ClientFactory) NewDnssecConfigsClient() *DnssecConfigsClient {
return &DnssecConfigsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewRecordSetsClient creates a new instance of RecordSetsClient.
func (c *ClientFactory) NewRecordSetsClient() *RecordSetsClient {
subClient, _ := NewRecordSetsClient(c.subscriptionID, c.credential, c.options)
return subClient
return &RecordSetsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewResourceReferenceClient creates a new instance of ResourceReferenceClient.
func (c *ClientFactory) NewResourceReferenceClient() *ResourceReferenceClient {
subClient, _ := NewResourceReferenceClient(c.subscriptionID, c.credential, c.options)
return subClient
return &ResourceReferenceClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewZonesClient creates a new instance of ZonesClient.
func (c *ClientFactory) NewZonesClient() *ZonesClient {
subClient, _ := NewZonesClient(c.subscriptionID, c.credential, c.options)
return subClient
return &ZonesClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}

Просмотреть файл

@ -10,9 +10,29 @@ package armdns
const (
moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
moduleVersion = "v1.2.0"
moduleVersion = "v1.3.0-beta.1"
)
// 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,
}
}
type RecordType string
const (
@ -20,11 +40,14 @@ const (
RecordTypeAAAA RecordType = "AAAA"
RecordTypeCAA RecordType = "CAA"
RecordTypeCNAME RecordType = "CNAME"
RecordTypeDS RecordType = "DS"
RecordTypeMX RecordType = "MX"
RecordTypeNAPTR RecordType = "NAPTR"
RecordTypeNS RecordType = "NS"
RecordTypePTR RecordType = "PTR"
RecordTypeSOA RecordType = "SOA"
RecordTypeSRV RecordType = "SRV"
RecordTypeTLSA RecordType = "TLSA"
RecordTypeTXT RecordType = "TXT"
)
@ -35,11 +58,14 @@ func PossibleRecordTypeValues() []RecordType {
RecordTypeAAAA,
RecordTypeCAA,
RecordTypeCNAME,
RecordTypeDS,
RecordTypeMX,
RecordTypeNAPTR,
RecordTypeNS,
RecordTypePTR,
RecordTypeSOA,
RecordTypeSRV,
RecordTypeTLSA,
RecordTypeTXT,
}
}

Просмотреть файл

@ -0,0 +1,334 @@
//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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armdns
import (
"context"
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// DnssecConfigsClient contains the methods for the DnssecConfigs group.
// Don't use this type directly, use NewDnssecConfigsClient() instead.
type DnssecConfigsClient struct {
internal *arm.Client
subscriptionID string
}
// NewDnssecConfigsClient creates a new instance of DnssecConfigsClient with the specified values.
// - 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 NewDnssecConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DnssecConfigsClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &DnssecConfigsClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// BeginCreateOrUpdate - Creates or updates the DNSSEC configuration on a DNS zone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - DnssecConfigsClientBeginCreateOrUpdateOptions contains the optional parameters for the DnssecConfigsClient.BeginCreateOrUpdate
// method.
func (client *DnssecConfigsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DnssecConfigsClientCreateOrUpdateResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.createOrUpdate(ctx, resourceGroupName, zoneName, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DnssecConfigsClientCreateOrUpdateResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DnssecConfigsClientCreateOrUpdateResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// CreateOrUpdate - Creates or updates the DNSSEC configuration on a DNS zone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-07-01-preview
func (client *DnssecConfigsClient) createOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientBeginCreateOrUpdateOptions) (*http.Response, error) {
var err error
const operationName = "DnssecConfigsClient.BeginCreateOrUpdate"
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, zoneName, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
func (client *DnssecConfigsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if zoneName == "" {
return nil, errors.New("parameter zoneName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{zoneName}", url.PathEscape(zoneName))
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
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-07-01-preview")
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}
}
if options != nil && options.IfNoneMatch != nil {
req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch}
}
return req, nil
}
// BeginDelete - Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - DnssecConfigsClientBeginDeleteOptions contains the optional parameters for the DnssecConfigsClient.BeginDelete
// method.
func (client *DnssecConfigsClient) BeginDelete(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientBeginDeleteOptions) (*runtime.Poller[DnssecConfigsClientDeleteResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.deleteOperation(ctx, resourceGroupName, zoneName, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DnssecConfigsClientDeleteResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DnssecConfigsClientDeleteResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// Delete - Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-07-01-preview
func (client *DnssecConfigsClient) deleteOperation(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientBeginDeleteOptions) (*http.Response, error) {
var err error
const operationName = "DnssecConfigsClient.BeginDelete"
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, zoneName, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// deleteCreateRequest creates the Delete request.
func (client *DnssecConfigsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientBeginDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if zoneName == "" {
return nil, errors.New("parameter zoneName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{zoneName}", url.PathEscape(zoneName))
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
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-07-01-preview")
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}
}
return req, nil
}
// Get - Gets the DNSSEC configuration.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - DnssecConfigsClientGetOptions contains the optional parameters for the DnssecConfigsClient.Get method.
func (client *DnssecConfigsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientGetOptions) (DnssecConfigsClientGetResponse, error) {
var err error
const operationName = "DnssecConfigsClient.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, zoneName, options)
if err != nil {
return DnssecConfigsClientGetResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return DnssecConfigsClientGetResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return DnssecConfigsClientGetResponse{}, err
}
resp, err := client.getHandleResponse(httpResp)
return resp, err
}
// getCreateRequest creates the Get request.
func (client *DnssecConfigsClient) getCreateRequest(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if zoneName == "" {
return nil, errors.New("parameter zoneName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{zoneName}", url.PathEscape(zoneName))
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
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getHandleResponse handles the Get response.
func (client *DnssecConfigsClient) getHandleResponse(resp *http.Response) (DnssecConfigsClientGetResponse, error) {
result := DnssecConfigsClientGetResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.DnssecConfig); err != nil {
return DnssecConfigsClientGetResponse{}, err
}
return result, nil
}
// NewListByDNSZonePager - Lists the DNSSEC configurations in a DNS zone.
//
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - DnssecConfigsClientListByDNSZoneOptions contains the optional parameters for the DnssecConfigsClient.NewListByDNSZonePager
// method.
func (client *DnssecConfigsClient) NewListByDNSZonePager(resourceGroupName string, zoneName string, options *DnssecConfigsClientListByDNSZoneOptions) *runtime.Pager[DnssecConfigsClientListByDNSZoneResponse] {
return runtime.NewPager(runtime.PagingHandler[DnssecConfigsClientListByDNSZoneResponse]{
More: func(page DnssecConfigsClientListByDNSZoneResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *DnssecConfigsClientListByDNSZoneResponse) (DnssecConfigsClientListByDNSZoneResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DnssecConfigsClient.NewListByDNSZonePager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listByDNSZoneCreateRequest(ctx, resourceGroupName, zoneName, options)
}, nil)
if err != nil {
return DnssecConfigsClientListByDNSZoneResponse{}, err
}
return client.listByDNSZoneHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listByDNSZoneCreateRequest creates the ListByDNSZone request.
func (client *DnssecConfigsClient) listByDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, zoneName string, options *DnssecConfigsClientListByDNSZoneOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs"
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if zoneName == "" {
return nil, errors.New("parameter zoneName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{zoneName}", url.PathEscape(zoneName))
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
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listByDNSZoneHandleResponse handles the ListByDNSZone response.
func (client *DnssecConfigsClient) listByDNSZoneHandleResponse(resp *http.Response) (DnssecConfigsClientListByDNSZoneResponse, error) {
result := DnssecConfigsClientListByDNSZoneResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.DnssecConfigListResult); err != nil {
return DnssecConfigsClientListByDNSZoneResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,188 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// DO NOT EDIT.
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/CreateOrUpdateDnssecConfig.json
func ExampleDnssecConfigsClient_BeginCreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDnssecConfigsClient().BeginCreateOrUpdate(ctx, "rg1", "zone1", &armdns.DnssecConfigsClientBeginCreateOrUpdateOptions{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.DnssecConfig = armdns.DnssecConfig{
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Network/dnszones/dnssecConfigs"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnszones/zone1/dnssecConfigs/default"),
// Properties: &armdns.DnssecProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// SigningKeys: []*armdns.SigningKey{
// },
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DeleteDnssecConfig.json
func ExampleDnssecConfigsClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDnssecConfigsClient().BeginDelete(ctx, "rg1", "zone1", &armdns.DnssecConfigsClientBeginDeleteOptions{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/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/GetDnssecConfig.json
func ExampleDnssecConfigsClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDnssecConfigsClient().Get(ctx, "rg1", "zone1", 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.DnssecConfig = armdns.DnssecConfig{
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Network/dnszones/dnssecConfigs"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnszones/zone1/dnssecConfigs/default"),
// Properties: &armdns.DnssecProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// SigningKeys: []*armdns.SigningKey{
// {
// DelegationSignerInfo: []*armdns.DelegationSignerInfo{
// },
// Flags: to.Ptr[int32](256),
// KeyTag: to.Ptr[int32](37721),
// PublicKey: to.Ptr("publicKey1"),
// SecurityAlgorithmType: to.Ptr[int32](13),
// Protocol: to.Ptr[int32](3),
// },
// {
// DelegationSignerInfo: []*armdns.DelegationSignerInfo{
// {
// DigestAlgorithmType: to.Ptr[int32](2),
// DigestValue: to.Ptr("digestValue1"),
// Record: to.Ptr("11920 13 2 digestValue1"),
// }},
// Flags: to.Ptr[int32](257),
// KeyTag: to.Ptr[int32](11920),
// PublicKey: to.Ptr("publicKey2"),
// SecurityAlgorithmType: to.Ptr[int32](13),
// Protocol: to.Ptr[int32](3),
// }},
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ListDnssecConfigsByZone.json
func ExampleDnssecConfigsClient_NewListByDNSZonePager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDnssecConfigsClient().NewListByDNSZonePager("rg1", "zone1", 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.DnssecConfigListResult = armdns.DnssecConfigListResult{
// Value: []*armdns.DnssecConfig{
// {
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Network/dnszones/dnssecConfigs"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnszones/zone1/dnssecConfigs/default"),
// Properties: &armdns.DnssecProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// SigningKeys: []*armdns.SigningKey{
// {
// DelegationSignerInfo: []*armdns.DelegationSignerInfo{
// },
// Flags: to.Ptr[int32](256),
// KeyTag: to.Ptr[int32](37721),
// PublicKey: to.Ptr("publicKey1"),
// SecurityAlgorithmType: to.Ptr[int32](13),
// Protocol: to.Ptr[int32](3),
// },
// {
// DelegationSignerInfo: []*armdns.DelegationSignerInfo{
// {
// DigestAlgorithmType: to.Ptr[int32](2),
// DigestValue: to.Ptr("digestValue1"),
// Record: to.Ptr("11920 13 2 digestValue1"),
// }},
// Flags: to.Ptr[int32](257),
// KeyTag: to.Ptr[int32](11920),
// PublicKey: to.Ptr("publicKey2"),
// SecurityAlgorithmType: to.Ptr[int32](13),
// Protocol: to.Ptr[int32](3),
// }},
// },
// }},
// }
}
}

Просмотреть файл

@ -0,0 +1,272 @@
//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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package fake
import (
"context"
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"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/dns/armdns"
"net/http"
"net/url"
"regexp"
)
// DnssecConfigsServer is a fake server for instances of the armdns.DnssecConfigsClient type.
type DnssecConfigsServer struct {
// BeginCreateOrUpdate is the fake for method DnssecConfigsClient.BeginCreateOrUpdate
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, zoneName string, options *armdns.DnssecConfigsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdns.DnssecConfigsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
// BeginDelete is the fake for method DnssecConfigsClient.BeginDelete
// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent
BeginDelete func(ctx context.Context, resourceGroupName string, zoneName string, options *armdns.DnssecConfigsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdns.DnssecConfigsClientDeleteResponse], errResp azfake.ErrorResponder)
// Get is the fake for method DnssecConfigsClient.Get
// HTTP status codes to indicate success: http.StatusOK
Get func(ctx context.Context, resourceGroupName string, zoneName string, options *armdns.DnssecConfigsClientGetOptions) (resp azfake.Responder[armdns.DnssecConfigsClientGetResponse], errResp azfake.ErrorResponder)
// NewListByDNSZonePager is the fake for method DnssecConfigsClient.NewListByDNSZonePager
// HTTP status codes to indicate success: http.StatusOK
NewListByDNSZonePager func(resourceGroupName string, zoneName string, options *armdns.DnssecConfigsClientListByDNSZoneOptions) (resp azfake.PagerResponder[armdns.DnssecConfigsClientListByDNSZoneResponse])
}
// NewDnssecConfigsServerTransport creates a new instance of DnssecConfigsServerTransport with the provided implementation.
// The returned DnssecConfigsServerTransport instance is connected to an instance of armdns.DnssecConfigsClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewDnssecConfigsServerTransport(srv *DnssecConfigsServer) *DnssecConfigsServerTransport {
return &DnssecConfigsServerTransport{
srv: srv,
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdns.DnssecConfigsClientCreateOrUpdateResponse]](),
beginDelete: newTracker[azfake.PollerResponder[armdns.DnssecConfigsClientDeleteResponse]](),
newListByDNSZonePager: newTracker[azfake.PagerResponder[armdns.DnssecConfigsClientListByDNSZoneResponse]](),
}
}
// DnssecConfigsServerTransport connects instances of armdns.DnssecConfigsClient to instances of DnssecConfigsServer.
// Don't use this type directly, use NewDnssecConfigsServerTransport instead.
type DnssecConfigsServerTransport struct {
srv *DnssecConfigsServer
beginCreateOrUpdate *tracker[azfake.PollerResponder[armdns.DnssecConfigsClientCreateOrUpdateResponse]]
beginDelete *tracker[azfake.PollerResponder[armdns.DnssecConfigsClientDeleteResponse]]
newListByDNSZonePager *tracker[azfake.PagerResponder[armdns.DnssecConfigsClientListByDNSZoneResponse]]
}
// Do implements the policy.Transporter interface for DnssecConfigsServerTransport.
func (d *DnssecConfigsServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
var resp *http.Response
var err error
switch method {
case "DnssecConfigsClient.BeginCreateOrUpdate":
resp, err = d.dispatchBeginCreateOrUpdate(req)
case "DnssecConfigsClient.BeginDelete":
resp, err = d.dispatchBeginDelete(req)
case "DnssecConfigsClient.Get":
resp, err = d.dispatchGet(req)
case "DnssecConfigsClient.NewListByDNSZonePager":
resp, err = d.dispatchNewListByDNSZonePager(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
if err != nil {
return nil, err
}
return resp, nil
}
func (d *DnssecConfigsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
if d.srv.BeginCreateOrUpdate == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
}
beginCreateOrUpdate := d.beginCreateOrUpdate.get(req)
if beginCreateOrUpdate == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/dnsZones/(?P<zoneName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnssecConfigs/default`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
zoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("zoneName")])
if err != nil {
return nil, err
}
ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match"))
ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match"))
var options *armdns.DnssecConfigsClientBeginCreateOrUpdateOptions
if ifMatchParam != nil || ifNoneMatchParam != nil {
options = &armdns.DnssecConfigsClientBeginCreateOrUpdateOptions{
IfMatch: ifMatchParam,
IfNoneMatch: ifNoneMatchParam,
}
}
respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, zoneNameParam, options)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginCreateOrUpdate = &respr
d.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
}
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
d.beginCreateOrUpdate.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
}
if !server.PollerResponderMore(beginCreateOrUpdate) {
d.beginCreateOrUpdate.remove(req)
}
return resp, nil
}
func (d *DnssecConfigsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
if d.srv.BeginDelete == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
}
beginDelete := d.beginDelete.get(req)
if beginDelete == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/dnsZones/(?P<zoneName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnssecConfigs/default`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
zoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("zoneName")])
if err != nil {
return nil, err
}
ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match"))
var options *armdns.DnssecConfigsClientBeginDeleteOptions
if ifMatchParam != nil {
options = &armdns.DnssecConfigsClientBeginDeleteOptions{
IfMatch: ifMatchParam,
}
}
respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, zoneNameParam, options)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginDelete = &respr
d.beginDelete.add(req, beginDelete)
}
resp, err := server.PollerResponderNext(beginDelete, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
d.beginDelete.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
}
if !server.PollerResponderMore(beginDelete) {
d.beginDelete.remove(req)
}
return resp, nil
}
func (d *DnssecConfigsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
if d.srv.Get == nil {
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/dnsZones/(?P<zoneName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnssecConfigs/default`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
zoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("zoneName")])
if err != nil {
return nil, err
}
respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, zoneNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DnssecConfig, req)
if err != nil {
return nil, err
}
return resp, nil
}
func (d *DnssecConfigsServerTransport) dispatchNewListByDNSZonePager(req *http.Request) (*http.Response, error) {
if d.srv.NewListByDNSZonePager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListByDNSZonePager not implemented")}
}
newListByDNSZonePager := d.newListByDNSZonePager.get(req)
if newListByDNSZonePager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Network/dnsZones/(?P<zoneName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnssecConfigs`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
zoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("zoneName")])
if err != nil {
return nil, err
}
resp := d.srv.NewListByDNSZonePager(resourceGroupNameParam, zoneNameParam, nil)
newListByDNSZonePager = &resp
d.newListByDNSZonePager.add(req, newListByDNSZonePager)
server.PagerResponderInjectNextLinks(newListByDNSZonePager, req, func(page *armdns.DnssecConfigsClientListByDNSZoneResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListByDNSZonePager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
d.newListByDNSZonePager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListByDNSZonePager) {
d.newListByDNSZonePager.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -19,6 +19,7 @@ import (
// ServerFactory is a fake server for instances of the armdns.ClientFactory type.
type ServerFactory struct {
DnssecConfigsServer DnssecConfigsServer
RecordSetsServer RecordSetsServer
ResourceReferenceServer ResourceReferenceServer
ZonesServer ZonesServer
@ -38,6 +39,7 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport {
type ServerFactoryTransport struct {
srv *ServerFactory
trMu sync.Mutex
trDnssecConfigsServer *DnssecConfigsServerTransport
trRecordSetsServer *RecordSetsServerTransport
trResourceReferenceServer *ResourceReferenceServerTransport
trZonesServer *ZonesServerTransport
@ -56,6 +58,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) {
var err error
switch client {
case "DnssecConfigsClient":
initServer(s, &s.trDnssecConfigsServer, func() *DnssecConfigsServerTransport {
return NewDnssecConfigsServerTransport(&s.srv.DnssecConfigsServer)
})
resp, err = s.trDnssecConfigsServer.Do(req)
case "RecordSetsClient":
initServer(s, &s.trRecordSetsServer, func() *RecordSetsServerTransport { return NewRecordSetsServerTransport(&s.srv.RecordSetsServer) })
resp, err = s.trRecordSetsServer.Do(req)

Просмотреть файл

@ -0,0 +1,110 @@
//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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package fake
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 {
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
}

Просмотреть файл

@ -8,6 +8,8 @@
package armdns
import "time"
// ARecord - An A record.
type ARecord struct {
// The IPv4 address of this A record.
@ -38,6 +40,79 @@ type CnameRecord struct {
Cname *string
}
// DelegationSignerInfo - The delegation signer information.
type DelegationSignerInfo struct {
// READ-ONLY; The digest algorithm type represents the standard digest algorithm number used to construct the digest. See:
// https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml
DigestAlgorithmType *int32
// READ-ONLY; The digest value is a cryptographic hash value of the referenced DNSKEY Resource Record.
DigestValue *string
// READ-ONLY; The record represents a delegation signer (DS) record.
Record *string
}
// Digest - A digest.
type Digest struct {
// The digest algorithm type represents the standard digest algorithm number used to construct the digest. See: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml
AlgorithmType *int32
// The digest value is a cryptographic hash value of the referenced DNSKEY Resource Record.
Value *string
}
// DnssecConfig - Represents the DNSSEC configuration.
type DnssecConfig struct {
// The etag of the DNSSEC configuration.
Etag *string
// READ-ONLY; The ID of the DNSSEC configuration.
ID *string
// READ-ONLY; The name of the DNSSEC configuration.
Name *string
// READ-ONLY; The DNSSEC properties.
Properties *DnssecProperties
// READ-ONLY; Metadata pertaining to creation and last modification of the resource.
SystemData *SystemData
// READ-ONLY; The type of the DNSSEC configuration.
Type *string
}
// DnssecConfigListResult - The response to a List DNSSEC configurations operation.
type DnssecConfigListResult struct {
// Information about the DNSSEC configurations in the response.
Value []*DnssecConfig
// READ-ONLY; The continuation token for the next page of results.
NextLink *string
}
// DnssecProperties - Represents the DNSSEC properties.
type DnssecProperties struct {
// READ-ONLY; Provisioning State of the DNSSEC configuration.
ProvisioningState *string
// READ-ONLY; The list of signing keys.
SigningKeys []*SigningKey
}
// DsRecord - A DS record. For more information about the DS record format, see RFC 4034: https://www.rfc-editor.org/rfc/rfc4034
type DsRecord struct {
// The security algorithm type represents the standard security algorithm number of the DNSKEY Resource Record. See: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
Algorithm *int32
// The digest entity.
Digest *Digest
// The key tag value is used to determine which DNSKEY Resource Record is used for signature verification.
KeyTag *int32
}
// MxRecord - An MX record.
type MxRecord struct {
// The domain name of the mail host for this MX record.
@ -47,6 +122,36 @@ type MxRecord struct {
Preference *int32
}
// NaptrRecord - A NAPTR record. For more information about the NAPTR record format, see RFC 3403: https://www.rfc-editor.org/rfc/rfc3403
type NaptrRecord struct {
// The flags specific to DDDS applications. Values currently defined in RFC 3404 are uppercase and lowercase letters "A",
// "P", "S", and "U", and the empty string, "". Enclose Flags in quotation marks.
Flags *string
// The order in which the NAPTR records MUST be processed in order to accurately represent the ordered list of rules. The
// ordering is from lowest to highest. Valid values: 0-65535.
Order *int32
// The preference specifies the order in which NAPTR records with equal 'order' values should be processed, low numbers being
// processed before high numbers. Valid values: 0-65535.
Preference *int32
// The regular expression that the DDDS application uses to convert an input value into an output value. For example: an IP
// phone system might use a regular expression to convert a phone number that is
// entered by a user into a SIP URI. Enclose the regular expression in quotation marks. Specify either a value for 'regexp'
// or a value for 'replacement'.
Regexp *string
// The replacement is a fully qualified domain name (FQDN) of the next domain name that you want the DDDS application to submit
// a DNS query for. The DDDS application replaces the input value with the
// value specified for replacement. Specify either a value for 'regexp' or a value for 'replacement'. If you specify a value
// for 'regexp', specify a dot (.) for 'replacement'.
Replacement *string
// The services specific to DDDS applications. Enclose Services in quotation marks.
Services *string
}
// NsRecord - An NS record.
type NsRecord struct {
// The name server name for this NS record.
@ -100,12 +205,18 @@ type RecordSetProperties struct {
// The CNAME record in the record set.
CnameRecord *CnameRecord
// The list of DS records in the record set.
DsRecords []*DsRecord
// The metadata attached to the record set.
Metadata map[string]*string
// The list of MX records in the record set.
MxRecords []*MxRecord
// The list of NAPTR records in the record set.
NaptrRecords []*NaptrRecord
// The list of NS records in the record set.
NsRecords []*NsRecord
@ -124,6 +235,12 @@ type RecordSetProperties struct {
// A reference to an azure resource from where the dns resource value is taken.
TargetResource *SubResource
// The list of TLSA records in the record set.
TlsaRecords []*TlsaRecord
// A reference to an azure traffic manager profile resource from where the dns resource value is taken.
TrafficManagementProfile *SubResource
// The list of TXT records in the record set.
TxtRecords []*TxtRecord
@ -193,6 +310,28 @@ type ResourceReferenceResultProperties struct {
DNSResourceReferences []*ResourceReference
}
// SigningKey - Represents the signing key.
type SigningKey struct {
// READ-ONLY; The delegation signer information.
DelegationSignerInfo []*DelegationSignerInfo
// READ-ONLY; The flags specifies how the key is used.
Flags *int32
// READ-ONLY; The key tag value of the DNSKEY Resource Record.
KeyTag *int32
// READ-ONLY; The protocol value. The value is always 3.
Protocol *int32
// READ-ONLY; The public key, represented as a Base64 encoding.
PublicKey *string
// READ-ONLY; The security algorithm type represents the standard security algorithm number of the DNSKEY Resource Record.
// See: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
SecurityAlgorithmType *int32
}
// SoaRecord - An SOA record.
type SoaRecord struct {
// The email contact for this SOA record.
@ -238,6 +377,43 @@ type SubResource struct {
ID *string
}
// 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
}
// TlsaRecord - A TLSA record. For more information about the TLSA record format, see RFC 6698: https://www.rfc-editor.org/rfc/rfc6698
type TlsaRecord struct {
// This specifies the certificate association data to be matched.
CertAssociationData *string
// The matching type specifies how the certificate association is presented.
MatchingType *int32
// The selector specifies which part of the TLS certificate presented by the server will be matched against the association
// data.
Selector *int32
// The usage specifies the provided association that will be used to match the certificate presented in the TLS handshake.
Usage *int32
}
// TxtRecord - A TXT record.
type TxtRecord struct {
// The text value of this TXT record.
@ -264,6 +440,9 @@ type Zone struct {
// READ-ONLY; Resource name.
Name *string
// READ-ONLY; Metadata pertaining to creation and last modification of the resource.
SystemData *SystemData
// READ-ONLY; Resource type.
Type *string
}
@ -302,6 +481,9 @@ type ZoneProperties struct {
// READ-ONLY; The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this
// value will be ignored.
NumberOfRecordSets *int64
// READ-ONLY; The list of signing keys.
SigningKeys []*SigningKey
}
// ZoneUpdate - Describes a request to update a DNS zone.

Просмотреть файл

@ -131,6 +131,216 @@ func (c *CnameRecord) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DelegationSignerInfo.
func (d DelegationSignerInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "digestAlgorithmType", d.DigestAlgorithmType)
populate(objectMap, "digestValue", d.DigestValue)
populate(objectMap, "record", d.Record)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DelegationSignerInfo.
func (d *DelegationSignerInfo) 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", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "digestAlgorithmType":
err = unpopulate(val, "DigestAlgorithmType", &d.DigestAlgorithmType)
delete(rawMsg, key)
case "digestValue":
err = unpopulate(val, "DigestValue", &d.DigestValue)
delete(rawMsg, key)
case "record":
err = unpopulate(val, "Record", &d.Record)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type Digest.
func (d Digest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "algorithmType", d.AlgorithmType)
populate(objectMap, "value", d.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Digest.
func (d *Digest) 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", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "algorithmType":
err = unpopulate(val, "AlgorithmType", &d.AlgorithmType)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &d.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DnssecConfig.
func (d DnssecConfig) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "etag", d.Etag)
populate(objectMap, "id", d.ID)
populate(objectMap, "name", d.Name)
populate(objectMap, "properties", d.Properties)
populate(objectMap, "systemData", d.SystemData)
populate(objectMap, "type", d.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DnssecConfig.
func (d *DnssecConfig) 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", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "etag":
err = unpopulate(val, "Etag", &d.Etag)
delete(rawMsg, key)
case "id":
err = unpopulate(val, "ID", &d.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &d.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &d.Properties)
delete(rawMsg, key)
case "systemData":
err = unpopulate(val, "SystemData", &d.SystemData)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &d.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DnssecConfigListResult.
func (d DnssecConfigListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", d.NextLink)
populate(objectMap, "value", d.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DnssecConfigListResult.
func (d *DnssecConfigListResult) 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", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &d.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &d.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DnssecProperties.
func (d DnssecProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "provisioningState", d.ProvisioningState)
populate(objectMap, "signingKeys", d.SigningKeys)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DnssecProperties.
func (d *DnssecProperties) 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", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "provisioningState":
err = unpopulate(val, "ProvisioningState", &d.ProvisioningState)
delete(rawMsg, key)
case "signingKeys":
err = unpopulate(val, "SigningKeys", &d.SigningKeys)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DsRecord.
func (d DsRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "algorithm", d.Algorithm)
populate(objectMap, "digest", d.Digest)
populate(objectMap, "keyTag", d.KeyTag)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DsRecord.
func (d *DsRecord) 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", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "algorithm":
err = unpopulate(val, "Algorithm", &d.Algorithm)
delete(rawMsg, key)
case "digest":
err = unpopulate(val, "Digest", &d.Digest)
delete(rawMsg, key)
case "keyTag":
err = unpopulate(val, "KeyTag", &d.KeyTag)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MxRecord.
func (m MxRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -162,6 +372,53 @@ func (m *MxRecord) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type NaptrRecord.
func (n NaptrRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "flags", n.Flags)
populate(objectMap, "order", n.Order)
populate(objectMap, "preference", n.Preference)
populate(objectMap, "regexp", n.Regexp)
populate(objectMap, "replacement", n.Replacement)
populate(objectMap, "services", n.Services)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NaptrRecord.
func (n *NaptrRecord) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "flags":
err = unpopulate(val, "Flags", &n.Flags)
delete(rawMsg, key)
case "order":
err = unpopulate(val, "Order", &n.Order)
delete(rawMsg, key)
case "preference":
err = unpopulate(val, "Preference", &n.Preference)
delete(rawMsg, key)
case "regexp":
err = unpopulate(val, "Regexp", &n.Regexp)
delete(rawMsg, key)
case "replacement":
err = unpopulate(val, "Replacement", &n.Replacement)
delete(rawMsg, key)
case "services":
err = unpopulate(val, "Services", &n.Services)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type NsRecord.
func (n NsRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -297,9 +554,11 @@ func (r RecordSetProperties) MarshalJSON() ([]byte, error) {
populate(objectMap, "AAAARecords", r.AaaaRecords)
populate(objectMap, "caaRecords", r.CaaRecords)
populate(objectMap, "CNAMERecord", r.CnameRecord)
populate(objectMap, "DSRecords", r.DsRecords)
populate(objectMap, "fqdn", r.Fqdn)
populate(objectMap, "metadata", r.Metadata)
populate(objectMap, "MXRecords", r.MxRecords)
populate(objectMap, "NAPTRRecords", r.NaptrRecords)
populate(objectMap, "NSRecords", r.NsRecords)
populate(objectMap, "provisioningState", r.ProvisioningState)
populate(objectMap, "PTRRecords", r.PtrRecords)
@ -307,6 +566,8 @@ func (r RecordSetProperties) MarshalJSON() ([]byte, error) {
populate(objectMap, "SRVRecords", r.SrvRecords)
populate(objectMap, "TTL", r.TTL)
populate(objectMap, "targetResource", r.TargetResource)
populate(objectMap, "TLSARecords", r.TlsaRecords)
populate(objectMap, "trafficManagementProfile", r.TrafficManagementProfile)
populate(objectMap, "TXTRecords", r.TxtRecords)
return json.Marshal(objectMap)
}
@ -332,6 +593,9 @@ func (r *RecordSetProperties) UnmarshalJSON(data []byte) error {
case "CNAMERecord":
err = unpopulate(val, "CnameRecord", &r.CnameRecord)
delete(rawMsg, key)
case "DSRecords":
err = unpopulate(val, "DsRecords", &r.DsRecords)
delete(rawMsg, key)
case "fqdn":
err = unpopulate(val, "Fqdn", &r.Fqdn)
delete(rawMsg, key)
@ -341,6 +605,9 @@ func (r *RecordSetProperties) UnmarshalJSON(data []byte) error {
case "MXRecords":
err = unpopulate(val, "MxRecords", &r.MxRecords)
delete(rawMsg, key)
case "NAPTRRecords":
err = unpopulate(val, "NaptrRecords", &r.NaptrRecords)
delete(rawMsg, key)
case "NSRecords":
err = unpopulate(val, "NsRecords", &r.NsRecords)
delete(rawMsg, key)
@ -362,6 +629,12 @@ func (r *RecordSetProperties) UnmarshalJSON(data []byte) error {
case "targetResource":
err = unpopulate(val, "TargetResource", &r.TargetResource)
delete(rawMsg, key)
case "TLSARecords":
err = unpopulate(val, "TlsaRecords", &r.TlsaRecords)
delete(rawMsg, key)
case "trafficManagementProfile":
err = unpopulate(val, "TrafficManagementProfile", &r.TrafficManagementProfile)
delete(rawMsg, key)
case "TXTRecords":
err = unpopulate(val, "TxtRecords", &r.TxtRecords)
delete(rawMsg, key)
@ -582,6 +855,53 @@ func (r *ResourceReferenceResultProperties) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type SigningKey.
func (s SigningKey) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "delegationSignerInfo", s.DelegationSignerInfo)
populate(objectMap, "flags", s.Flags)
populate(objectMap, "keyTag", s.KeyTag)
populate(objectMap, "protocol", s.Protocol)
populate(objectMap, "publicKey", s.PublicKey)
populate(objectMap, "securityAlgorithmType", s.SecurityAlgorithmType)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SigningKey.
func (s *SigningKey) 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 "delegationSignerInfo":
err = unpopulate(val, "DelegationSignerInfo", &s.DelegationSignerInfo)
delete(rawMsg, key)
case "flags":
err = unpopulate(val, "Flags", &s.Flags)
delete(rawMsg, key)
case "keyTag":
err = unpopulate(val, "KeyTag", &s.KeyTag)
delete(rawMsg, key)
case "protocol":
err = unpopulate(val, "Protocol", &s.Protocol)
delete(rawMsg, key)
case "publicKey":
err = unpopulate(val, "PublicKey", &s.PublicKey)
delete(rawMsg, key)
case "securityAlgorithmType":
err = unpopulate(val, "SecurityAlgorithmType", &s.SecurityAlgorithmType)
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 SoaRecord.
func (s SoaRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -699,6 +1019,92 @@ 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 TlsaRecord.
func (t TlsaRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "certAssociationData", t.CertAssociationData)
populate(objectMap, "matchingType", t.MatchingType)
populate(objectMap, "selector", t.Selector)
populate(objectMap, "usage", t.Usage)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type TlsaRecord.
func (t *TlsaRecord) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", t, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "certAssociationData":
err = unpopulate(val, "CertAssociationData", &t.CertAssociationData)
delete(rawMsg, key)
case "matchingType":
err = unpopulate(val, "MatchingType", &t.MatchingType)
delete(rawMsg, key)
case "selector":
err = unpopulate(val, "Selector", &t.Selector)
delete(rawMsg, key)
case "usage":
err = unpopulate(val, "Usage", &t.Usage)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", t, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type TxtRecord.
func (t TxtRecord) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -734,6 +1140,7 @@ func (z Zone) MarshalJSON() ([]byte, error) {
populate(objectMap, "location", z.Location)
populate(objectMap, "name", z.Name)
populate(objectMap, "properties", z.Properties)
populate(objectMap, "systemData", z.SystemData)
populate(objectMap, "tags", z.Tags)
populate(objectMap, "type", z.Type)
return json.Marshal(objectMap)
@ -763,6 +1170,9 @@ func (z *Zone) UnmarshalJSON(data []byte) error {
case "properties":
err = unpopulate(val, "Properties", &z.Properties)
delete(rawMsg, key)
case "systemData":
err = unpopulate(val, "SystemData", &z.SystemData)
delete(rawMsg, key)
case "tags":
err = unpopulate(val, "Tags", &z.Tags)
delete(rawMsg, key)
@ -817,6 +1227,7 @@ func (z ZoneProperties) MarshalJSON() ([]byte, error) {
populate(objectMap, "numberOfRecordSets", z.NumberOfRecordSets)
populate(objectMap, "registrationVirtualNetworks", z.RegistrationVirtualNetworks)
populate(objectMap, "resolutionVirtualNetworks", z.ResolutionVirtualNetworks)
populate(objectMap, "signingKeys", z.SigningKeys)
populate(objectMap, "zoneType", z.ZoneType)
return json.Marshal(objectMap)
}
@ -848,6 +1259,9 @@ func (z *ZoneProperties) UnmarshalJSON(data []byte) error {
case "resolutionVirtualNetworks":
err = unpopulate(val, "ResolutionVirtualNetworks", &z.ResolutionVirtualNetworks)
delete(rawMsg, key)
case "signingKeys":
err = unpopulate(val, "SigningKeys", &z.SigningKeys)
delete(rawMsg, key)
case "zoneType":
err = unpopulate(val, "ZoneType", &z.ZoneType)
delete(rawMsg, key)
@ -897,7 +1311,7 @@ func populate(m map[string]any, k string, v any) {
}
func unpopulate(data json.RawMessage, fn string, v any) error {
if data == nil {
if data == nil || string(data) == "null" {
return nil
}
if err := json.Unmarshal(data, v); err != nil {

Просмотреть файл

@ -8,6 +8,42 @@
package armdns
// DnssecConfigsClientBeginCreateOrUpdateOptions contains the optional parameters for the DnssecConfigsClient.BeginCreateOrUpdate
// method.
type DnssecConfigsClientBeginCreateOrUpdateOptions struct {
// The etag of the DNSSEC configuration. Omit this value to always overwrite the DNSSEC configuration. Specify the last-seen
// etag value to prevent accidentally overwriting any concurrent changes.
IfMatch *string
// Set to '*' to allow this DNSSEC configuration to be created, but to prevent updating existing DNSSEC configuration. Other
// values will be ignored.
IfNoneMatch *string
// Resumes the LRO from the provided token.
ResumeToken string
}
// DnssecConfigsClientBeginDeleteOptions contains the optional parameters for the DnssecConfigsClient.BeginDelete method.
type DnssecConfigsClientBeginDeleteOptions struct {
// The etag of this DNSSEC configuration. Omit this value to always delete the DNSSEC configuration. Specify the last-seen
// etag value to prevent accidentally deleting any concurrent changes.
IfMatch *string
// Resumes the LRO from the provided token.
ResumeToken string
}
// DnssecConfigsClientGetOptions contains the optional parameters for the DnssecConfigsClient.Get method.
type DnssecConfigsClientGetOptions struct {
// placeholder for future optional parameters
}
// DnssecConfigsClientListByDNSZoneOptions contains the optional parameters for the DnssecConfigsClient.NewListByDNSZonePager
// method.
type DnssecConfigsClientListByDNSZoneOptions struct {
// placeholder for future optional parameters
}
// RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate method.
type RecordSetsClientCreateOrUpdateOptions struct {
// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value

Просмотреть файл

@ -29,7 +29,7 @@ type RecordSetsClient struct {
}
// NewRecordSetsClient creates a new instance of RecordSetsClient with the specified values.
// - subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
// - 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) {
@ -44,15 +44,15 @@ func NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredentia
return client, nil
}
// CreateOrUpdate - Creates or updates a record set within a DNS zone.
// CreateOrUpdate - Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created
// (they are created when the DNS zone is created).
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - relativeRecordSetName - The name of the record set, relative to the name of the zone.
// - recordType - The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are
// created when the DNS zone is created).
// - recordType - The type of DNS record in this record set.
// - parameters - Parameters supplied to the CreateOrUpdate operation.
// - options - RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate
// method.
@ -103,15 +103,15 @@ func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context,
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
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}
}
if options != nil && options.IfNoneMatch != nil {
req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch}
}
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}
@ -127,15 +127,15 @@ func (client *RecordSetsClient) createOrUpdateHandleResponse(resp *http.Response
return result, nil
}
// Delete - Deletes a record set from a DNS zone. This operation cannot be undone.
// Delete - Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted
// (they are deleted when the DNS zone is deleted).
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - relativeRecordSetName - The name of the record set, relative to the name of the zone.
// - recordType - The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when
// the DNS zone is deleted).
// - recordType - The type of DNS record in this record set.
// - options - RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method.
func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientDeleteOptions) (RecordSetsClientDeleteResponse, error) {
var err error
@ -183,20 +183,20 @@ func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourc
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
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["Accept"] = []string{"application/json"}
return req, nil
}
// Get - Gets a record set.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - relativeRecordSetName - The name of the record set, relative to the name of the zone.
// - recordType - The type of DNS record in this record set.
@ -248,7 +248,7 @@ func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGr
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -265,8 +265,8 @@ func (client *RecordSetsClient) getHandleResponse(resp *http.Response) (RecordSe
// NewListAllByDNSZonePager - Lists all record sets in a DNS zone.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListAllByDNSZonePager
// method.
@ -313,13 +313,13 @@ func (client *RecordSetsClient) listAllByDNSZoneCreateRequest(ctx context.Contex
return nil, err
}
reqQP := req.Raw().URL.Query()
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
if options != nil && options.RecordSetNameSuffix != nil {
reqQP.Set("$recordsetnamesuffix", *options.RecordSetNameSuffix)
}
reqQP.Set("api-version", "2018-05-01")
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -336,8 +336,8 @@ func (client *RecordSetsClient) listAllByDNSZoneHandleResponse(resp *http.Respon
// NewListByDNSZonePager - Lists all record sets in a DNS zone.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListByDNSZonePager
// method.
@ -384,13 +384,13 @@ func (client *RecordSetsClient) listByDNSZoneCreateRequest(ctx context.Context,
return nil, err
}
reqQP := req.Raw().URL.Query()
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
if options != nil && options.Recordsetnamesuffix != nil {
reqQP.Set("$recordsetnamesuffix", *options.Recordsetnamesuffix)
}
reqQP.Set("api-version", "2018-05-01")
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -407,10 +407,10 @@ func (client *RecordSetsClient) listByDNSZoneHandleResponse(resp *http.Response)
// NewListByTypePager - Lists the record sets of a specified type in a DNS zone.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - recordType - The type of record sets to enumerate.
// - recordType - The type of DNS record in this record set.
// - options - RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager
// method.
func (client *RecordSetsClient) NewListByTypePager(resourceGroupName string, zoneName string, recordType RecordType, options *RecordSetsClientListByTypeOptions) *runtime.Pager[RecordSetsClientListByTypeResponse] {
@ -460,13 +460,13 @@ func (client *RecordSetsClient) listByTypeCreateRequest(ctx context.Context, res
return nil, err
}
reqQP := req.Raw().URL.Query()
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
if options != nil && options.Recordsetnamesuffix != nil {
reqQP.Set("$recordsetnamesuffix", *options.Recordsetnamesuffix)
}
reqQP.Set("api-version", "2018-05-01")
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -484,8 +484,8 @@ func (client *RecordSetsClient) listByTypeHandleResponse(resp *http.Response) (R
// Update - Updates a record set within a DNS zone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - relativeRecordSetName - The name of the record set, relative to the name of the zone.
// - recordType - The type of DNS record in this record set.
@ -538,12 +538,12 @@ func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourc
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
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["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -28,7 +28,7 @@ type ResourceReferenceClient struct {
}
// NewResourceReferenceClient creates a new instance of ResourceReferenceClient with the specified values.
// - subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
// - 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 NewResourceReferenceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceReferenceClient, error) {
@ -46,7 +46,7 @@ func NewResourceReferenceClient(subscriptionID string, credential azcore.TokenCr
// GetByTargetResources - Returns the DNS records specified by the referencing targetResourceIds.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// Generated from API version 2023-07-01-preview
// - parameters - Properties for dns resource reference request.
// - options - ResourceReferenceClientGetByTargetResourcesOptions contains the optional parameters for the ResourceReferenceClient.GetByTargetResources
// method.
@ -84,7 +84,7 @@ func (client *ResourceReferenceClient) getByTargetResourcesCreateRequest(ctx con
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {

Просмотреть файл

@ -18,7 +18,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetDnsResourceReference.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/GetDnsResourceReference.json
func ExampleResourceReferenceClient_GetByTargetResources() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -8,6 +8,29 @@
package armdns
// DnssecConfigsClientCreateOrUpdateResponse contains the response from method DnssecConfigsClient.BeginCreateOrUpdate.
type DnssecConfigsClientCreateOrUpdateResponse struct {
// Represents the DNSSEC configuration.
DnssecConfig
}
// DnssecConfigsClientDeleteResponse contains the response from method DnssecConfigsClient.BeginDelete.
type DnssecConfigsClientDeleteResponse struct {
// placeholder for future response values
}
// DnssecConfigsClientGetResponse contains the response from method DnssecConfigsClient.Get.
type DnssecConfigsClientGetResponse struct {
// Represents the DNSSEC configuration.
DnssecConfig
}
// DnssecConfigsClientListByDNSZoneResponse contains the response from method DnssecConfigsClient.NewListByDNSZonePager.
type DnssecConfigsClientListByDNSZoneResponse struct {
// The response to a List DNSSEC configurations operation.
DnssecConfigListResult
}
// RecordSetsClientCreateOrUpdateResponse contains the response from method RecordSetsClient.CreateOrUpdate.
type RecordSetsClientCreateOrUpdateResponse struct {
// Describes a DNS record set (a collection of DNS records with the same name and type).

Просмотреть файл

@ -0,0 +1,110 @@
//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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armdns
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 {
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
}

Просмотреть файл

@ -29,7 +29,7 @@ type ZonesClient struct {
}
// NewZonesClient creates a new instance of ZonesClient with the specified values.
// - subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
// - 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 NewZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ZonesClient, error) {
@ -47,8 +47,8 @@ func NewZonesClient(subscriptionID string, credential azcore.TokenCredential, op
// CreateOrUpdate - Creates or updates a DNS zone. Does not modify DNS records within the zone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - parameters - Parameters supplied to the CreateOrUpdate operation.
// - options - ZonesClientCreateOrUpdateOptions contains the optional parameters for the ZonesClient.CreateOrUpdate method.
@ -94,15 +94,15 @@ func (client *ZonesClient) createOrUpdateCreateRequest(ctx context.Context, reso
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
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}
}
if options != nil && options.IfNoneMatch != nil {
req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch}
}
req.Raw().Header["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}
@ -121,8 +121,8 @@ func (client *ZonesClient) createOrUpdateHandleResponse(resp *http.Response) (Zo
// BeginDelete - Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - ZonesClientBeginDeleteOptions contains the optional parameters for the ZonesClient.BeginDelete method.
func (client *ZonesClient) BeginDelete(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientBeginDeleteOptions) (*runtime.Poller[ZonesClientDeleteResponse], error) {
@ -145,7 +145,7 @@ func (client *ZonesClient) BeginDelete(ctx context.Context, resourceGroupName st
// Delete - Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// Generated from API version 2023-07-01-preview
func (client *ZonesClient) deleteOperation(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientBeginDeleteOptions) (*http.Response, error) {
var err error
const operationName = "ZonesClient.BeginDelete"
@ -187,20 +187,20 @@ func (client *ZonesClient) deleteCreateRequest(ctx context.Context, resourceGrou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
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["Accept"] = []string{"application/json"}
return req, nil
}
// Get - Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - options - ZonesClientGetOptions contains the optional parameters for the ZonesClient.Get method.
func (client *ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientGetOptions) (ZonesClientGetResponse, error) {
@ -245,7 +245,7 @@ func (client *ZonesClient) getCreateRequest(ctx context.Context, resourceGroupNa
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -262,7 +262,7 @@ func (client *ZonesClient) getHandleResponse(resp *http.Response) (ZonesClientGe
// NewListPager - Lists the DNS zones in all resource groups in a subscription.
//
// Generated from API version 2018-05-01
// Generated from API version 2023-07-01-preview
// - options - ZonesClientListOptions contains the optional parameters for the ZonesClient.NewListPager method.
func (client *ZonesClient) NewListPager(options *ZonesClientListOptions) *runtime.Pager[ZonesClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[ZonesClientListResponse]{
@ -302,7 +302,7 @@ func (client *ZonesClient) listCreateRequest(ctx context.Context, options *Zones
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -319,8 +319,8 @@ func (client *ZonesClient) listHandleResponse(resp *http.Response) (ZonesClientL
// NewListByResourceGroupPager - Lists the DNS zones within a resource group.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - options - ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.NewListByResourceGroupPager
// method.
func (client *ZonesClient) NewListByResourceGroupPager(resourceGroupName string, options *ZonesClientListByResourceGroupOptions) *runtime.Pager[ZonesClientListByResourceGroupResponse] {
@ -365,7 +365,7 @@ func (client *ZonesClient) listByResourceGroupCreateRequest(ctx context.Context,
if options != nil && options.Top != nil {
reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10))
}
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -383,8 +383,8 @@ func (client *ZonesClient) listByResourceGroupHandleResponse(resp *http.Response
// Update - Updates a DNS zone. Does not modify DNS records within the zone.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2018-05-01
// - resourceGroupName - The name of the resource group.
// Generated from API version 2023-07-01-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - zoneName - The name of the DNS zone (without a terminating dot).
// - parameters - Parameters supplied to the Update operation.
// - options - ZonesClientUpdateOptions contains the optional parameters for the ZonesClient.Update method.
@ -430,12 +430,12 @@ func (client *ZonesClient) updateCreateRequest(ctx context.Context, resourceGrou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2018-05-01")
reqQP.Set("api-version", "2023-07-01-preview")
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["Accept"] = []string{"application/json"}
if err := runtime.MarshalAsJSON(req, parameters); err != nil {
return nil, err
}

Просмотреть файл

@ -18,7 +18,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateZone.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/CreateOrUpdateZone.json
func ExampleZonesClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -65,7 +65,7 @@ func ExampleZonesClient_CreateOrUpdate() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteZone.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/DeleteZone.json
func ExampleZonesClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -86,7 +86,7 @@ func ExampleZonesClient_BeginDelete() {
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetZone.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/GetZone.json
func ExampleZonesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -125,7 +125,7 @@ func ExampleZonesClient_Get() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchZone.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/PatchZone.json
func ExampleZonesClient_Update() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -168,7 +168,7 @@ func ExampleZonesClient_Update() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesByResourceGroup.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ListZonesByResourceGroup.json
func ExampleZonesClient_NewListByResourceGroupPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -231,7 +231,7 @@ func ExampleZonesClient_NewListByResourceGroupPager() {
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesBySubscription.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/987a8f38ab2a8359d085e149be042267a9ecc66f/specification/dns/resource-manager/Microsoft.Network/preview/2023-07-01-preview/examples/ListZonesBySubscription.json
func ExampleZonesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {