cloudfront

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Code generated by generate-cached. DO NOT EDIT.

Package cloudfront wraps the CloudFront SaaS Manager (multi-tenant distribution) API: distribution tenants, connection groups and the CloudFront-managed ACM certificates attached to a tenant.

A tenant is one hostname's front door on a shared "tenant-only" distribution, which makes it the primitive for provisioning large numbers of hostnames without one distribution per hostname.

Two things about CloudFront differ from the other services in this library:

  • The control plane is global. The client is still built from the v3 client's config, so the region carried by entities is the client's region, not a property of the resource.
  • ACM certificates referenced from a tenant (Customizations.Certificate.Arn) must live in us-east-1 regardless of where anything else runs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound covers a missing tenant, connection group or distribution.
	ErrNotFound = stderrors.New("cloudfront: resource not found")

	// ErrAlreadyExists is returned when a tenant name or domain is taken.
	ErrAlreadyExists = stderrors.New("cloudfront: resource already exists")

	// ErrPreconditionFailed means the supplied ETag was stale — the resource
	// changed underneath the caller. Re-read and retry.
	ErrPreconditionFailed = stderrors.New("cloudfront: precondition failed, stale ETag")

	// ErrNotDisabled means a delete was attempted on an enabled resource.
	// CloudFront requires disable-then-delete.
	ErrNotDisabled = stderrors.New("cloudfront: resource must be disabled before deletion")

	// ErrInUse means the resource is still referenced by something else, e.g. a
	// connection group that still has tenants attached.
	ErrInUse = stderrors.New("cloudfront: resource is still in use")

	// ErrLimitExceeded means an account or per-resource quota was hit.
	ErrLimitExceeded = stderrors.New("cloudfront: quota exceeded")
)

Sentinel errors for the API conditions callers actually need to branch on. CloudFront reports these as distinct modelled error shapes; collapsing them into sentinels lets consumers use errors.Is instead of type-switching on SDK types or matching strings.

Functions

This section is empty.

Types

type AwsClient

type AwsClient interface {
	GetRegion() ptypes.AwsRegion
	GetAccountID() ptypes.AwsAccountID
}

type CloudFrontRepository

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

func NewCloudFrontRepository

func NewCloudFrontRepository(ctx context.Context, client *v3.Client) *CloudFrontRepository

func (*CloudFrontRepository) CreateConnectionGroup

func (r *CloudFrontRepository) CreateConnectionGroup(input *awscf.CreateConnectionGroupInput) (*ConnectionGroup, error)

func (*CloudFrontRepository) CreateDistributionTenant

func (r *CloudFrontRepository) CreateDistributionTenant(input *awscf.CreateDistributionTenantInput) (*DistributionTenant, error)

CreateDistributionTenant provisions a tenant on a multi-tenant distribution.

func (*CloudFrontRepository) DeleteConnectionGroup

func (r *CloudFrontRepository) DeleteConnectionGroup(identifier string) error

DeleteConnectionGroup disables the group if needed, then deletes it. Refuses to touch the account's default group, and treats an already-absent group as success. A group that still has tenants attached fails with ErrInUse.

func (*CloudFrontRepository) DeleteConnectionGroupByInput

func (r *CloudFrontRepository) DeleteConnectionGroupByInput(input *awscf.DeleteConnectionGroupInput) error

DeleteConnectionGroupByInput deletes a connection group with a caller-supplied ETag.

func (*CloudFrontRepository) DeleteDistributionTenant

func (r *CloudFrontRepository) DeleteDistributionTenant(identifier string) error

DeleteDistributionTenant runs the disable-then-delete sequence CloudFront requires. Deleting an already-absent tenant is not an error.

The disable and the delete are issued back to back. If CloudFront has not finished applying the disable, the delete comes back as ErrNotDisabled and the caller should retry — this mirrors how every other CloudFront config change settles asynchronously.

func (*CloudFrontRepository) DeleteDistributionTenantByInput

func (r *CloudFrontRepository) DeleteDistributionTenantByInput(input *awscf.DeleteDistributionTenantInput) error

DeleteDistributionTenantByInput deletes a tenant with a caller-supplied ETag. CloudFront rejects the call with ErrNotDisabled unless the tenant is already disabled — use DeleteDistributionTenant for the full sequence.

func (*CloudFrontRepository) GetConnectionGroup

func (r *CloudFrontRepository) GetConnectionGroup(identifier string) (*ConnectionGroup, error)

GetConnectionGroup reads a connection group by ARN, ID or name.

func (*CloudFrontRepository) GetConnectionGroupByInput

func (r *CloudFrontRepository) GetConnectionGroupByInput(query *awscf.GetConnectionGroupInput) (*ConnectionGroup, error)

