armdns

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 13 Imported by: 29

README

Azure DNS Module for Go

PkgGoDev

The armdns module provides operations for working with Azure DNS.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure DNS module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure DNS. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Client Factory

Azure DNS module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armdns.NewClientFactory(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armdns.NewClientFactory(<subscription ID>, cred, &options)

Clients

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.

client := clientFactory.NewRecordSetsClient()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the DNS label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARecord

type ARecord struct {
	// The IPv4 address of this A record.
	IPv4Address *string
}

ARecord - An A record.

func (ARecord) MarshalJSON added in v1.1.0

func (a ARecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ARecord.

func (*ARecord) UnmarshalJSON added in v1.1.0

func (a *ARecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ARecord.

type AaaaRecord

type AaaaRecord struct {
	// The IPv6 address of this AAAA record.
	IPv6Address *string
}

AaaaRecord - An AAAA record.

func (AaaaRecord) MarshalJSON added in v1.1.0

func (a AaaaRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AaaaRecord.

func (*AaaaRecord) UnmarshalJSON added in v1.1.0

func (a *AaaaRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AaaaRecord.

type CaaRecord

type CaaRecord struct {
	// The flags for this CAA record as an integer between 0 and 255.
	Flags *int32

	// The tag for this CAA record.
	Tag *string

	// The value for this CAA record.
	Value *string
}

CaaRecord - A CAA record.

func (CaaRecord) MarshalJSON added in v1.1.0

func (c CaaRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CaaRecord.

func (*CaaRecord) UnmarshalJSON added in v1.1.0

func (c *CaaRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CaaRecord.

type ClientFactory added in v1.1.0

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v1.1.0

func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

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.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewRecordSetsClient added in v1.1.0

func (c *ClientFactory) NewRecordSetsClient() *RecordSetsClient

NewRecordSetsClient creates a new instance of RecordSetsClient.

func (*ClientFactory) NewResourceReferenceClient added in v1.1.0

func (c *ClientFactory) NewResourceReferenceClient() *ResourceReferenceClient

NewResourceReferenceClient creates a new instance of ResourceReferenceClient.

func (*ClientFactory) NewZonesClient added in v1.1.0

func (c *ClientFactory) NewZonesClient() *ZonesClient

NewZonesClient creates a new instance of ZonesClient.

type CnameRecord

type CnameRecord struct {
	// The canonical name for this CNAME record.
	Cname *string
}

CnameRecord - A CNAME record.

func (CnameRecord) MarshalJSON added in v1.1.0

func (c CnameRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CnameRecord.

func (*CnameRecord) UnmarshalJSON added in v1.1.0

func (c *CnameRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CnameRecord.

type MxRecord

type MxRecord struct {
	// The domain name of the mail host for this MX record.
	Exchange *string

	// The preference value for this MX record.
	Preference *int32
}

MxRecord - An MX record.

func (MxRecord) MarshalJSON added in v1.1.0

func (m MxRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MxRecord.

func (*MxRecord) UnmarshalJSON added in v1.1.0

func (m *MxRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MxRecord.

type NsRecord

type NsRecord struct {
	// The name server name for this NS record.
	Nsdname *string
}

NsRecord - An NS record.

func (NsRecord) MarshalJSON added in v1.1.0

func (n NsRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type NsRecord.

func (*NsRecord) UnmarshalJSON added in v1.1.0

func (n *NsRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type NsRecord.

type PtrRecord

type PtrRecord struct {
	// The PTR target domain name for this PTR record.
	Ptrdname *string
}

PtrRecord - A PTR record.

func (PtrRecord) MarshalJSON added in v1.1.0

func (p PtrRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PtrRecord.

func (*PtrRecord) UnmarshalJSON added in v1.1.0

func (p *PtrRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PtrRecord.

type RecordSet

type RecordSet struct {
	// The etag of the record set.
	Etag *string

	// The properties of the record set.
	Properties *RecordSetProperties

	// READ-ONLY; The ID of the record set.
	ID *string

	// READ-ONLY; The name of the record set.
	Name *string

	// READ-ONLY; The type of the record set.
	Type *string
}

RecordSet - Describes a DNS record set (a collection of DNS records with the same name and type).

func (RecordSet) MarshalJSON

func (r RecordSet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RecordSet.

func (*RecordSet) UnmarshalJSON added in v1.1.0

func (r *RecordSet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RecordSet.

type RecordSetListResult

type RecordSetListResult struct {
	// Information about the record sets in the response.
	Value []*RecordSet

	// READ-ONLY; The continuation token for the next page of results.
	NextLink *string
}

RecordSetListResult - The response to a record set List operation.

func (RecordSetListResult) MarshalJSON

func (r RecordSetListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RecordSetListResult.

func (*RecordSetListResult) UnmarshalJSON added in v1.1.0

func (r *RecordSetListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetListResult.

type RecordSetProperties

type RecordSetProperties struct {
	// The list of A records in the record set.
	ARecords []*ARecord

	// The list of AAAA records in the record set.
	AaaaRecords []*AaaaRecord

	// The list of CAA records in the record set.
	CaaRecords []*CaaRecord

	// The CNAME record in the record set.
	CnameRecord *CnameRecord

	// 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 NS records in the record set.
	NsRecords []*NsRecord

	// The list of PTR records in the record set.
	PtrRecords []*PtrRecord

	// The SOA record in the record set.
	SoaRecord *SoaRecord

	// The list of SRV records in the record set.
	SrvRecords []*SrvRecord

	// The TTL (time-to-live) of the records in the record set.
	TTL *int64

	// A reference to an azure resource from where the dns resource value is taken.
	TargetResource *SubResource

	// The list of TXT records in the record set.
	TxtRecords []*TxtRecord

	// READ-ONLY; Fully qualified domain name of the record set.
	Fqdn *string

	// READ-ONLY; provisioning State of the record set.
	ProvisioningState *string
}

RecordSetProperties - Represents the properties of the records in the record set.

func (RecordSetProperties) MarshalJSON

func (r RecordSetProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RecordSetProperties.

func (*RecordSetProperties) UnmarshalJSON added in v1.1.0

func (r *RecordSetProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetProperties.

type RecordSetUpdateParameters

type RecordSetUpdateParameters struct {
	// Specifies information about the record set being updated.
	RecordSet *RecordSet
}

RecordSetUpdateParameters - Parameters supplied to update a record set.

func (RecordSetUpdateParameters) MarshalJSON added in v1.1.0

func (r RecordSetUpdateParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RecordSetUpdateParameters.

func (*RecordSetUpdateParameters) UnmarshalJSON added in v1.1.0

func (r *RecordSetUpdateParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RecordSetUpdateParameters.

type RecordSetsClient

type RecordSetsClient struct {
	// contains filtered or unexported fields
}

RecordSetsClient contains the methods for the RecordSets group. Don't use this type directly, use NewRecordSetsClient() instead.

func NewRecordSetsClient

func NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecordSetsClient, error)

NewRecordSetsClient creates a new instance of RecordSetsClient with the specified values.

  • subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*RecordSetsClient) CreateOrUpdate

func (client *RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientCreateOrUpdateOptions) (RecordSetsClientCreateOrUpdateResponse, error)

CreateOrUpdate - Creates or updates a record set within a DNS zone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • relativeRecordSetName - The name of the record set, relative to the name of the zone.
  • recordType - The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created).
  • parameters - Parameters supplied to the CreateOrUpdate operation.
  • options - RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate method.
Example (CreateARecordset)

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/CreateOrUpdateARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			ARecords: []*armdns.ARecord{
				{
					IPv4Address: to.Ptr("127.0.0.1"),
				}},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/A"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		ARecords: []*armdns.ARecord{
	// 			{
	// 				IPv4Address: to.Ptr("127.0.0.1"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateARecordsetWithAliasTargetResource)

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/CreateOrUpdateARecordsetAlias.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
			TargetResource: &armdns.SubResource{
				ID: to.Ptr("/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/A"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 		ProvisioningState: to.Ptr("Succeeded"),
	// 		TargetResource: &armdns.SubResource{
	// 			ID: to.Ptr("/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateAaaaRecordset)

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/CreateOrUpdateAAAARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeAAAA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			AaaaRecords: []*armdns.AaaaRecord{
				{
					IPv6Address: to.Ptr("::1"),
				}},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/AAAA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		AaaaRecords: []*armdns.AaaaRecord{
	// 			{
	// 				IPv6Address: to.Ptr("::1"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateCaaRecordset)

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/CreateOrUpdateCaaRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCAA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			TTL: to.Ptr[int64](3600),
			CaaRecords: []*armdns.CaaRecord{
				{
					Flags: to.Ptr[int32](0),
					Tag:   to.Ptr("issue"),
					Value: to.Ptr("ca.contoso.com"),
				}},
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/CAA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		CaaRecords: []*armdns.CaaRecord{
	// 			{
	// 				Flags: to.Ptr[int32](0),
	// 				Tag: to.Ptr("issue"),
	// 				Value: to.Ptr("ca.contoso.com"),
	// 		}},
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateCnameRecordset)

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/CreateOrUpdateCNAMERecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCNAME, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			CnameRecord: &armdns.CnameRecord{
				Cname: to.Ptr("contoso.com"),
			},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/CNAME"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		CnameRecord: &armdns.CnameRecord{
	// 			Cname: to.Ptr("contoso.com"),
	// 		},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateMxRecordset)

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/CreateOrUpdateMXRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeMX, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			MxRecords: []*armdns.MxRecord{
				{
					Exchange:   to.Ptr("mail.contoso.com"),
					Preference: to.Ptr[int32](0),
				}},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/MX"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		MxRecords: []*armdns.MxRecord{
	// 			{
	// 				Exchange: to.Ptr("mail.contoso.com"),
	// 				Preference: to.Ptr[int32](0),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateNsRecordset)

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/CreateOrUpdateNSRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeNS, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			NsRecords: []*armdns.NsRecord{
				{
					Nsdname: to.Ptr("ns1.contoso.com"),
				}},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/NS"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		NsRecords: []*armdns.NsRecord{
	// 			{
	// 				Nsdname: to.Ptr("ns1.contoso.com"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreatePtrRecordset)

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/CreateOrUpdatePTRRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "0.0.127.in-addr.arpa", "1", armdns.RecordTypePTR, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			PtrRecords: []*armdns.PtrRecord{
				{
					Ptrdname: to.Ptr("localhost"),
				}},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/PTR"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		PtrRecords: []*armdns.PtrRecord{
	// 			{
	// 				Ptrdname: to.Ptr("localhost"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("1.0.0.127.in-addr.arpa"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateSoaRecordset)

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/CreateOrUpdateSOARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "@", armdns.RecordTypeSOA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			SoaRecord: &armdns.SoaRecord{
				Email:        to.Ptr("hostmaster.contoso.com"),
				ExpireTime:   to.Ptr[int64](2419200),
				Host:         to.Ptr("ns1.contoso.com"),
				MinimumTTL:   to.Ptr[int64](300),
				RefreshTime:  to.Ptr[int64](3600),
				RetryTime:    to.Ptr[int64](300),
				SerialNumber: to.Ptr[int64](1),
			},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("@"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/SOA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		SoaRecord: &armdns.SoaRecord{
	// 			Email: to.Ptr("hostmaster.contoso.com"),
	// 			ExpireTime: to.Ptr[int64](2419200),
	// 			Host: to.Ptr("ns1.contoso.com"),
	// 			MinimumTTL: to.Ptr[int64](300),
	// 			RefreshTime: to.Ptr[int64](3600),
	// 			RetryTime: to.Ptr[int64](300),
	// 			SerialNumber: to.Ptr[int64](1),
	// 		},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateSrvRecordset)

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/CreateOrUpdateSRVRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeSRV, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			SrvRecords: []*armdns.SrvRecord{
				{
					Port:     to.Ptr[int32](80),
					Priority: to.Ptr[int32](0),
					Target:   to.Ptr("contoso.com"),
					Weight:   to.Ptr[int32](10),
				}},
			TTL: to.Ptr[int64](3600),
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/SRV"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		SrvRecords: []*armdns.SrvRecord{
	// 			{
	// 				Port: to.Ptr[int32](80),
	// 				Priority: to.Ptr[int32](0),
	// 				Target: to.Ptr("contoso.com"),
	// 				Weight: to.Ptr[int32](10),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (CreateTxtRecordset)

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/CreateOrUpdateTXTRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().CreateOrUpdate(ctx, "rg1", "zone1", "record1", armdns.RecordTypeTXT, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			TTL: to.Ptr[int64](3600),
			TxtRecords: []*armdns.TxtRecord{
				{
					Value: []*string{
						to.Ptr("string1"),
						to.Ptr("string2")},
				}},
			Metadata: map[string]*string{
				"key1": to.Ptr("value1"),
			},
		},
	}, &armdns.RecordSetsClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/TXT"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		TxtRecords: []*armdns.TxtRecord{
	// 			{
	// 				Value: []*string{
	// 					to.Ptr("string1"),
	// 					to.Ptr("string2")},
	// 			}},
	// 			Fqdn: to.Ptr("record1.zone1"),
	// 			Metadata: map[string]*string{
	// 				"key1": to.Ptr("value1"),
	// 			},
	// 		},
	// 	}
}
Output:

func (*RecordSetsClient) Delete

func (client *RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientDeleteOptions) (RecordSetsClientDeleteResponse, error)

Delete - Deletes a record set from a DNS zone. This operation cannot be undone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • relativeRecordSetName - The name of the record set, relative to the name of the zone.
  • recordType - The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted).
  • options - RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method.
Example (DeleteARecordset)

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/DeleteARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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)
	}
	_, err = clientFactory.NewRecordSetsClient().Delete(ctx, "rg1", "zone1", "record1", armdns.RecordTypeA, &armdns.RecordSetsClientDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (DeleteAaaaRecordset)

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/DeleteAAAARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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)
	}
	_, err = clientFactory.NewRecordSetsClient().Delete(ctx, "rg1", "zone1", "record1", armdns.RecordTypeAAAA, &armdns.RecordSetsClientDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (DeleteCaaRecordset)

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/DeleteCaaRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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)
	}
	_, err = clientFactory.NewRecordSetsClient().Delete(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCAA, &armdns.RecordSetsClientDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (DeletePtrRecordset)

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/DeletePTRRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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)
	}
	_, err = clientFactory.NewRecordSetsClient().Delete(ctx, "rg1", "0.0.127.in-addr.arpa", "1", armdns.RecordTypePTR, &armdns.RecordSetsClientDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (DeleteSrvRecordset)

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/DeleteSRVRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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)
	}
	_, err = clientFactory.NewRecordSetsClient().Delete(ctx, "rg1", "zone1", "record1", armdns.RecordTypeSRV, &armdns.RecordSetsClientDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

Example (DeleteTxtRecordset)

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/DeleteTXTRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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)
	}
	_, err = clientFactory.NewRecordSetsClient().Delete(ctx, "rg1", "zone1", "record1", armdns.RecordTypeTXT, &armdns.RecordSetsClientDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*RecordSetsClient) Get

func (client *RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, options *RecordSetsClientGetOptions) (RecordSetsClientGetResponse, error)

Get - Gets a record set. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • relativeRecordSetName - The name of the record set, relative to the name of the zone.
  • recordType - The type of DNS record in this record set.
  • options - RecordSetsClientGetOptions contains the optional parameters for the RecordSetsClient.Get method.
Example (GetARecordset)

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/GetARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeA, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/A"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		ARecords: []*armdns.ARecord{
	// 			{
	// 				IPv4Address: to.Ptr("127.0.0.1"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetAaaaRecordset)

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/GetAAAARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeAAAA, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/AAAA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		AaaaRecords: []*armdns.AaaaRecord{
	// 			{
	// 				IPv6Address: to.Ptr("::1"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetCaaRecordset)

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/GetCaaRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCAA, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/CAA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		CaaRecords: []*armdns.CaaRecord{
	// 			{
	// 				Flags: to.Ptr[int32](0),
	// 				Tag: to.Ptr("issue"),
	// 				Value: to.Ptr("ca.contoso.com"),
	// 		}},
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetCnameRecordset)

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/GetCNAMERecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCNAME, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/CNAME"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		CnameRecord: &armdns.CnameRecord{
	// 			Cname: to.Ptr("contoso.com"),
	// 		},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetMxRecordset)

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/GetMXRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeMX, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/MX"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		MxRecords: []*armdns.MxRecord{
	// 			{
	// 				Exchange: to.Ptr("mail.contoso.com"),
	// 				Preference: to.Ptr[int32](0),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetNsRecordset)

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/GetNSRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeNS, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/NS"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		NsRecords: []*armdns.NsRecord{
	// 			{
	// 				Nsdname: to.Ptr("ns1.contoso.com"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetPtrRecordset)

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/GetPTRRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "0.0.127.in-addr.arpa", "1", armdns.RecordTypePTR, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/PTR"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		PtrRecords: []*armdns.PtrRecord{
	// 			{
	// 				Ptrdname: to.Ptr("localhost"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("1.0.0.127.in-addr.arpa"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetSoaRecordset)

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/GetSOARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "@", armdns.RecordTypeSOA, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("@"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/SOA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		SoaRecord: &armdns.SoaRecord{
	// 			Email: to.Ptr("hostmaster.contoso.com"),
	// 			ExpireTime: to.Ptr[int64](2419200),
	// 			Host: to.Ptr("ns1.contoso.com"),
	// 			MinimumTTL: to.Ptr[int64](300),
	// 			RefreshTime: to.Ptr[int64](3600),
	// 			RetryTime: to.Ptr[int64](300),
	// 			SerialNumber: to.Ptr[int64](1),
	// 		},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetSrvRecordset)

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/GetSRVRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeSRV, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/SRV"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		SrvRecords: []*armdns.SrvRecord{
	// 			{
	// 				Port: to.Ptr[int32](80),
	// 				Priority: to.Ptr[int32](0),
	// 				Target: to.Ptr("contoso.com"),
	// 				Weight: to.Ptr[int32](10),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 		},
	// 	},
	// }
}
Output:

Example (GetTxtRecordset)

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/GetTXTRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeTXT, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/TXT"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		TxtRecords: []*armdns.TxtRecord{
	// 			{
	// 				Value: []*string{
	// 					to.Ptr("string1"),
	// 					to.Ptr("string2")},
	// 			}},
	// 			Fqdn: to.Ptr("record1.zone1"),
	// 			Metadata: map[string]*string{
	// 				"key1": to.Ptr("value1"),
	// 			},
	// 		},
	// 	}
}
Output:

func (*RecordSetsClient) NewListAllByDNSZonePager added in v0.4.0

func (client *RecordSetsClient) NewListAllByDNSZonePager(resourceGroupName string, zoneName string, options *RecordSetsClientListAllByDNSZoneOptions) *runtime.Pager[RecordSetsClientListAllByDNSZoneResponse]

NewListAllByDNSZonePager - Lists all record sets in a DNS zone.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • options - RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListAllByDNSZonePager method.

func (*RecordSetsClient) NewListByDNSZonePager added in v0.4.0

func (client *RecordSetsClient) NewListByDNSZonePager(resourceGroupName string, zoneName string, options *RecordSetsClientListByDNSZoneOptions) *runtime.Pager[RecordSetsClientListByDNSZoneResponse]

NewListByDNSZonePager - Lists all record sets in a DNS zone.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • options - RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListByDNSZonePager method.
Example

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/ListRecordSetsByZone.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByDNSZonePager("rg1", "zone1", &armdns.RecordSetsClientListByDNSZoneOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/CAA"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				TTL: to.Ptr[int64](3600),
		// 				CaaRecords: []*armdns.CaaRecord{
		// 					{
		// 						Flags: to.Ptr[int32](0),
		// 						Tag: to.Ptr("issue"),
		// 						Value: to.Ptr("ca.contoso.com"),
		// 				}},
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/A"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				ARecords: []*armdns.ARecord{
		// 					{
		// 						IPv4Address: to.Ptr("127.0.0.1"),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("record2"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/CNAME"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record2"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				CnameRecord: &armdns.CnameRecord{
		// 					Cname: to.Ptr("contoso.com"),
		// 				},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record2.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*RecordSetsClient) NewListByTypePager added in v0.4.0

func (client *RecordSetsClient) NewListByTypePager(resourceGroupName string, zoneName string, recordType RecordType, options *RecordSetsClientListByTypeOptions) *runtime.Pager[RecordSetsClientListByTypeResponse]

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.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • recordType - The type of record sets to enumerate.
  • options - RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager method.
Example (ListARecordsets)

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/ListARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeA, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/A"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				ARecords: []*armdns.ARecord{
		// 					{
		// 						IPv4Address: to.Ptr("127.0.0.1"),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListAaaaRecordsets)

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/ListAAAARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeAAAA, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/AAAA"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				AaaaRecords: []*armdns.AaaaRecord{
		// 					{
		// 						IPv6Address: to.Ptr("::1"),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListCaaRecordsets)

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/ListCaaRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeCAA, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/CAA"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				TTL: to.Ptr[int64](3600),
		// 				CaaRecords: []*armdns.CaaRecord{
		// 					{
		// 						Flags: to.Ptr[int32](0),
		// 						Tag: to.Ptr("issue"),
		// 						Value: to.Ptr("ca.contoso.com"),
		// 				}},
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListCnameRecordsets)

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/ListCNAMERecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeCNAME, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/CNAME"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				CnameRecord: &armdns.CnameRecord{
		// 					Cname: to.Ptr("contoso.com"),
		// 				},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListMxRecordsets)

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/ListMXRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeMX, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/MX"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				MxRecords: []*armdns.MxRecord{
		// 					{
		// 						Exchange: to.Ptr("mail.contoso.com"),
		// 						Preference: to.Ptr[int32](0),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListNsRecordsets)

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/ListNSRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeNS, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/NS"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				NsRecords: []*armdns.NsRecord{
		// 					{
		// 						Nsdname: to.Ptr("ns1.contoso.com"),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListPtrRecordsets)

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/ListPTRRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "0.0.127.in-addr.arpa", armdns.RecordTypePTR, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/PTR"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				PtrRecords: []*armdns.PtrRecord{
		// 					{
		// 						Ptrdname: to.Ptr("localhost"),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("1.0.0.127.in-addr.arpa"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListSoaRecordsets)

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/ListSOARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeSOA, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("@"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/SOA"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				SoaRecord: &armdns.SoaRecord{
		// 					Email: to.Ptr("hostmaster.contoso.com"),
		// 					ExpireTime: to.Ptr[int64](2419200),
		// 					Host: to.Ptr("ns1.contoso.com"),
		// 					MinimumTTL: to.Ptr[int64](300),
		// 					RefreshTime: to.Ptr[int64](3600),
		// 					RetryTime: to.Ptr[int64](300),
		// 					SerialNumber: to.Ptr[int64](1),
		// 				},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListSrvRecordsets)

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/ListSRVRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeSRV, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/SRV"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				SrvRecords: []*armdns.SrvRecord{
		// 					{
		// 						Port: to.Ptr[int32](80),
		// 						Priority: to.Ptr[int32](0),
		// 						Target: to.Ptr("contoso.com"),
		// 						Weight: to.Ptr[int32](10),
		// 				}},
		// 				TTL: to.Ptr[int64](3600),
		// 				Fqdn: to.Ptr("record1.zone1"),
		// 				Metadata: map[string]*string{
		// 					"key1": to.Ptr("value1"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

Example (ListTxtRecordsets)

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/ListTXTRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().NewListByTypePager("rg1", "zone1", armdns.RecordTypeTXT, &armdns.RecordSetsClientListByTypeOptions{Top: nil,
		Recordsetnamesuffix: nil,
	})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.RecordSetListResult = armdns.RecordSetListResult{
		// 	Value: []*armdns.RecordSet{
		// 		{
		// 			Name: to.Ptr("record1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones/TXT"),
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1"),
		// 			Properties: &armdns.RecordSetProperties{
		// 				TTL: to.Ptr[int64](3600),
		// 				TxtRecords: []*armdns.TxtRecord{
		// 					{
		// 						Value: []*string{
		// 							to.Ptr("string1"),
		// 							to.Ptr("string2")},
		// 					}},
		// 					Fqdn: to.Ptr("record1.zone1"),
		// 					Metadata: map[string]*string{
		// 						"key1": to.Ptr("value1"),
		// 					},
		// 				},
		// 		}},
		// 	}
	}
}
Output:

func (*RecordSetsClient) Update

func (client *RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, options *RecordSetsClientUpdateOptions) (RecordSetsClientUpdateResponse, error)

Update - Updates a record set within a DNS zone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • relativeRecordSetName - The name of the record set, relative to the name of the zone.
  • recordType - The type of DNS record in this record set.
  • parameters - Parameters supplied to the Update operation.
  • options - RecordSetsClientUpdateOptions contains the optional parameters for the RecordSetsClient.Update method.
Example (PatchARecordset)

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/PatchARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/A"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		ARecords: []*armdns.ARecord{
	// 			{
	// 				IPv4Address: to.Ptr("127.0.0.1"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchAaaaRecordset)

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/PatchAAAARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeAAAA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/AAAA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		AaaaRecords: []*armdns.AaaaRecord{
	// 			{
	// 				IPv6Address: to.Ptr("::1"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchCaaRecordset)

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/PatchCaaRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCAA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/CAA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		CaaRecords: []*armdns.CaaRecord{
	// 			{
	// 				Flags: to.Ptr[int32](0),
	// 				Tag: to.Ptr("issue"),
	// 				Value: to.Ptr("ca.contoso.com"),
	// 		}},
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchCnameRecordset)

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/PatchCNAMERecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCNAME, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/CNAME"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		CnameRecord: &armdns.CnameRecord{
	// 			Cname: to.Ptr("contoso.com"),
	// 		},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchMxRecordset)

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/PatchMXRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeMX, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/MX"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		MxRecords: []*armdns.MxRecord{
	// 			{
	// 				Exchange: to.Ptr("mail.contoso.com"),
	// 				Preference: to.Ptr[int32](0),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchNsRecordset)

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/PatchNSRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeNS, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/NS"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		NsRecords: []*armdns.NsRecord{
	// 			{
	// 				Nsdname: to.Ptr("ns1.contoso.com"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchPtrRecordset)

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/PatchPTRRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "0.0.127.in-addr.arpa", "1", armdns.RecordTypePTR, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/PTR"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		PtrRecords: []*armdns.PtrRecord{
	// 			{
	// 				Ptrdname: to.Ptr("localhost"),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("1.0.0.127.in-addr.arpa"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchSoaRecordset)

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/PatchSOARecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "@", armdns.RecordTypeSOA, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("@"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/SOA"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		SoaRecord: &armdns.SoaRecord{
	// 			Email: to.Ptr("hostmaster.contoso.com"),
	// 			ExpireTime: to.Ptr[int64](2419200),
	// 			Host: to.Ptr("ns1.contoso.com"),
	// 			MinimumTTL: to.Ptr[int64](300),
	// 			RefreshTime: to.Ptr[int64](3600),
	// 			RetryTime: to.Ptr[int64](300),
	// 			SerialNumber: to.Ptr[int64](1),
	// 		},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchSrvRecordset)

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/PatchSRVRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeSRV, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/SRV"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		SrvRecords: []*armdns.SrvRecord{
	// 			{
	// 				Port: to.Ptr[int32](80),
	// 				Priority: to.Ptr[int32](0),
	// 				Target: to.Ptr("contoso.com"),
	// 				Weight: to.Ptr[int32](10),
	// 		}},
	// 		TTL: to.Ptr[int64](3600),
	// 		Fqdn: to.Ptr("record1.zone1"),
	// 		Metadata: map[string]*string{
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}
Output:

Example (PatchTxtRecordset)

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/PatchTXTRecordset.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewRecordSetsClient().Update(ctx, "rg1", "zone1", "record1", armdns.RecordTypeTXT, armdns.RecordSet{
		Properties: &armdns.RecordSetProperties{
			Metadata: map[string]*string{
				"key2": to.Ptr("value2"),
			},
		},
	}, &armdns.RecordSetsClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.RecordSet = armdns.RecordSet{
	// 	Name: to.Ptr("record1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones/TXT"),
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1"),
	// 	Properties: &armdns.RecordSetProperties{
	// 		TTL: to.Ptr[int64](3600),
	// 		TxtRecords: []*armdns.TxtRecord{
	// 			{
	// 				Value: []*string{
	// 					to.Ptr("string1"),
	// 					to.Ptr("string2")},
	// 			}},
	// 			Fqdn: to.Ptr("record1.zone1"),
	// 			Metadata: map[string]*string{
	// 				"key2": to.Ptr("value2"),
	// 			},
	// 		},
	// 	}
}
Output:

type RecordSetsClientCreateOrUpdateOptions added in v0.2.0

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
	// to prevent accidentally overwriting any concurrent changes.
	IfMatch *string

	// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be
	// ignored.
	IfNoneMatch *string
}

RecordSetsClientCreateOrUpdateOptions contains the optional parameters for the RecordSetsClient.CreateOrUpdate method.

type RecordSetsClientCreateOrUpdateResponse added in v0.2.0

type RecordSetsClientCreateOrUpdateResponse struct {
	// Describes a DNS record set (a collection of DNS records with the same name and type).
	RecordSet
}

RecordSetsClientCreateOrUpdateResponse contains the response from method RecordSetsClient.CreateOrUpdate.

type RecordSetsClientDeleteOptions added in v0.2.0

type RecordSetsClientDeleteOptions struct {
	// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to
	// prevent accidentally deleting any concurrent changes.
	IfMatch *string
}

RecordSetsClientDeleteOptions contains the optional parameters for the RecordSetsClient.Delete method.

type RecordSetsClientDeleteResponse added in v0.2.0

type RecordSetsClientDeleteResponse struct {
}

RecordSetsClientDeleteResponse contains the response from method RecordSetsClient.Delete.

type RecordSetsClientGetOptions added in v0.2.0

type RecordSetsClientGetOptions struct {
}

RecordSetsClientGetOptions contains the optional parameters for the RecordSetsClient.Get method.

type RecordSetsClientGetResponse added in v0.2.0

type RecordSetsClientGetResponse struct {
	// Describes a DNS record set (a collection of DNS records with the same name and type).
	RecordSet
}

RecordSetsClientGetResponse contains the response from method RecordSetsClient.Get.

type RecordSetsClientListAllByDNSZoneOptions added in v0.2.0

type RecordSetsClientListAllByDNSZoneOptions struct {
	// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is
	// specified, Enumeration will return only records that end with .
	RecordSetNameSuffix *string

	// The maximum number of record sets to return. If not specified, returns up to 100 record sets.
	Top *int32
}

RecordSetsClientListAllByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListAllByDNSZonePager method.

type RecordSetsClientListAllByDNSZoneResponse added in v0.2.0

type RecordSetsClientListAllByDNSZoneResponse struct {
	// The response to a record set List operation.
	RecordSetListResult
}

RecordSetsClientListAllByDNSZoneResponse contains the response from method RecordSetsClient.NewListAllByDNSZonePager.

type RecordSetsClientListByDNSZoneOptions added in v0.2.0

type RecordSetsClientListByDNSZoneOptions struct {
	// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is
	// specified, Enumeration will return only records that end with .
	Recordsetnamesuffix *string

	// The maximum number of record sets to return. If not specified, returns up to 100 record sets.
	Top *int32
}

RecordSetsClientListByDNSZoneOptions contains the optional parameters for the RecordSetsClient.NewListByDNSZonePager method.

type RecordSetsClientListByDNSZoneResponse added in v0.2.0

type RecordSetsClientListByDNSZoneResponse struct {
	// The response to a record set List operation.
	RecordSetListResult
}

RecordSetsClientListByDNSZoneResponse contains the response from method RecordSetsClient.NewListByDNSZonePager.

type RecordSetsClientListByTypeOptions added in v0.2.0

type RecordSetsClientListByTypeOptions struct {
	// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is
	// specified, Enumeration will return only records that end with .
	Recordsetnamesuffix *string

	// The maximum number of record sets to return. If not specified, returns up to 100 record sets.
	Top *int32
}

RecordSetsClientListByTypeOptions contains the optional parameters for the RecordSetsClient.NewListByTypePager method.

type RecordSetsClientListByTypeResponse added in v0.2.0

type RecordSetsClientListByTypeResponse struct {
	// The response to a record set List operation.
	RecordSetListResult
}

RecordSetsClientListByTypeResponse contains the response from method RecordSetsClient.NewListByTypePager.

type RecordSetsClientUpdateOptions added in v0.2.0

type RecordSetsClientUpdateOptions struct {
	// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value
	// to prevent accidentally overwriting concurrent changes.
	IfMatch *string
}

RecordSetsClientUpdateOptions contains the optional parameters for the RecordSetsClient.Update method.

type RecordSetsClientUpdateResponse added in v0.2.0

type RecordSetsClientUpdateResponse struct {
	// Describes a DNS record set (a collection of DNS records with the same name and type).
	RecordSet
}

RecordSetsClientUpdateResponse contains the response from method RecordSetsClient.Update.

type RecordType

type RecordType string
const (
	RecordTypeA     RecordType = "A"
	RecordTypeAAAA  RecordType = "AAAA"
	RecordTypeCAA   RecordType = "CAA"
	RecordTypeCNAME RecordType = "CNAME"
	RecordTypeMX    RecordType = "MX"
	RecordTypeNS    RecordType = "NS"
	RecordTypePTR   RecordType = "PTR"
	RecordTypeSOA   RecordType = "SOA"
	RecordTypeSRV   RecordType = "SRV"
	RecordTypeTXT   RecordType = "TXT"
)

func PossibleRecordTypeValues

func PossibleRecordTypeValues() []RecordType

PossibleRecordTypeValues returns the possible values for the RecordType const type.

type Resource

type Resource struct {
	// REQUIRED; Resource location.
	Location *string

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; Resource ID.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

Resource - Common properties of an Azure Resource Manager resource

func (Resource) MarshalJSON

func (r Resource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v1.1.0

func (r *Resource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type ResourceReference added in v0.2.0

type ResourceReference struct {
	// A list of dns Records
	DNSResources []*SubResource

	// A reference to an azure resource from where the dns resource value is taken.
	TargetResource *SubResource
}

ResourceReference - Represents a single Azure resource and its referencing DNS records.

func (ResourceReference) MarshalJSON added in v0.2.0

func (r ResourceReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceReference.

func (*ResourceReference) UnmarshalJSON added in v1.1.0

func (r *ResourceReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReference.

type ResourceReferenceClient added in v0.2.0

type ResourceReferenceClient struct {
	// contains filtered or unexported fields
}

ResourceReferenceClient contains the methods for the DNSResourceReference group. Don't use this type directly, use NewResourceReferenceClient() instead.

func NewResourceReferenceClient added in v0.2.0

func NewResourceReferenceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceReferenceClient, error)

NewResourceReferenceClient creates a new instance of ResourceReferenceClient with the specified values.

  • subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ResourceReferenceClient) GetByTargetResources added in v0.2.0

GetByTargetResources - Returns the DNS records specified by the referencing targetResourceIds. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • parameters - Properties for dns resource reference request.
  • options - ResourceReferenceClientGetByTargetResourcesOptions contains the optional parameters for the ResourceReferenceClient.GetByTargetResources method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewResourceReferenceClient().GetByTargetResources(ctx, armdns.ResourceReferenceRequest{
		Properties: &armdns.ResourceReferenceRequestProperties{
			TargetResources: []*armdns.SubResource{
				{
					ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/trafficManagerProfiles/testpp2"),
				}},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// 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.ResourceReferenceResult = armdns.ResourceReferenceResult{
	// 	Properties: &armdns.ResourceReferenceResultProperties{
	// 		DNSResourceReferences: []*armdns.ResourceReference{
	// 			{
	// 				DNSResources: []*armdns.SubResource{
	// 					{
	// 						ID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/microsoft.network/dnszones/hydratest.dnszone.com5989/a/hydratestdnsrec9310"),
	// 				}},
	// 				TargetResource: &armdns.SubResource{
	// 					ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/trafficManagerProfiles/testpp2"),
	// 				},
	// 		}},
	// 	},
	// }
}
Output:

type ResourceReferenceClientGetByTargetResourcesOptions added in v0.2.0

type ResourceReferenceClientGetByTargetResourcesOptions struct {
}

ResourceReferenceClientGetByTargetResourcesOptions contains the optional parameters for the ResourceReferenceClient.GetByTargetResources method.

type ResourceReferenceClientGetByTargetResourcesResponse added in v0.2.0

type ResourceReferenceClientGetByTargetResourcesResponse struct {
	// Represents the properties of the Dns Resource Reference Result.
	ResourceReferenceResult
}

ResourceReferenceClientGetByTargetResourcesResponse contains the response from method ResourceReferenceClient.GetByTargetResources.

type ResourceReferenceRequest added in v0.2.0

type ResourceReferenceRequest struct {
	// The properties of the Resource Reference Request.
	Properties *ResourceReferenceRequestProperties
}

ResourceReferenceRequest - Represents the properties of the Dns Resource Reference Request.

func (ResourceReferenceRequest) MarshalJSON added in v1.1.0

func (r ResourceReferenceRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceReferenceRequest.

func (*ResourceReferenceRequest) UnmarshalJSON added in v1.1.0

func (r *ResourceReferenceRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceRequest.

type ResourceReferenceRequestProperties added in v0.2.0

type ResourceReferenceRequestProperties struct {
	// A list of references to azure resources for which referencing dns records need to be queried.
	TargetResources []*SubResource
}

ResourceReferenceRequestProperties - Represents the properties of the Dns Resource Reference Request.

func (ResourceReferenceRequestProperties) MarshalJSON added in v0.2.0

func (r ResourceReferenceRequestProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceReferenceRequestProperties.

func (*ResourceReferenceRequestProperties) UnmarshalJSON added in v1.1.0

func (r *ResourceReferenceRequestProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceRequestProperties.

type ResourceReferenceResult added in v0.2.0

type ResourceReferenceResult struct {
	// The result of dns resource reference request. Returns a list of dns resource references for each of the azure resource
	// in the request.
	Properties *ResourceReferenceResultProperties
}

ResourceReferenceResult - Represents the properties of the Dns Resource Reference Result.

func (ResourceReferenceResult) MarshalJSON added in v1.1.0

func (r ResourceReferenceResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceReferenceResult.

func (*ResourceReferenceResult) UnmarshalJSON added in v1.1.0

func (r *ResourceReferenceResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceResult.

type ResourceReferenceResultProperties added in v0.2.0

type ResourceReferenceResultProperties struct {
	// The result of dns resource reference request. A list of dns resource references for each of the azure resource in the request
	DNSResourceReferences []*ResourceReference
}

ResourceReferenceResultProperties - The result of dns resource reference request. Returns a list of dns resource references for each of the azure resource in the request.

func (ResourceReferenceResultProperties) MarshalJSON added in v0.2.0

func (r ResourceReferenceResultProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ResourceReferenceResultProperties.

func (*ResourceReferenceResultProperties) UnmarshalJSON added in v1.1.0

func (r *ResourceReferenceResultProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReferenceResultProperties.

type SoaRecord

type SoaRecord struct {
	// The email contact for this SOA record.
	Email *string

	// The expire time for this SOA record.
	ExpireTime *int64

	// The domain name of the authoritative name server for this SOA record.
	Host *string

	// The minimum value for this SOA record. By convention this is used to determine the negative caching duration.
	MinimumTTL *int64

	// The refresh value for this SOA record.
	RefreshTime *int64

	// The retry time for this SOA record.
	RetryTime *int64

	// The serial number for this SOA record.
	SerialNumber *int64
}

SoaRecord - An SOA record.

func (SoaRecord) MarshalJSON added in v1.1.0

func (s SoaRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SoaRecord.

func (*SoaRecord) UnmarshalJSON added in v1.1.0

func (s *SoaRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SoaRecord.

type SrvRecord

type SrvRecord struct {
	// The port value for this SRV record.
	Port *int32

	// The priority value for this SRV record.
	Priority *int32

	// The target domain name for this SRV record.
	Target *string

	// The weight value for this SRV record.
	Weight *int32
}

SrvRecord - An SRV record.

func (SrvRecord) MarshalJSON added in v1.1.0

func (s SrvRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SrvRecord.

func (*SrvRecord) UnmarshalJSON added in v1.1.0

func (s *SrvRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SrvRecord.

type SubResource

type SubResource struct {
	// Resource Id.
	ID *string
}

SubResource - A reference to a another resource

func (SubResource) MarshalJSON added in v1.1.0

func (s SubResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SubResource.

func (*SubResource) UnmarshalJSON added in v1.1.0

func (s *SubResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SubResource.

type TxtRecord

type TxtRecord struct {
	// The text value of this TXT record.
	Value []*string
}

TxtRecord - A TXT record.

func (TxtRecord) MarshalJSON

func (t TxtRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TxtRecord.

func (*TxtRecord) UnmarshalJSON added in v1.1.0

func (t *TxtRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TxtRecord.

type Zone

type Zone struct {
	// REQUIRED; Resource location.
	Location *string

	// The etag of the zone.
	Etag *string

	// The properties of the zone.
	Properties *ZoneProperties

	// Resource tags.
	Tags map[string]*string

	// READ-ONLY; Resource ID.
	ID *string

	// READ-ONLY; Resource name.
	Name *string

	// READ-ONLY; Resource type.
	Type *string
}

Zone - Describes a DNS zone.

func (Zone) MarshalJSON

func (z Zone) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Zone.

func (*Zone) UnmarshalJSON added in v1.1.0

func (z *Zone) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Zone.

type ZoneListResult

type ZoneListResult struct {
	// Information about the DNS zones.
	Value []*Zone

	// READ-ONLY; The continuation token for the next page of results.
	NextLink *string
}

ZoneListResult - The response to a Zone List or ListAll operation.

func (ZoneListResult) MarshalJSON

func (z ZoneListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ZoneListResult.

func (*ZoneListResult) UnmarshalJSON added in v1.1.0

func (z *ZoneListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ZoneListResult.

type ZoneProperties

type ZoneProperties struct {
	// A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private.
	RegistrationVirtualNetworks []*SubResource

	// A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private.
	ResolutionVirtualNetworks []*SubResource

	// The type of this DNS zone (Public or Private).
	ZoneType *ZoneType

	// READ-ONLY; The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any
	// attempt to set this value will be ignored.
	MaxNumberOfRecordSets *int64

	// READ-ONLY; The maximum number of records per record set that can be created in this DNS zone. This is a read-only property
	// and any attempt to set this value will be ignored.
	MaxNumberOfRecordsPerRecordSet *int64

	// READ-ONLY; The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored.
	NameServers []*string

	// 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
}

ZoneProperties - Represents the properties of the zone.

func (ZoneProperties) MarshalJSON

func (z ZoneProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ZoneProperties.

func (*ZoneProperties) UnmarshalJSON added in v1.1.0

func (z *ZoneProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ZoneProperties.

type ZoneType

type ZoneType string

ZoneType - The type of this DNS zone (Public or Private).

const (
	ZoneTypePrivate ZoneType = "Private"
	ZoneTypePublic  ZoneType = "Public"
)

func PossibleZoneTypeValues

func PossibleZoneTypeValues() []ZoneType

PossibleZoneTypeValues returns the possible values for the ZoneType const type.

type ZoneUpdate

type ZoneUpdate struct {
	// Resource tags.
	Tags map[string]*string
}

ZoneUpdate - Describes a request to update a DNS zone.

func (ZoneUpdate) MarshalJSON

func (z ZoneUpdate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ZoneUpdate.

func (*ZoneUpdate) UnmarshalJSON added in v1.1.0

func (z *ZoneUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ZoneUpdate.

type ZonesClient

type ZonesClient struct {
	// contains filtered or unexported fields
}

ZonesClient contains the methods for the Zones group. Don't use this type directly, use NewZonesClient() instead.

func NewZonesClient

func NewZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ZonesClient, error)

NewZonesClient creates a new instance of ZonesClient with the specified values.

  • subscriptionID - Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ZonesClient) BeginDelete

func (client *ZonesClient) BeginDelete(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientBeginDeleteOptions) (*runtime.Poller[ZonesClientDeleteResponse], error)

BeginDelete - Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • options - ZonesClientBeginDeleteOptions contains the optional parameters for the ZonesClient.BeginDelete method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewZonesClient().BeginDelete(ctx, "rg1", "zone1", &armdns.ZonesClientBeginDeleteOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*ZonesClient) CreateOrUpdate

func (client *ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, options *ZonesClientCreateOrUpdateOptions) (ZonesClientCreateOrUpdateResponse, error)

CreateOrUpdate - Creates or updates a DNS zone. Does not modify DNS records within the zone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • parameters - Parameters supplied to the CreateOrUpdate operation.
  • options - ZonesClientCreateOrUpdateOptions contains the optional parameters for the ZonesClient.CreateOrUpdate method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewZonesClient().CreateOrUpdate(ctx, "rg1", "zone1", armdns.Zone{
		Location: to.Ptr("Global"),
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
		},
	}, &armdns.ZonesClientCreateOrUpdateOptions{IfMatch: nil,
		IfNoneMatch: nil,
	})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// 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.Zone = armdns.Zone{
	// 	Name: to.Ptr("zone1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1"),
	// 	Location: to.Ptr("global"),
	// 	Tags: map[string]*string{
	// 		"key1": to.Ptr("value1"),
	// 	},
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armdns.ZoneProperties{
	// 		MaxNumberOfRecordSets: to.Ptr[int64](5000),
	// 		NameServers: []*string{
	// 			to.Ptr("ns1-01.azure-dns.com"),
	// 			to.Ptr("ns2-01.azure-dns.net"),
	// 			to.Ptr("ns3-01.azure-dns.org"),
	// 			to.Ptr("ns4-01.azure-dns.info")},
	// 			NumberOfRecordSets: to.Ptr[int64](2),
	// 			ZoneType: to.Ptr(armdns.ZoneTypePublic),
	// 		},
	// 	}
}
Output:

func (*ZonesClient) Get

func (client *ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string, options *ZonesClientGetOptions) (ZonesClientGetResponse, error)

Get - Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • options - ZonesClientGetOptions contains the optional parameters for the ZonesClient.Get method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewZonesClient().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.Zone = armdns.Zone{
	// 	Name: to.Ptr("zone1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1"),
	// 	Location: to.Ptr("global"),
	// 	Tags: map[string]*string{
	// 		"key1": to.Ptr("value1"),
	// 	},
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armdns.ZoneProperties{
	// 		MaxNumberOfRecordSets: to.Ptr[int64](5000),
	// 		NameServers: []*string{
	// 			to.Ptr("ns1-01.azure-dns.com"),
	// 			to.Ptr("ns2-01.azure-dns.net"),
	// 			to.Ptr("ns3-01.azure-dns.org"),
	// 			to.Ptr("ns4-01.azure-dns.info")},
	// 			NumberOfRecordSets: to.Ptr[int64](2),
	// 		},
	// 	}
}
Output:

func (*ZonesClient) NewListByResourceGroupPager added in v0.4.0

func (client *ZonesClient) NewListByResourceGroupPager(resourceGroupName string, options *ZonesClientListByResourceGroupOptions) *runtime.Pager[ZonesClientListByResourceGroupResponse]

NewListByResourceGroupPager - Lists the DNS zones within a resource group.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • options - ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.NewListByResourceGroupPager method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewZonesClient().NewListByResourceGroupPager("rg1", &armdns.ZonesClientListByResourceGroupOptions{Top: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ZoneListResult = armdns.ZoneListResult{
		// 	Value: []*armdns.Zone{
		// 		{
		// 			Name: to.Ptr("zone1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1"),
		// 			Location: to.Ptr("global"),
		// 			Tags: map[string]*string{
		// 				"key1": to.Ptr("value1"),
		// 			},
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			Properties: &armdns.ZoneProperties{
		// 				MaxNumberOfRecordSets: to.Ptr[int64](5000),
		// 				NameServers: []*string{
		// 					to.Ptr("ns1-01.azure-dns.com"),
		// 					to.Ptr("ns2-01.azure-dns.net"),
		// 					to.Ptr("ns3-01.azure-dns.org"),
		// 					to.Ptr("ns4-01.azure-dns.info")},
		// 					NumberOfRecordSets: to.Ptr[int64](2),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("zone2"),
		// 				Type: to.Ptr("Microsoft.Network/dnsZones"),
		// 				ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone2"),
		// 				Location: to.Ptr("global"),
		// 				Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 				Properties: &armdns.ZoneProperties{
		// 					MaxNumberOfRecordSets: to.Ptr[int64](5000),
		// 					NameServers: []*string{
		// 						to.Ptr("ns1-02.azure-dns.com"),
		// 						to.Ptr("ns2-02.azure-dns.net"),
		// 						to.Ptr("ns3-02.azure-dns.org"),
		// 						to.Ptr("ns4-02.azure-dns.info")},
		// 						NumberOfRecordSets: to.Ptr[int64](300),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

func (*ZonesClient) NewListPager added in v0.4.0

func (client *ZonesClient) NewListPager(options *ZonesClientListOptions) *runtime.Pager[ZonesClientListResponse]

NewListPager - Lists the DNS zones in all resource groups in a subscription.

Generated from API version 2018-05-01

  • options - ZonesClientListOptions contains the optional parameters for the ZonesClient.NewListPager method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewZonesClient().NewListPager(&armdns.ZonesClientListOptions{Top: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ZoneListResult = armdns.ZoneListResult{
		// 	Value: []*armdns.Zone{
		// 		{
		// 			Name: to.Ptr("zone1"),
		// 			Type: to.Ptr("Microsoft.Network/dnsZones"),
		// 			ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1"),
		// 			Location: to.Ptr("global"),
		// 			Tags: map[string]*string{
		// 				"key1": to.Ptr("value1"),
		// 			},
		// 			Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 			Properties: &armdns.ZoneProperties{
		// 				MaxNumberOfRecordSets: to.Ptr[int64](5000),
		// 				NameServers: []*string{
		// 					to.Ptr("ns1-01.azure-dns.com"),
		// 					to.Ptr("ns2-01.azure-dns.net"),
		// 					to.Ptr("ns3-01.azure-dns.org"),
		// 					to.Ptr("ns4-01.azure-dns.info")},
		// 					NumberOfRecordSets: to.Ptr[int64](2),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("zone2"),
		// 				Type: to.Ptr("Microsoft.Network/dnsZones"),
		// 				ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/dnsZones/zone2"),
		// 				Location: to.Ptr("global"),
		// 				Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 				Properties: &armdns.ZoneProperties{
		// 					MaxNumberOfRecordSets: to.Ptr[int64](5000),
		// 					NameServers: []*string{
		// 						to.Ptr("ns1-02.azure-dns.com"),
		// 						to.Ptr("ns2-02.azure-dns.net"),
		// 						to.Ptr("ns3-02.azure-dns.org"),
		// 						to.Ptr("ns4-02.azure-dns.info")},
		// 						NumberOfRecordSets: to.Ptr[int64](300),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

func (*ZonesClient) Update

func (client *ZonesClient) Update(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, options *ZonesClientUpdateOptions) (ZonesClientUpdateResponse, error)

Update - Updates a DNS zone. Does not modify DNS records within the zone. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • zoneName - The name of the DNS zone (without a terminating dot).
  • parameters - Parameters supplied to the Update operation.
  • options - ZonesClientUpdateOptions contains the optional parameters for the ZonesClient.Update method.
Example

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

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)

func main() {
	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.NewZonesClient().Update(ctx, "rg1", "zone1", armdns.ZoneUpdate{
		Tags: map[string]*string{
			"key2": to.Ptr("value2"),
		},
	}, &armdns.ZonesClientUpdateOptions{IfMatch: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// 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.Zone = armdns.Zone{
	// 	Name: to.Ptr("zone1"),
	// 	Type: to.Ptr("Microsoft.Network/dnsZones"),
	// 	ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1"),
	// 	Location: to.Ptr("global"),
	// 	Tags: map[string]*string{
	// 		"key2": to.Ptr("value2"),
	// 	},
	// 	Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armdns.ZoneProperties{
	// 		MaxNumberOfRecordSets: to.Ptr[int64](5000),
	// 		NameServers: []*string{
	// 			to.Ptr("ns1-01.azure-dns.com"),
	// 			to.Ptr("ns2-01.azure-dns.net"),
	// 			to.Ptr("ns3-01.azure-dns.org"),
	// 			to.Ptr("ns4-01.azure-dns.info")},
	// 			NumberOfRecordSets: to.Ptr[int64](2),
	// 		},
	// 	}
}
Output:

type ZonesClientBeginDeleteOptions added in v0.2.0

type ZonesClientBeginDeleteOptions struct {
	// The etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen etag value to prevent
	// accidentally deleting any concurrent changes.
	IfMatch *string

	// Resumes the LRO from the provided token.
	ResumeToken string
}

ZonesClientBeginDeleteOptions contains the optional parameters for the ZonesClient.BeginDelete method.

type ZonesClientCreateOrUpdateOptions added in v0.2.0

type ZonesClientCreateOrUpdateOptions struct {
	// The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent
	// accidentally overwriting any concurrent changes.
	IfMatch *string

	// Set to '*' to allow a new DNS zone to be created, but to prevent updating an existing zone. Other values will be ignored.
	IfNoneMatch *string
}

ZonesClientCreateOrUpdateOptions contains the optional parameters for the ZonesClient.CreateOrUpdate method.

type ZonesClientCreateOrUpdateResponse added in v0.2.0

type ZonesClientCreateOrUpdateResponse struct {
	// Describes a DNS zone.
	Zone
}

ZonesClientCreateOrUpdateResponse contains the response from method ZonesClient.CreateOrUpdate.

type ZonesClientDeleteResponse added in v0.2.0

type ZonesClientDeleteResponse struct {
}

ZonesClientDeleteResponse contains the response from method ZonesClient.BeginDelete.

type ZonesClientGetOptions added in v0.2.0

type ZonesClientGetOptions struct {
}

ZonesClientGetOptions contains the optional parameters for the ZonesClient.Get method.

type ZonesClientGetResponse added in v0.2.0

type ZonesClientGetResponse struct {
	// Describes a DNS zone.
	Zone
}

ZonesClientGetResponse contains the response from method ZonesClient.Get.

type ZonesClientListByResourceGroupOptions added in v0.2.0

type ZonesClientListByResourceGroupOptions struct {
	// The maximum number of record sets to return. If not specified, returns up to 100 record sets.
	Top *int32
}

ZonesClientListByResourceGroupOptions contains the optional parameters for the ZonesClient.NewListByResourceGroupPager method.

type ZonesClientListByResourceGroupResponse added in v0.2.0

type ZonesClientListByResourceGroupResponse struct {
	// The response to a Zone List or ListAll operation.
	ZoneListResult
}

ZonesClientListByResourceGroupResponse contains the response from method ZonesClient.NewListByResourceGroupPager.

type ZonesClientListOptions added in v0.2.0

type ZonesClientListOptions struct {
	// The maximum number of DNS zones to return. If not specified, returns up to 100 zones.
	Top *int32
}

ZonesClientListOptions contains the optional parameters for the ZonesClient.NewListPager method.

type ZonesClientListResponse added in v0.2.0

type ZonesClientListResponse struct {
	// The response to a Zone List or ListAll operation.
	ZoneListResult
}

ZonesClientListResponse contains the response from method ZonesClient.NewListPager.

type ZonesClientUpdateOptions added in v0.2.0

type ZonesClientUpdateOptions struct {
	// The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent
	// accidentally overwriting any concurrent changes.
	IfMatch *string
}

ZonesClientUpdateOptions contains the optional parameters for the ZonesClient.Update method.

type ZonesClientUpdateResponse added in v0.2.0

type ZonesClientUpdateResponse struct {
	// Describes a DNS zone.
	Zone
}

ZonesClientUpdateResponse contains the response from method ZonesClient.Update.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL