azure

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanAzureError added in v0.7.0

func CleanAzureError(err error) error

func ExtractAzureTargets added in v0.6.0

func ExtractAzureTargets(recordSet *dns.RecordSet) []string

Helper function (shared with test code)

func FormatAzureDNSName added in v0.6.0

func FormatAzureDNSName(recordName, zoneName string) string

Helper function (shared with test code)

Types

type AzureChangeMap added in v0.6.0

type AzureChangeMap map[string][]*endpoint.Endpoint

type AzureProvider

type AzureProvider struct {
	provider.BaseProvider
	DomainFilter   endpoint.DomainFilter
	ZoneNameFilter endpoint.DomainFilter

	DryRun        bool
	ResourceGroup string

	RecordSetsClient               RecordSetsClient
	TrafficManagerEndpointsClient  *armtrafficmanager.EndpointsClient
	TrafficManagerGeographicClient *armtrafficmanager.GeographicHierarchiesClient
	TrafficManagerProfilesClient   *armtrafficmanager.ProfilesClient
	// contains filtered or unexported fields
}

AzureProvider implements the DNS provider for Microsoft's Azure cloud platform.

func NewAzureProvider

func NewAzureProvider(ctx context.Context, configFile string, domainFilter endpoint.DomainFilter, zoneNameFilter endpoint.DomainFilter, zoneIDFilter provider.ZoneIDFilter, resourceGroup string, userAssignedIdentityClientID string, dryRun bool) (*AzureProvider, error)

NewAzureProvider creates a new Azure provider.

Returns the provider or an error if a provider could not be created.

func NewAzureProviderFromConfig

func NewAzureProviderFromConfig(ctx context.Context, azureConfig Config) (*AzureProvider, error)

func (*AzureProvider) ApplyChanges

func (p *AzureProvider) ApplyChanges(ctx context.Context, changes *plan.Changes) error

ApplyChanges applies the given changes.

Returns nil if the operation was successful or an error if the operation failed.

func (*AzureProvider) DeleteRecords added in v0.6.0

func (p *AzureProvider) DeleteRecords(ctx context.Context, deleted AzureChangeMap)

func (*AzureProvider) MapChanges added in v0.6.0

func (p *AzureProvider) MapChanges(zones []dns.Zone, changes *plan.Changes) (AzureChangeMap, AzureChangeMap)

func (*AzureProvider) NewRecordSet added in v0.6.0

func (p *AzureProvider) NewRecordSet(endpoint *endpoint.Endpoint) (dns.RecordSet, error)

func (*AzureProvider) RecordSetNameForZone added in v0.6.0

func (p *AzureProvider) RecordSetNameForZone(zone string, endpoint *endpoint.Endpoint) string

func (*AzureProvider) Records

func (p *AzureProvider) Records(ctx context.Context) (endpoints []*endpoint.Endpoint, _ error)

Records gets the current records.

Returns the current records or an error if the operation failed.

func (*AzureProvider) SupportedRecordType

func (p *AzureProvider) SupportedRecordType(recordType string) bool

func (*AzureProvider) UpdateRecords added in v0.6.0

func (p *AzureProvider) UpdateRecords(ctx context.Context, updated AzureChangeMap)

func (*AzureProvider) Zones

func (p *AzureProvider) Zones(ctx context.Context) ([]dns.Zone, error)

type Config

type Config struct {
	Cloud                        string `json:"cloud" yaml:"cloud"`
	TenantID                     string `json:"tenantId" yaml:"tenantId"`
	SubscriptionID               string `json:"subscriptionId" yaml:"subscriptionId"`
	ResourceGroup                string `json:"resourceGroup" yaml:"resourceGroup"`
	Location                     string `json:"location" yaml:"location"`
	ClientID                     string `json:"aadClientId" yaml:"aadClientId"`
	ClientSecret                 string `json:"aadClientSecret" yaml:"aadClientSecret"`
	UseManagedIdentityExtension  bool   `json:"useManagedIdentityExtension" yaml:"useManagedIdentityExtension"`
	UseWorkloadIdentityExtension bool   `json:"useWorkloadIdentityExtension" yaml:"useWorkloadIdentityExtension"`
	UserAssignedIdentityID       string `json:"userAssignedIdentityID" yaml:"userAssignedIdentityID"`
	DomainFilter                 endpoint.DomainFilter
	ZoneNameFilter               endpoint.DomainFilter
	IDFilter                     provider.ZoneIDFilter
	DryRun                       bool
	Transporter                  policy.Transporter
}

Config represents common config items for Azure DNS and Azure Private DNS

type RecordSetsClient

type RecordSetsClient interface {
	NewListAllByDNSZonePager(resourceGroupName string, zoneName string, options *dns.RecordSetsClientListAllByDNSZoneOptions) *azcoreruntime.Pager[dns.RecordSetsClientListAllByDNSZoneResponse]
	Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType dns.RecordType, options *dns.RecordSetsClientDeleteOptions) (dns.RecordSetsClientDeleteResponse, error)
	CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType dns.RecordType, parameters dns.RecordSet, options *dns.RecordSetsClientCreateOrUpdateOptions) (dns.RecordSetsClientCreateOrUpdateResponse, error)
}

RecordSetsClient is an interface of dns.RecordSetsClient that can be stubbed for testing.

type ZonesClient

type ZonesClient interface {
	NewListByResourceGroupPager(resourceGroupName string, options *dns.ZonesClientListByResourceGroupOptions) *azcoreruntime.Pager[dns.ZonesClientListByResourceGroupResponse]
}

ZonesClient is an interface of dns.ZoneClient that can be stubbed for testing.

Jump to

Keyboard shortcuts

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