cloudfront

package
v0.0.0-...-a66ad4e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUpdateFunctionIsmissing = errors.New("update function is missing")
)

Functions

func UpdateCustomHeaderFn

func UpdateCustomHeaderFn(headerName, headerValue string) func(*DistributionConfig)

UpdateCustomHeaderFn returns a function that iterates over the distribution origins and updates the given custom header value if the header is found at the origin config level.

Types

type ClientAPI

type ClientAPI interface {
	GetDistributionConfig(
		ctx context.Context, params *cloudfront.GetDistributionConfigInput, optFns ...func(*cloudfront.Options),
	) (*cloudfront.GetDistributionConfigOutput, error)

	UpdateDistribution(
		ctx context.Context, params *cloudfront.UpdateDistributionInput, optFns ...func(*cloudfront.Options),
	) (*cloudfront.UpdateDistributionOutput, error)
}

func NewClient

func NewClient(cfg aws.Config) ClientAPI

NewClient return a cloudfront manager client

type DefaultUpdater

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

func NewDefaultUpdater

func NewDefaultUpdater(cli ClientAPI) *DefaultUpdater

func (*DefaultUpdater) Update

func (u *DefaultUpdater) Update(ctx context.Context, distID string, fns ...func(*DistributionConfig)) error

Update implements the Updater interface

type DistributionConfig

type DistributionConfig = types.DistributionConfig

DistributionConfig is an alias for "github.com/aws/aws-sdk-go-v2/service/cloudfront/types.DistributionConfig"

type MockClient

type MockClient struct {
	GetDistributionConfigFunc func(
		ctx context.Context, params *cloudfront.GetDistributionConfigInput, optFns ...func(*cloudfront.Options),
	) (*cloudfront.GetDistributionConfigOutput, error)
	UpdateDistributionFunc func(
		ctx context.Context, params *cloudfront.UpdateDistributionInput, optFns ...func(*cloudfront.Options),
	) (*cloudfront.UpdateDistributionOutput, error)
}

func (*MockClient) GetDistributionConfig

func (m *MockClient) GetDistributionConfig(
	ctx context.Context, params *cloudfront.GetDistributionConfigInput, optFns ...func(*cloudfront.Options),
) (*cloudfront.GetDistributionConfigOutput, error)

DescribeSecret implements ClientAPI.

func (*MockClient) UpdateDistribution

func (m *MockClient) UpdateDistribution(
	ctx context.Context, params *cloudfront.UpdateDistributionInput, optFns ...func(*cloudfront.Options),
) (*cloudfront.UpdateDistributionOutput, error)

GetSecretValue implements ClientAPI.

type MockUpdater

type MockUpdater struct {
	UpdateFn func(ctx context.Context, distID string, fns ...func(*DistributionConfig)) error
}

MockUpdater is a mock implementation of the Updater interface.

func (*MockUpdater) Update

func (m *MockUpdater) Update(ctx context.Context, distID string, fns ...func(*DistributionConfig)) error

Update mocks the Update method.

type Updater

type Updater interface {
	// Update fetches the distribution config and updates it using a set of functions.
	// An empty set of functions behavior is implementation-specific.
	Update(ctx context.Context, distID string, fns ...func(*DistributionConfig)) error
}

Updater interface presents a service that updates a cloudfront distribution config.

Jump to

Keyboard shortcuts

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