client

package
v0.0.0-...-a99519a Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2025 Accelerated Cloud Storage Corporation. All Rights Reserved. Package client provides a Go client for interacting with the Accelerated Cloud Storage service.

Copyright 2025 Accelerated Cloud Storage Corporation. All Rights Reserved. Package client provides a Go client for interacting with the Accelerated Cloud Storage service.

Copyright 2025 Accelerated Cloud Storage Corporation. All Rights Reserved. Package client provides a Go client for interacting with the Accelerated Cloud Storage service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACSClient

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

ACSClient wraps the gRPC connection and client for ObjectStorageCache. It provides high-level operations for interacting with the ACS service.

func NewClient

func NewClient() (*ACSClient, error)

NewClient initializes a new gRPC client with authentication. It establishes a secure connection to the ACS service, loads credentials, and performs initial authentication. It also checks for key rotation needs. Returns an error if connection, authentication, or credential loading fails.

func (*ACSClient) Close

func (client *ACSClient) Close() error

Close terminates the client connection. It should be called when the client is no longer needed to free resources.

func (*ACSClient) CopyObject

func (client *ACSClient) CopyObject(ctx context.Context, bucket, copySource, key string) error

CopyObject copies an object from a source bucket/key to a destination bucket/key. Returns an error if the copy operation fails.

func (*ACSClient) CreateBucket

func (client *ACSClient) CreateBucket(ctx context.Context, bucket, region string) error

CreateBucket sends a request to create a new bucket. It requires a bucket name and region specification. Returns an error if the bucket creation fails.

func (*ACSClient) DeleteBucket

func (client *ACSClient) DeleteBucket(ctx context.Context, bucket string) error

DeleteBucket requests deletion of the specified bucket. Returns an error if the bucket deletion fails or the bucket doesn't exist.

func (*ACSClient) DeleteObject

func (client *ACSClient) DeleteObject(ctx context.Context, bucket, key string) error

DeleteObject removes a single object from a bucket. Returns an error if the deletion fails.

func (*ACSClient) DeleteObjects

func (client *ACSClient) DeleteObjects(bucket string, keys []string) error

DeleteObjects requests bulk deletion of objects in a bucket. Returns an error if any object deletion fails.

func (*ACSClient) GetObject

func (client *ACSClient) GetObject(ctx context.Context, bucket, key string) ([]byte, error)

GetObject downloads the specified object from the server. Returns the object's data and an error if the download fails.

func (*ACSClient) HeadBucket

func (client *ACSClient) HeadBucket(ctx context.Context, bucket string) (*HeadBucketOutput, error)

HeadBucket retrieves metadata for a specific bucket. Returns the bucket's metadata and an error if the operation fails.

func (*ACSClient) HeadObject

func (client *ACSClient) HeadObject(ctx context.Context, bucket, key string) (*HeadObjectOutput, error)

HeadObject retrieves metadata for a specific object. Returns the object's metadata and an error if the operation fails.

func (*ACSClient) ListBuckets

func (client *ACSClient) ListBuckets(ctx context.Context) ([]*pb.Bucket, error)

ListBuckets retrieves all buckets from the server. Returns a list of bucket objects and an error if the operation fails.

func (*ACSClient) ListObjects

func (client *ACSClient) ListObjects(ctx context.Context, bucket string, opts *ListObjectsOptions) ([]string, error)

ListObjects retrieves object keys from the server based on given options. Returns a list of object keys and an error if the operation fails.

func (*ACSClient) PutObject

func (client *ACSClient) PutObject(ctx context.Context, bucket, key string, data []byte) error

PutObject uploads data to the specified bucket and key. It automatically handles compression for large objects when beneficial. Returns an error if the upload fails.

func (*ACSClient) RotateKey

func (client *ACSClient) RotateKey(ctx context.Context, force bool) error

RotateKey checks if key rotation is needed and performs it if necessary. The force parameter can be used to require rotation regardless of timing. Returns an error if the rotation fails.

func (*ACSClient) ShareBucket

func (client *ACSClient) ShareBucket(ctx context.Context, bucket string) error

ShareBucket informs the service about a bucket that has been shared with it. Returns an error if the sharing operation fails or permissions are insufficient.

type HeadBucketOutput

type HeadBucketOutput struct {
	Region string // The region where the bucket is located
}

HeadBucketOutput represents the metadata returned by HeadBucket operation. It contains information about a bucket's configuration and status.

type HeadObjectOutput

type HeadObjectOutput struct {
	ContentType          string            // MIME type of the object
	ContentEncoding      string            // Encoding of the object content
	ContentLanguage      string            // Language the object content is in
	ContentLength        int64             // Size of the object in bytes
	LastModified         time.Time         // Last modification timestamp
	ETag                 string            // Entity tag for the object
	UserMetadata         map[string]string // User-defined metadata key-value pairs
	ServerSideEncryption string            // Type of server-side encryption used
	VersionId            string            // Version identifier for the object
}

HeadObjectOutput represents the metadata returned by HeadObject operation. It contains detailed information about an object's properties and metadata.

type ListObjectsOptions

type ListObjectsOptions struct {
	Prefix     string // Filter objects by prefix
	StartAfter string // Return objects lexicographically after this value
	MaxKeys    int32  // Maximum number of keys to return
}

ListObjectsOptions holds optional parameters for object listing. These options allow for customizing the object listing operation.

Jump to

Keyboard shortcuts

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