client

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package client provides a client for the versions API.

The client needs to be authenticated with AWS. It should be used in internal development and CI tools for administrative tasks. For just fetching information from the API, use the fetcher package instead.

Needed IAM permissions for read mode: - "s3:GetObject" - "s3:ListBucket"

Additional needed IAM permissions for write mode: - "s3:PutObject" - "s3:DeleteObject" - "cloudfront:CreateInvalidation"

Thread-safety of the bucket is not guaranteed. The client is not thread-safe.

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 is the client for the versions API.

func NewClient

func NewClient(ctx context.Context, region, bucket, distributionID string, dryRun bool,
	log *logger.Logger,
) (*Client, error)

NewClient creates a new client for the versions API.

func NewReadOnlyClient

func NewReadOnlyClient(ctx context.Context, region, bucket, distributionID string,
	log *logger.Logger,
) (*Client, error)

NewReadOnlyClient creates a new read-only client. This client can be used to fetch objects but cannot write updates.

func (*Client) DeleteRef

func (c *Client) DeleteRef(ctx context.Context, ref string) error

DeleteRef deletes the given ref from the versions API.

func (*Client) DeleteVersion

func (c *Client) DeleteVersion(ctx context.Context, ver versionsapi.Version) error

DeleteVersion deletes the given version from the versions API. The version will be removed from version lists and latest versions, and the versioned objects are deleted. Notice that the versions API can get into an inconsistent state if the version is the latest version but there is no older version of the same minor version available. Manual update of latest versions is required in this case.

func (*Client) FetchImageInfo

func (c *Client) FetchImageInfo(ctx context.Context, imageInfo versionsapi.ImageInfo) (versionsapi.ImageInfo, error)

FetchImageInfo fetches the given image info from the versions API.

func (*Client) FetchVersionLatest

func (c *Client) FetchVersionLatest(ctx context.Context, latest versionsapi.Latest) (versionsapi.Latest, error)

FetchVersionLatest fetches the latest version from the versions API.

func (*Client) FetchVersionList

func (c *Client) FetchVersionList(ctx context.Context, list versionsapi.List) (versionsapi.List, error)

FetchVersionList fetches the given version list from the versions API.

func (*Client) InvalidateCache

func (c *Client) InvalidateCache(ctx context.Context) error

InvalidateCache invalidates the CDN cache for the paths that have been written. The function should be deferred after the client has been created.

func (*Client) UpdateImageInfo

func (c *Client) UpdateImageInfo(ctx context.Context, imageInfo versionsapi.ImageInfo) error

UpdateImageInfo updates the given image info in the versions API.

func (*Client) UpdateVersionLatest

func (c *Client) UpdateVersionLatest(ctx context.Context, latest versionsapi.Latest) error

UpdateVersionLatest updates the latest version in the versions API.

func (*Client) UpdateVersionList

func (c *Client) UpdateVersionList(ctx context.Context, list versionsapi.List) error

UpdateVersionList updates the given version list in the versions API.

type NotFoundError

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

NotFoundError is an error that is returned when a resource is not found.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

Jump to

Keyboard shortcuts

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