r53

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client defines the client for interacting with Amazon Route 53

func NewFromAPI

func NewFromAPI(api DNSClientAPI) *Client

NewFromAPI returns a new client from the provided DNS API implementation

func (*Client) AssociateRecord

func (r *Client) AssociateRecord(ctx context.Context, res ResourceRecord) error

AssociateRecord creates a new A-Record entry within a given Route53 Private Hosted Zone for the specified Record Name and target EC2 IPv4 address

func (*Client) AssociateVPCWithZone added in v0.9.0

func (r *Client) AssociateVPCWithZone(ctx context.Context, id, vpc, region string) error

AssociateVPCWithZone attempts to associate a given VPC with a Route53 Private Hosted Zone. This is required to support any future DNS resolution queries. If an association already exists between the VPC and PHZ, a ConflictingDomainExists error is thrown by the AWS SDK and handled accordingly

The equivalent operation can be achieved through the CLI using:

aws route53 associate-vpc-with-hosted-zone --hosted-zone-id <HOSTED_ZONE_ID> \
 --vpc VPCId=<VPC_ID>,VPCRegion=<VPC_REGION>

func (*Client) ByID

func (r *Client) ByID(ctx context.Context, id string) (PrivateHostedZone, error)

ByID attempts to retrieve a Route53 Private Hosted Zone by its given ID

The equivalent operation can be achieved through the CLI using:

aws route53 get-hosted-zone --id <HOSTED_ZONE_ID>

func (*Client) ByName added in v0.9.0

func (r *Client) ByName(ctx context.Context, name string) (*PrivateHostedZone, error)

ByName will attempt to find a Route53 Private Hosted Zone that exactly matches the given domain name

The equivalent operation can be achieved through thr CLI using:

aws route53 list-hosted-zones-by-name --dns-name <DOMAIN_NAME>

func (*Client) ByVPC

func (r *Client) ByVPC(ctx context.Context, vpc, region string) ([]PrivateHostedZone, error)

ByVPC finds all Route53 Private Hosted Zones associated with a given VPC ID

The equivalent operation can be achieved through the CLI using:

aws route53 list-hosted-zones-by-vpc --vpc-id <VPC_ID> --vpc-region <REGION>

func (*Client) CreatePrivateHostedZone added in v0.9.0

func (r *Client) CreatePrivateHostedZone(ctx context.Context, name, vpc, region string) (PrivateHostedZone, error)

CreatePrivateHostedZone will attempt to create a Route53 Private Hosted Zone with the given domain name and associate it with the required VPC

The equivalent operation can be achieved through the CLI using:

aws route53 create-hosted-zone --name <DOMAIN_NAME> --vpc VPCId=<VPC_ID>,VPCRegion=<VPC_REGION> \
 --hosted-zone-config PrivateZone=true --caller-reference <REFERENCE>

func (*Client) DeletePrivateHostedZone added in v0.9.0

func (r *Client) DeletePrivateHostedZone(ctx context.Context, id string) error

DeletePrivateHostedZone will attempt to delete an existing Route53 Private Hosted Zone by its ID. If the hosted zone contains any record sets, the deletion will fail

The equivalent operation can be achieved through the CLI using:

aws route53 delete-hosted-zone --id <HOSTED_ZONE_ID>

func (*Client) DisassociateRecord

func (r *Client) DisassociateRecord(ctx context.Context, res ResourceRecord) error

DisassociateRecord attempts to delete an existing A-Record entry within a given Route53 Private Hosted Zone, based on the specified Record Name and target EC2 IPv4 address

func (*Client) DisassociateVPCWithZone added in v0.9.0

func (r *Client) DisassociateVPCWithZone(ctx context.Context, id, vpc, region string) error

DisassociateVPCWithZone attempts to disassociate a given VPC with a Route53 Private Hosted Zone. If no association exists between the VPC and PHZ, a VPCAssociationNotFound error is thrown by the AWS SDK and handled accordingly

The equivalent operation can be achieved through the CLI using:

aws route53 disassociate-vpc-with-hosted-zone --hosted-zone-id <HOSTED_ZONE_ID> \
 --vpc VPCId=<VPC_ID>,VPCRegion=<VPC_REGION>

type DNSClientAPI

type DNSClientAPI interface {
	// CreateHostedZone creates a new private hosted zone
	CreateHostedZone(ctx context.Context, params *awsr53.CreateHostedZoneInput, optFns ...func(*awsr53.Options)) (*awsr53.CreateHostedZoneOutput, error)

	// DeleteHostedZone deletes an existing private hosted zone
	DeleteHostedZone(ctx context.Context, params *awsr53.DeleteHostedZoneInput, optFns ...func(*awsr53.Options)) (*awsr53.DeleteHostedZoneOutput, error)

	// GetHostedZone retrieves information about a specified hosted zone including
	// the four name servers assigned to the hosted zone
	GetHostedZone(ctx context.Context, params *awsr53.GetHostedZoneInput, optFns ...func(*awsr53.Options)) (*awsr53.GetHostedZoneOutput, error)

	// ListHostedZonesByVPC lists all of the private hosted zones that a specified VPC
	// is associated with
	ListHostedZonesByVPC(ctx context.Context, params *awsr53.ListHostedZonesByVPCInput, optFns ...func(*awsr53.Options)) (*awsr53.ListHostedZonesByVPCOutput, error)

	// ListHostedZonesByName lists all of the private hosted zones that contain a specific
	// name in lexicographic order
	ListHostedZonesByName(ctx context.Context, params *awsr53.ListHostedZonesByNameInput, optFns ...func(*awsr53.Options)) (*awsr53.ListHostedZonesByNameOutput, error)

	// ChangeResourceRecordSets creates, changes, or deletes a resource record set,
	// which contains authoritative DNS information for a specified domain name or subdomain name
	ChangeResourceRecordSets(ctx context.Context, params *awsr53.ChangeResourceRecordSetsInput, optFns ...func(*awsr53.Options)) (*awsr53.ChangeResourceRecordSetsOutput, error)

	// AssociateVPCWithHostedZone will associate a VPC with a Route53 Private Hosted Zone
	AssociateVPCWithHostedZone(ctx context.Context, params *awsr53.AssociateVPCWithHostedZoneInput, optFns ...func(*awsr53.Options)) (*awsr53.AssociateVPCWithHostedZoneOutput, error)

	// DisassociateVPCFromHostedZone will disassociate a VPC with a Route53 Private Hosted Zone
	DisassociateVPCFromHostedZone(ctx context.Context, params *awsr53.DisassociateVPCFromHostedZoneInput, optFns ...func(*awsr53.Options)) (*awsr53.DisassociateVPCFromHostedZoneOutput, error)
}

DNSClientAPI defines the API for interacting with Amazon Route 53

type PrivateHostedZone

type PrivateHostedZone struct {
	// ID of the AWS Route53 Private Hosted Zone (PHZ)
	ID string

	// Name of the AWS Route53 Hosted Zone (PHZ). This will be the CNAME
	// of the parent domain
	Name string
}

PrivateHostedZone identifies an AWS Route53 Private Hosted Zone (PHZ)

type ResourceRecord

type ResourceRecord struct {
	// PhzID of the AWS Route53 Private Hosted Zone (PHZ)
	PhzID string

	// Name of the resource record that will be either be created, updated
	// or deleted within the AWS Route53 Private Hosted Zone (PHZ)
	Name string

	// Resource contains the value associated with the resource record
	Resource string
}

ResourceRecord represents a DNS record type that is supported by an AWS Route53 Private Hosted Zone (PHZ)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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