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.
Each sub-API included in the Constellation Resource API should define it's resources by implementing types that implement apiObject. The new package can then call this package's Fetch and Update functions to get/modify resources from the API.
Index ¶
- func Delete(ctx context.Context, c *Client, obj APIObject) error
- func DeleteWithSignature(ctx context.Context, c *Client, obj APIObject) error
- func Fetch[T APIObject](ctx context.Context, c *Client, obj T) (T, error)
- func NewClient(ctx context.Context, region, bucket, distributionID string, dryRun bool, ...) (*Client, CloseFunc, error)
- func NewReadOnlyClient(ctx context.Context, region, bucket, distributionID string, log *logger.Logger) (*Client, CloseFunc, error)
- func SignAndUpdate(ctx context.Context, c *Client, obj APIObject, signer sigstore.Signer) error
- func Update(ctx context.Context, c *Client, obj APIObject) error
- type APIObject
- type Client
- type CloseFunc
- type NotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteWithSignature ¶ added in v2.10.0
DeleteWithSignature deletes the given apiObject and it's signature from the public Constellation API.
func NewClient ¶
func NewClient(ctx context.Context, region, bucket, distributionID string, dryRun bool, log *logger.Logger, ) (*Client, CloseFunc, 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, CloseFunc, error)
NewReadOnlyClient creates a new read-only client. This client can be used to fetch objects but cannot write updates.
func SignAndUpdate ¶ added in v2.10.0
SignAndUpdate signs the given apiObject and updates the object and it's signature in the API. This function should be used in favor of manually managing signatures. The signing is specified as part of the signer argument.
Types ¶
type APIObject ¶ added in v2.9.0
APIObject is an object that is used to perform CRUD operations on the API.
type Client ¶
type Client struct { DryRun bool // no write operations are performed Logger *logger.Logger // contains filtered or unexported fields }
Client is the a general client for all APIs.
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