cloud_storage

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const Domain = "storage.googleapis.com"
View Source
const MaxSignedUrlExpires = 7 * 24 * time.Hour

MaxSignedUrlExpires is the upper bound on V4 signed URL lifetime enforced by GCS.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(options ...cloud_storage_config.Option) *Client

func (*Client) DeleteObject

func (c *Client) DeleteObject(ctx context.Context, bucketName string, objectName string, options ...fetch_config.Option) error

DeleteObject deletes an object from a bucket.

func (*Client) DownloadObject

func (c *Client) DownloadObject(ctx context.Context, bucketName string, objectName string, options ...fetch_config.Option) ([]byte, error)

DownloadObject downloads an object's content.

func (*Client) GetObject

func (c *Client) GetObject(ctx context.Context, bucketName string, objectName string, options ...fetch_config.Option) (*object.Object, error)

GetObject retrieves an object's metadata.

func (*Client) InsertBucket

func (c *Client) InsertBucket(ctx context.Context, project string, bucketConfig *bucket.Bucket, options ...fetch_config.Option) (*bucket.Bucket, error)

InsertBucket creates a new bucket in the specified project.

func (*Client) InsertObject

func (c *Client) InsertObject(ctx context.Context, bucketName string, metadata *object.Object, data []byte, contentType string, options ...fetch_config.Option) (*object.Object, error)

InsertObject uploads an object to a bucket using a multipart upload. The metadata should have at least its Name field set. The data parameter contains the object content, and contentType specifies its MIME type.

func (*Client) ListObjects

func (c *Client) ListObjects(ctx context.Context, bucketName string, query url.Values, options ...fetch_config.Option) (*object_list.ObjectList, error)

ListObjects lists objects in a bucket. Use the query parameter to specify prefix, delimiter, maxResults, pageToken, and other query parameters.

func (*Client) PatchBucket

func (c *Client) PatchBucket(ctx context.Context, bucketName string, bucketConfig *bucket.Bucket, options ...fetch_config.Option) (*bucket.Bucket, error)

PatchBucket updates an existing bucket using patch semantics.

func (*Client) PatchObject

func (c *Client) PatchObject(ctx context.Context, bucketName string, objectName string, objectConfig *object.Object, options ...fetch_config.Option) (*object.Object, error)

PatchObject updates an object's metadata using patch semantics.

func (*Client) SignedUrl

func (c *Client) SignedUrl(
	ctx context.Context,
	s signer.Signer,
	method string,
	bucketName string,
	objectName string,
	expires time.Duration,
) (string, error)

SignedUrl returns a V4 signed URL for the given object. The URL grants temporary access to perform the given HTTP method against the object, valid for the given duration (capped at 7 days by GCS). The signer's identity is embedded in the URL — the runtime must be able to sign on behalf of that identity (e.g. an in-process RSA key, or via IAM Credentials' signBlob).

Only the host header is signed; payloads are sent as UNSIGNED-PAYLOAD, so the resulting URL works with any request body content.

Jump to

Keyboard shortcuts

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