{"modulePath":"github.com/flashbots/cvm-reverse-proxy","version":"v0.1.9","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\nPackage client provides a client for the versions API.\n\nThe 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.\n\nNeeded IAM permissions for read mode: - \"s3:GetObject\" - \"s3:ListBucket\"\n\nAdditional needed IAM permissions for write mode: - \"s3:PutObject\" - \"s3:DeleteObject\" - \"cloudfront:CreateInvalidation\"\n\nThread-safety of the bucket is not guaranteed. The client is not thread-safe.\n\nEach 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.\n\n## Functions\n\n```go\nfunc Delete(ctx context.Context, c *Client, obj APIObject) error\n```\nDelete deletes the given apiObject from the public Constellation API.\n\n```go\nfunc DeleteWithSignature(ctx context.Context, c *Client, obj APIObject) error\n```\nDeleteWithSignature deletes the given apiObject and it's signature from the public Constellation API.\n\n```go\nfunc Fetch[T APIObject](ctx context.Context, c *Client, obj T) (T, error)\n```\nFetch fetches the given apiObject from the public Constellation API.\n\n```go\nfunc NewClient(ctx context.Context, region, bucket, distributionID string, dryRun bool,\n\tlog *slog.Logger,\n) (*Client, CloseFunc, error)\n```\nNewClient creates a new client for the versions API.\n\n```go\nfunc NewReadOnlyClient(ctx context.Context, region, bucket, distributionID string,\n\tlog *slog.Logger,\n) (*Client, CloseFunc, error)\n```\nNewReadOnlyClient creates a new read-only client. This client can be used to fetch objects but cannot write updates.\n\n```go\nfunc SignAndUpdate(ctx context.Context, c *Client, obj APIObject, signer sigstore.Signer) error\n```\nSignAndUpdate 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.\n\n```go\nfunc Update(ctx context.Context, c *Client, obj APIObject) error\n```\nUpdate creates/updates the given apiObject in the public Constellation API.\n\n## Types\n\n```go\ntype APIObject interface {\n\tValidateRequest() error\n\tValidate() error\n\tJSONPath() string\n}\n```\nAPIObject is an object that is used to perform CRUD operations on the API.\n\n```go\ntype Client struct {\n\tDryRun bool // no write operations are performed\n\t// contains filtered or unexported fields\n}\n```\nClient is the a general client for all APIs.\n\n```go\nfunc (c *Client) Close(ctx context.Context) error\n```\nClose closes the client. It invalidates the CDN cache for all uploaded files.\n\n```go\nfunc (c *Client) DeletePath(ctx context.Context, path string) error\n```\nDeletePath deletes all objects at a given path from a s3 bucket.\n\n```go\ntype CloseFunc func(ctx context.Context) error\n```\nCloseFunc is a function that closes the client.\n\n```go\ntype NotFoundError struct {\n\t// contains filtered or unexported fields\n}\n```\nNotFoundError is an error that is returned when a resource is not found.\n\n```go\nfunc (e *NotFoundError) Error() string\n```\n\n```go\nfunc (e *NotFoundError) Unwrap() error\n```\n\n","path":"github.com/flashbots/cvm-reverse-proxy/internal/api/client","name":"client","synopsis":"Package client provides a client for the versions API.","isRedistributable":true}