func (*CloudFrontRepository) GetConnectionGroupByRoutingEndpoint

func (r *CloudFrontRepository) GetConnectionGroupByRoutingEndpoint(routingEndpoint string) (*ConnectionGroup, error)

GetConnectionGroupByRoutingEndpoint resolves the group behind a CloudFront routing endpoint — the reverse of the lookup used when writing DNS.

func (*CloudFrontRepository) GetDistributionTenant

func (r *CloudFrontRepository) GetDistributionTenant(identifier string) (*DistributionTenant, error)

GetDistributionTenant reads a tenant by ARN, ID or name.

func (*CloudFrontRepository) GetDistributionTenantByDomain

func (r *CloudFrontRepository) GetDistributionTenantByDomain(domain string) (*DistributionTenant, error)

GetDistributionTenantByDomain resolves the tenant currently serving a hostname. This is the reverse lookup a rotation pool needs to answer "who owns this hostname".

func (*CloudFrontRepository) GetDistributionTenantByInput

func (r *CloudFrontRepository) GetDistributionTenantByInput(query *awscf.GetDistributionTenantInput) (*DistributionTenant, error)

func (*CloudFrontRepository) GetManagedCertificateDetails

func (r *CloudFrontRepository) GetManagedCertificateDetails(identifier string) (*cftypes.ManagedCertificateDetails, error)

GetManagedCertificateDetails reads the CloudFront-managed ACM certificate for a tenant. The identifier accepts a tenant ARN, ID or name.

Certificate state is deliberately not part of the tenant list response, so this is the only way to learn whether a tenant can serve TLS yet.

func (*CloudFrontRepository) GetRegion

func (r *CloudFrontRepository) GetRegion() ptypes.AwsRegion

func (*CloudFrontRepository) ListConnectionGroupsAll

func (r *CloudFrontRepository) ListConnectionGroupsAll() ([]ConnectionGroup, error)

ListConnectionGroupsAll lists every connection group in the account.

func (*CloudFrontRepository) ListConnectionGroupsByInput

func (r *CloudFrontRepository) ListConnectionGroupsByInput(query *awscf.ListConnectionGroupsInput) ([]ConnectionGroup, error)

func (*CloudFrontRepository) ListDistributionTenantsAll

func (r *CloudFrontRepository) ListDistributionTenantsAll() ([]DistributionTenantSummary, error)

ListDistributionTenantsAll lists every distribution tenant in the account.

func (*CloudFrontRepository) ListDistributionTenantsByDistribution

func (r *CloudFrontRepository) ListDistributionTenantsByDistribution(distributionID string) ([]DistributionTenantSummary, error)

ListDistributionTenantsByDistribution lists the tenants attached to one multi-tenant distribution.

func (*CloudFrontRepository) ListDistributionTenantsByInput

func (r *CloudFrontRepository) ListDistributionTenantsByInput(query *awscf.ListDistributionTenantsInput) ([]DistributionTenantSummary, error)

func (*CloudFrontRepository) ListDistributionTenantsWithCertificatesAll

func (r *CloudFrontRepository) ListDistributionTenantsWithCertificatesAll() ([]TenantCertificate, error)

ListDistributionTenantsWithCertificatesAll lists every tenant together with its managed certificate details.

func (*CloudFrontRepository) ListDistributionTenantsWithCertificatesByInput

func (r *CloudFrontRepository) ListDistributionTenantsWithCertificatesByInput(query *awscf.ListDistributionTenantsInput) ([]TenantCertificate, error)

ListDistributionTenantsWithCertificatesByInput lists tenants and fills in the certificate details each one is missing.

This is 1+N API calls by necessity — ListDistributionTenants does not return certificate state. The per-tenant reads run concurrently, bounded by certificateFetchConcurrency. A tenant whose certificate cannot be read (most commonly because it has no managed certificate) is returned with a nil Certificate rather than failing the whole listing.

func (*CloudFrontRepository) SetDistributionTenantEnabled

func (r *CloudFrontRepository) SetDistributionTenantEnabled(identifier string, enabled bool) (*DistributionTenant, error)

SetDistributionTenantEnabled flips a tenant between serving and disabled, reading the current ETag first so callers do not have to thread it through. A no-op when the tenant is already in the requested state.

func (*CloudFrontRepository) UpdateConnectionGroup

func (r *CloudFrontRepository) UpdateConnectionGroup(input *awscf.UpdateConnectionGroupInput) (*ConnectionGroup, error)

UpdateConnectionGroup applies a caller-built update. IfMatch must carry the current ETag.

func (*CloudFrontRepository) UpdateDistributionTenant

func (r *CloudFrontRepository) UpdateDistributionTenant(input *awscf.UpdateDistributionTenantInput) (*DistributionTenant, error)

