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 ¶
- type Client
- func (c *Client) DeleteRef(ctx context.Context, ref string) error
- func (c *Client) DeleteVersion(ctx context.Context, ver versionsapi.Version) error
- func (c *Client) FetchCLIInfo(ctx context.Context, cliInfo versionsapi.CLIInfo) (versionsapi.CLIInfo, error)
- func (c *Client) FetchImageInfo(ctx context.Context, imageInfo versionsapi.ImageInfo) (versionsapi.ImageInfo, error)
- func (c *Client) FetchVersionLatest(ctx context.Context, latest versionsapi.Latest) (versionsapi.Latest, error)
- func (c *Client) FetchVersionList(ctx context.Context, list versionsapi.List) (versionsapi.List, error)
- func (c *Client) InvalidateCache(ctx context.Context) error
- func (c *Client) UpdateCLIInfo(ctx context.Context, cliInfo versionsapi.CLIInfo) error
- func (c *Client) UpdateImageInfo(ctx context.Context, imageInfo versionsapi.ImageInfo) error
- func (c *Client) UpdateVersionLatest(ctx context.Context, latest versionsapi.Latest) error
- func (c *Client) UpdateVersionList(ctx context.Context, list versionsapi.List) error
- type NotFoundError
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) DeleteVersion ¶
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) FetchCLIInfo ¶ added in v2.6.0
func (c *Client) FetchCLIInfo(ctx context.Context, cliInfo versionsapi.CLIInfo) (versionsapi.CLIInfo, error)
FetchCLIInfo fetches the given CLI info from the versions API.
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 ¶
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) UpdateCLIInfo ¶ added in v2.6.0
UpdateCLIInfo updates the given CLI info in the versions API.
func (*Client) UpdateImageInfo ¶
UpdateImageInfo updates the given image info in the versions API.
func (*Client) UpdateVersionLatest ¶
UpdateVersionLatest updates the latest version in the versions API.
func (*Client) UpdateVersionList ¶
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