aws

package
v0.0.0-...-9b598c7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAWSRoute53Region = "us-east-1"
	DefaultGCPRoute53Region = "us-east-1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSClient

type AWSClient interface {
	// route53
	ListHostedZonesByNameInput(dnsName string) (*route53.ListHostedZonesByNameOutput, error)
	ChangeResourceRecordSets(dnsName string, recordChangeBatch *route53.ChangeBatch) (*route53.ChangeResourceRecordSetsOutput, error)
	GetChange(changeId string) (*route53.GetChangeOutput, error)
}

type AWSClientMock

type AWSClientMock struct {
	// ChangeResourceRecordSetsFunc mocks the ChangeResourceRecordSets method.
	ChangeResourceRecordSetsFunc func(dnsName string, recordChangeBatch *route53.ChangeBatch) (*route53.ChangeResourceRecordSetsOutput, error)

	// GetChangeFunc mocks the GetChange method.
	GetChangeFunc func(changeId string) (*route53.GetChangeOutput, error)

	// ListHostedZonesByNameInputFunc mocks the ListHostedZonesByNameInput method.
	ListHostedZonesByNameInputFunc func(dnsName string) (*route53.ListHostedZonesByNameOutput, error)
	// contains filtered or unexported fields
}

AWSClientMock is a mock implementation of AWSClient.

func TestSomethingThatUsesAWSClient(t *testing.T) {

	// make and configure a mocked AWSClient
	mockedAWSClient := &AWSClientMock{
		ChangeResourceRecordSetsFunc: func(dnsName string, recordChangeBatch *route53.ChangeBatch) (*route53.ChangeResourceRecordSetsOutput, error) {
			panic("mock out the ChangeResourceRecordSets method")
		},
		GetChangeFunc: func(changeId string) (*route53.GetChangeOutput, error) {
			panic("mock out the GetChange method")
		},
		ListHostedZonesByNameInputFunc: func(dnsName string) (*route53.ListHostedZonesByNameOutput, error) {
			panic("mock out the ListHostedZonesByNameInput method")
		},
	}

	// use mockedAWSClient in code that requires AWSClient
	// and then make assertions.

}

func (*AWSClientMock) ChangeResourceRecordSets

func (mock *AWSClientMock) ChangeResourceRecordSets(dnsName string, recordChangeBatch *route53.ChangeBatch) (*route53.ChangeResourceRecordSetsOutput, error)

ChangeResourceRecordSets calls ChangeResourceRecordSetsFunc.

func (*AWSClientMock) ChangeResourceRecordSetsCalls

func (mock *AWSClientMock) ChangeResourceRecordSetsCalls() []struct {
	DnsName           string
	RecordChangeBatch *route53.ChangeBatch
}

ChangeResourceRecordSetsCalls gets all the calls that were made to ChangeResourceRecordSets. Check the length with:

len(mockedAWSClient.ChangeResourceRecordSetsCalls())

func (*AWSClientMock) GetChange

func (mock *AWSClientMock) GetChange(changeId string) (*route53.GetChangeOutput, error)

GetChange calls GetChangeFunc.

func (*AWSClientMock) GetChangeCalls

func (mock *AWSClientMock) GetChangeCalls() []struct {
	ChangeId string
}

GetChangeCalls gets all the calls that were made to GetChange. Check the length with:

len(mockedAWSClient.GetChangeCalls())

func (*AWSClientMock) ListHostedZonesByNameInput

func (mock *AWSClientMock) ListHostedZonesByNameInput(dnsName string) (*route53.ListHostedZonesByNameOutput, error)

ListHostedZonesByNameInput calls ListHostedZonesByNameInputFunc.

func (*AWSClientMock) ListHostedZonesByNameInputCalls

func (mock *AWSClientMock) ListHostedZonesByNameInputCalls() []struct {
	DnsName string
}

ListHostedZonesByNameInputCalls gets all the calls that were made to ListHostedZonesByNameInput. Check the length with:

len(mockedAWSClient.ListHostedZonesByNameInputCalls())

type ClientFactory

type ClientFactory interface {
	NewClient(credentials Config, region string) (AWSClient, error)
}

type Config

type Config struct {
	// AccessKeyID is the AWS access key identifier.
	AccessKeyID string
	// SecretAccessKey is the AWS secret access key.
	SecretAccessKey string
}

Config contains the AWS settings

type DefaultClientFactory

type DefaultClientFactory struct{}

func NewDefaultClientFactory

func NewDefaultClientFactory() *DefaultClientFactory

func (*DefaultClientFactory) NewClient

func (f *DefaultClientFactory) NewClient(credentials Config, region string) (AWSClient, error)

type MockClientFactory

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

func NewMockClientFactory

func NewMockClientFactory(client AWSClient) *MockClientFactory

func (*MockClientFactory) NewClient

func (m *MockClientFactory) NewClient(credentials Config, region string) (AWSClient, error)

type Route53API

type Route53API route53Client

Jump to

Keyboard shortcuts

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