UpdateDistributionTenant applies a caller-built update. IfMatch must carry the ETag of the version being replaced; a stale one yields ErrPreconditionFailed.

func (*CloudFrontRepository) UpdateDistributionTenantDomains

func (r *CloudFrontRepository) UpdateDistributionTenantDomains(identifier string, domains []string) (*DistributionTenant, error)

UpdateDistributionTenantDomains replaces the set of hostnames a tenant serves, reading the current ETag first.

func (*CloudFrontRepository) WithCache

WithCache returns a CloudFrontRepositoryCached that stores/retrieves results via the given DataCache. The cache namespace is set to "<accountID>:<region>".

type CloudFrontRepositoryCached

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

CloudFrontRepositoryCached wraps CloudFrontRepository and caches results of Get*/List* calls.

func (*CloudFrontRepositoryCached) GetConnectionGroup

func (c *CloudFrontRepositoryCached) GetConnectionGroup(identifier string) (*ConnectionGroup, error)

GetConnectionGroup returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) GetConnectionGroupByInput

func (c *CloudFrontRepositoryCached) GetConnectionGroupByInput(query *awscf.GetConnectionGroupInput) (*ConnectionGroup, error)

GetConnectionGroupByInput returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) GetConnectionGroupByRoutingEndpoint

func (c *CloudFrontRepositoryCached) GetConnectionGroupByRoutingEndpoint(routingEndpoint string) (*ConnectionGroup, error)

GetConnectionGroupByRoutingEndpoint returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) GetDistributionTenant

func (c *CloudFrontRepositoryCached) GetDistributionTenant(identifier string) (*DistributionTenant, error)

GetDistributionTenant returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) GetDistributionTenantByDomain

func (c *CloudFrontRepositoryCached) GetDistributionTenantByDomain(domain string) (*DistributionTenant, error)

GetDistributionTenantByDomain returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) GetDistributionTenantByInput

func (c *CloudFrontRepositoryCached) GetDistributionTenantByInput(query *awscf.GetDistributionTenantInput) (*DistributionTenant, error)

GetDistributionTenantByInput returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) GetManagedCertificateDetails

func (c *CloudFrontRepositoryCached) GetManagedCertificateDetails(identifier string) (*cftypes.ManagedCertificateDetails, error)

GetManagedCertificateDetails returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListConnectionGroupsAll

func (c *CloudFrontRepositoryCached) ListConnectionGroupsAll() ([]ConnectionGroup, error)

ListConnectionGroupsAll returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListConnectionGroupsByInput

func (c *CloudFrontRepositoryCached) ListConnectionGroupsByInput(query *awscf.ListConnectionGroupsInput) ([]ConnectionGroup, error)

ListConnectionGroupsByInput returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListDistributionTenantsAll

func (c *CloudFrontRepositoryCached) ListDistributionTenantsAll() ([]DistributionTenantSummary, error)

ListDistributionTenantsAll returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListDistributionTenantsByDistribution

func (c *CloudFrontRepositoryCached) ListDistributionTenantsByDistribution(distributionID string) ([]DistributionTenantSummary, error)

ListDistributionTenantsByDistribution returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListDistributionTenantsByInput

func (c *CloudFrontRepositoryCached) ListDistributionTenantsByInput(query *awscf.ListDistributionTenantsInput) ([]DistributionTenantSummary, error)

ListDistributionTenantsByInput returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListDistributionTenantsWithCertificatesAll

func (c *CloudFrontRepositoryCached) ListDistributionTenantsWithCertificatesAll() ([]TenantCertificate, error)

ListDistributionTenantsWithCertificatesAll returns cached results when available, otherwise delegates to the underlying repository.

func (*CloudFrontRepositoryCached) ListDistributionTenantsWithCertificatesByInput

func (c *CloudFrontRepositoryCached) ListDistributionTenantsWithCertificatesByInput(query *awscf.ListDistributionTenantsInput) ([]TenantCertificate, error)

ListDistributionTenantsWithCertificatesByInput returns cached results when available, otherwise delegates to the underlying repository.

type ConnectionGroup

type ConnectionGroup struct {
	service.AbstractResource
	cftypes.ConnectionGroup
	ETag string
}

ConnectionGroup is the routing target shared by a set of tenants. Its RoutingEndpoint is what a hostname's DNS record must point at, which makes it a required read before any DNS is written.

func NewConnectionGroup

func NewConnectionGroup(client AwsClient, group cftypes.ConnectionGroup, etag string) ConnectionGroup

func (ConnectionGroup) GetName

func (e ConnectionGroup) GetName() string

func (ConnectionGroup) GetRoutingEndpoint

func (e ConnectionGroup) GetRoutingEndpoint() string

GetRoutingEndpoint returns the CloudFront domain that tenant hostnames must CNAME to.

func (ConnectionGroup) GetTagValue

func (e ConnectionGroup) GetTagValue(tag string) string

func (ConnectionGroup) GetTags

func (e ConnectionGroup) GetTags() map[string]string

func (ConnectionGroup) IsDefaultGroup

func (e ConnectionGroup) IsDefaultGroup() bool

IsDefaultGroup reports whether this is the account's auto-created group. The default group must not be deleted.

func (ConnectionGroup) IsEnabled

func (e ConnectionGroup) IsEnabled() bool

type ConnectionGroupList

type ConnectionGroupList struct {
	Items []ConnectionGroup
}

ConnectionGroupList holds a list of ConnectionGroup items.

type DistributionTenant

type DistributionTenant struct {
	service.AbstractResource
	cftypes.DistributionTenant
	ETag string
}

DistributionTenant is a full tenant as returned by a Get. ETag is carried alongside because every mutating call needs it for optimistic locking.

func NewDistributionTenant

func NewDistributionTenant(client AwsClient, tenant cftypes.DistributionTenant, etag string) DistributionTenant

func (DistributionTenant) DomainNames

func (e DistributionTenant) DomainNames() []string

DomainNames returns the hostnames attached to the tenant.

func (DistributionTenant) DomainsActive

func (e DistributionTenant) DomainsActive() bool

DomainsActive reports whether every attached domain has reached active status. A tenant with no domains is not considered active.

func (DistributionTenant) GetName

func (e DistributionTenant) GetName() string

func (DistributionTenant) GetTagValue

func (e DistributionTenant) GetTagValue(tag string) string

func (DistributionTenant) GetTags

func (e DistributionTenant) GetTags() map[string]string

func (DistributionTenant) IsEnabled

func (e DistributionTenant) IsEnabled() bool

IsEnabled reports whether the tenant is serving. A disabled tenant is the precondition for deletion.

type DistributionTenantList

type DistributionTenantList struct {
	Items []DistributionTenant
}

DistributionTenantList holds a list of DistributionTenant items.

type DistributionTenantSummary

type DistributionTenantSummary struct {
	service.AbstractResource
	cftypes.DistributionTenantSummary
}

DistributionTenantSummary is the lighter entity returned by ListDistributionTenants. It carries almost everything the full tenant does — including the ETag — but not Parameters or Tags.

func (DistributionTenantSummary) DomainNames

func (e DistributionTenantSummary) DomainNames() []string

func (DistributionTenantSummary) DomainsActive

func (e DistributionTenantSummary) DomainsActive() bool

func (DistributionTenantSummary) GetETag

func (e DistributionTenantSummary) GetETag() string

GetETag returns the version token needed by the mutating calls.

func (DistributionTenantSummary) GetName

func (e DistributionTenantSummary) GetName() string

func (DistributionTenantSummary) GetTagValue

func (e DistributionTenantSummary) GetTagValue(_ string) string

func (DistributionTenantSummary) GetTags

func (e DistributionTenantSummary) GetTags() map[string]string

GetTags always returns an empty map: ListDistributionTenants does not return tags. Use GetDistributionTenantByInput when tags are needed.

func (DistributionTenantSummary) IsEnabled

func (e DistributionTenantSummary) IsEnabled() bool

type DistributionTenantSummaryList

type DistributionTenantSummaryList struct {
	Items []DistributionTenantSummary
}

DistributionTenantSummaryList holds a list of DistributionTenantSummary items.

type TenantCertificate

type TenantCertificate struct {
	Tenant      DistributionTenantSummary
	Certificate *cftypes.ManagedCertificateDetails
}

TenantCertificate pairs a tenant summary with its CloudFront-managed certificate details. Certificate state is not part of the tenant list response, so it has to be fetched per tenant; Certificate is nil when the tenant has no managed certificate (it inherits the distribution's, or brings its own ACM certificate).

func (TenantCertificate) CertificateIssued

func (e TenantCertificate) CertificateIssued() bool

CertificateIssued reports whether the managed certificate has been issued and the tenant can serve TLS. Returns false when there is no managed certificate.

func (TenantCertificate) PendingValidation

func (e TenantCertificate) PendingValidation() bool

PendingValidation reports whether the managed certificate is still waiting on domain validation.

func (TenantCertificate) ValidationRedirects

func (e TenantCertificate) ValidationRedirects() []cftypes.ValidationTokenDetail

ValidationRedirects returns the per-domain redirect targets a self-hosted validation flow must serve. Empty for the CloudFront-hosted flow.

Jump to

Keyboard shortcuts

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