Documentation
¶
Index ¶
- type AWSCloudStorage
- func (ts *AWSCloudStorage) Attributes(ctx context.Context, key string) (*Attributes, error)
- func (ts *AWSCloudStorage) Close()
- func (ts *AWSCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
- func (ts *AWSCloudStorage) CreateBucket(ctx context.Context, bucketPrefix string, expirationTimeDays int64) error
- func (ts *AWSCloudStorage) Delete(ctx context.Context, key string) error
- func (ts *AWSCloudStorage) Exists(ctx context.Context, key string) (bool, error)
- func (ts *AWSCloudStorage) Get(ctx context.Context, key string) ([]byte, error)
- func (ts *AWSCloudStorage) GetRangeReader(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (ts *AWSCloudStorage) GetReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (ts *AWSCloudStorage) GetSignedURL(ctx context.Context, key string, opts *SignedURLOption) (string, error)
- func (ts *AWSCloudStorage) GetWriter(ctx context.Context, key string) (io.WriteCloser, error)
- func (ts *AWSCloudStorage) List(ctx context.Context, prefix string) *ListIterator
- func (ts *AWSCloudStorage) ListWithOptions(ctx context.Context, listOptions *ListOptions) *ListIterator
- func (ts *AWSCloudStorage) Write(ctx context.Context, key string, body []byte, contentType *string) error
- type AWSTestCloudStorage
- func (ts *AWSTestCloudStorage) Attributes(ctx context.Context, key string) (*Attributes, error)
- func (ts *AWSTestCloudStorage) Close()
- func (ts *AWSTestCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
- func (ts *AWSTestCloudStorage) CreateBucket(ctx context.Context, bucketPrefix string, expirationTimeDays int64) error
- func (ts *AWSTestCloudStorage) Delete(ctx context.Context, key string) error
- func (ts *AWSTestCloudStorage) Exists(ctx context.Context, key string) (bool, error)
- func (ts *AWSTestCloudStorage) Get(ctx context.Context, key string) ([]byte, error)
- func (ts *AWSTestCloudStorage) GetRangeReader(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (ts *AWSTestCloudStorage) GetReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (ts *AWSTestCloudStorage) GetSignedURL(ctx context.Context, key string, opts *SignedURLOption) (string, error)
- func (ts *AWSTestCloudStorage) GetWriter(ctx context.Context, key string) (io.WriteCloser, error)
- func (ts *AWSTestCloudStorage) List(ctx context.Context, prefix string) *ListIterator
- func (ts *AWSTestCloudStorage) ListWithOptions(ctx context.Context, listOptions *ListOptions) *ListIterator
- func (ts *AWSTestCloudStorage) Write(ctx context.Context, key string, body []byte, contentType *string) error
- type Attributes
- type CloudStorage
- type CloudStorageOption
- type ExplicitGCPCloudStorage
- func (ts *ExplicitGCPCloudStorage) Attributes(ctx context.Context, key string) (*Attributes, error)
- func (ts *ExplicitGCPCloudStorage) Close()
- func (ts *ExplicitGCPCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
- func (ts *ExplicitGCPCloudStorage) CreateBucket(ctx context.Context, bucketPrefix string, expirationTimeDays int64) error
- func (ts *ExplicitGCPCloudStorage) Delete(ctx context.Context, key string) error
- func (ts *ExplicitGCPCloudStorage) Exists(ctx context.Context, key string) (bool, error)
- func (ts *ExplicitGCPCloudStorage) Get(ctx context.Context, key string) ([]byte, error)
- func (ts *ExplicitGCPCloudStorage) GetRangeReader(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (ts *ExplicitGCPCloudStorage) GetReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (ts *ExplicitGCPCloudStorage) GetSignedURL(ctx context.Context, key string, opts *SignedURLOption) (string, error)
- func (ts *ExplicitGCPCloudStorage) GetWriter(ctx context.Context, key string) (io.WriteCloser, error)
- func (ts *ExplicitGCPCloudStorage) List(ctx context.Context, prefix string) *ListIterator
- func (ts *ExplicitGCPCloudStorage) ListWithOptions(ctx context.Context, listOptions *ListOptions) *ListIterator
- func (ts *ExplicitGCPCloudStorage) Write(ctx context.Context, key string, body []byte, contentType *string) error
- type GCPTestCloudStorage
- func (ts *GCPTestCloudStorage) Attributes(ctx context.Context, key string) (*Attributes, error)
- func (ts *GCPTestCloudStorage) Close()
- func (ts *GCPTestCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
- func (ts *GCPTestCloudStorage) CreateBucket(ctx context.Context, bucketPrefix string, expirationTimeDays int64) error
- func (ts *GCPTestCloudStorage) Delete(ctx context.Context, key string) error
- func (ts *GCPTestCloudStorage) Exists(ctx context.Context, key string) (bool, error)
- func (ts *GCPTestCloudStorage) Get(ctx context.Context, key string) ([]byte, error)
- func (ts *GCPTestCloudStorage) GetRangeReader(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (ts *GCPTestCloudStorage) GetReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (ts *GCPTestCloudStorage) GetSignedURL(ctx context.Context, key string, opts *SignedURLOption) (string, error)
- func (ts *GCPTestCloudStorage) GetWriter(ctx context.Context, key string) (io.WriteCloser, error)
- func (ts *GCPTestCloudStorage) List(ctx context.Context, prefix string) *ListIterator
- func (ts *GCPTestCloudStorage) ListWithOptions(ctx context.Context, listOptions *ListOptions) *ListIterator
- func (ts *GCPTestCloudStorage) Write(ctx context.Context, key string, body []byte, contentType *string) error
- type ImplicitGCPCloudStorage
- func (ts *ImplicitGCPCloudStorage) Attributes(ctx context.Context, key string) (*Attributes, error)
- func (ts *ImplicitGCPCloudStorage) Close()
- func (ts *ImplicitGCPCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
- func (ts *ImplicitGCPCloudStorage) CreateBucket(ctx context.Context, bucketPrefix string, expirationTimeDays int64) error
- func (ts *ImplicitGCPCloudStorage) Delete(ctx context.Context, key string) error
- func (ts *ImplicitGCPCloudStorage) Exists(ctx context.Context, key string) (bool, error)
- func (ts *ImplicitGCPCloudStorage) Get(ctx context.Context, key string) ([]byte, error)
- func (ts *ImplicitGCPCloudStorage) GetRangeReader(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (ts *ImplicitGCPCloudStorage) GetReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (ts *ImplicitGCPCloudStorage) GetSignedURL(ctx context.Context, key string, opts *SignedURLOption) (string, error)
- func (ts *ImplicitGCPCloudStorage) GetWriter(ctx context.Context, key string) (io.WriteCloser, error)
- func (ts *ImplicitGCPCloudStorage) List(ctx context.Context, prefix string) *ListIterator
- func (ts *ImplicitGCPCloudStorage) ListWithOptions(ctx context.Context, listOptions *ListOptions) *ListIterator
- func (ts *ImplicitGCPCloudStorage) Write(ctx context.Context, key string, body []byte, contentType *string) error
- type ListIterator
- type ListObject
- type ListOptions
- type SignedURLOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSCloudStorage ¶
type AWSCloudStorage struct {
// contains filtered or unexported fields
}
func (*AWSCloudStorage) Attributes ¶
func (ts *AWSCloudStorage) Attributes( ctx context.Context, key string, ) (*Attributes, error)
func (*AWSCloudStorage) Close ¶
func (ts *AWSCloudStorage) Close()
func (*AWSCloudStorage) Copy ¶ added in v0.9.0
func (ts *AWSCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
func (*AWSCloudStorage) CreateBucket ¶
func (*AWSCloudStorage) Delete ¶
func (ts *AWSCloudStorage) Delete( ctx context.Context, key string, ) error
func (*AWSCloudStorage) GetRangeReader ¶ added in v0.1.0
func (ts *AWSCloudStorage) GetRangeReader( ctx context.Context, key string, offset, length int64, ) (io.ReadCloser, error)
func (*AWSCloudStorage) GetReader ¶ added in v0.0.3
func (ts *AWSCloudStorage) GetReader( ctx context.Context, key string, ) (io.ReadCloser, error)
func (*AWSCloudStorage) GetSignedURL ¶
func (ts *AWSCloudStorage) GetSignedURL( ctx context.Context, key string, opts *SignedURLOption, ) (string, error)
func (*AWSCloudStorage) GetWriter ¶ added in v0.0.3
func (ts *AWSCloudStorage) GetWriter( ctx context.Context, key string, ) (io.WriteCloser, error)
func (*AWSCloudStorage) List ¶
func (ts *AWSCloudStorage) List( ctx context.Context, prefix string, ) *ListIterator
func (*AWSCloudStorage) ListWithOptions ¶ added in v0.6.0
func (ts *AWSCloudStorage) ListWithOptions( ctx context.Context, listOptions *ListOptions, ) *ListIterator
type AWSTestCloudStorage ¶
type AWSTestCloudStorage struct {
// contains filtered or unexported fields
}
func (*AWSTestCloudStorage) Attributes ¶
func (ts *AWSTestCloudStorage) Attributes( ctx context.Context, key string, ) (*Attributes, error)
func (*AWSTestCloudStorage) Close ¶
func (ts *AWSTestCloudStorage) Close()
func (*AWSTestCloudStorage) Copy ¶ added in v0.9.0
func (ts *AWSTestCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
func (*AWSTestCloudStorage) CreateBucket ¶
func (*AWSTestCloudStorage) Delete ¶
func (ts *AWSTestCloudStorage) Delete( ctx context.Context, key string, ) error
func (*AWSTestCloudStorage) GetRangeReader ¶ added in v0.1.0
func (ts *AWSTestCloudStorage) GetRangeReader( ctx context.Context, key string, offset, length int64, ) (io.ReadCloser, error)
func (*AWSTestCloudStorage) GetReader ¶ added in v0.0.3
func (ts *AWSTestCloudStorage) GetReader( ctx context.Context, key string, ) (io.ReadCloser, error)
func (*AWSTestCloudStorage) GetSignedURL ¶
func (ts *AWSTestCloudStorage) GetSignedURL( ctx context.Context, key string, opts *SignedURLOption, ) (string, error)
func (*AWSTestCloudStorage) GetWriter ¶ added in v0.0.3
func (ts *AWSTestCloudStorage) GetWriter( ctx context.Context, key string, ) (io.WriteCloser, error)
func (*AWSTestCloudStorage) List ¶
func (ts *AWSTestCloudStorage) List( ctx context.Context, prefix string, ) *ListIterator
func (*AWSTestCloudStorage) ListWithOptions ¶ added in v0.6.0
func (ts *AWSTestCloudStorage) ListWithOptions( ctx context.Context, listOptions *ListOptions, ) *ListIterator
type Attributes ¶
type Attributes struct { // CacheControl specifies caching attributes that services may use // when serving the blob. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control CacheControl string // ContentDisposition specifies whether the blob content is expected to be // displayed inline or as an attachment. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition ContentDisposition string // ContentEncoding specifies the encoding used for the blob's content, if any. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding ContentEncoding string // ContentLanguage specifies the language used in the blob's content, if any. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language ContentLanguage string // ContentType is the MIME type of the blob. It will not be empty. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type ContentType string // Metadata holds key/value pairs associated with the blob. // Keys are guaranteed to be in lowercase, even if the backend service // has case-sensitive keys (although note that Metadata written via // this package will always be lowercased). If there are duplicate // case-insensitive keys (e.g., "foo" and "FOO"), only one value // will be kept, and it is undefined which one. Metadata map[string]string // ModTime is the time the blob was last modified. ModTime time.Time // Size is the size of the blob's content in bytes. Size int64 // MD5 is an MD5 hash of the blob contents or nil if not available. MD5 []byte }
Attributes contains attributes about a blob.
type CloudStorage ¶
type CloudStorage interface { List(ctx context.Context, prefix string) *ListIterator ListWithOptions(ctx context.Context, options *ListOptions) *ListIterator Get(ctx context.Context, key string) ([]byte, error) Delete(ctx context.Context, key string) error CreateBucket(ctx context.Context, bucketPrefix string, expirationTimeDays int64) error Close() GetSignedURL(ctx context.Context, key string, opts *SignedURLOption) (string, error) Write(ctx context.Context, key string, body []byte, contentType *string) error Attributes(ctx context.Context, key string) (*Attributes, error) GetReader(ctx context.Context, key string) (io.ReadCloser, error) GetRangeReader(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error) GetWriter(ctx context.Context, key string) (io.WriteCloser, error) Exists(ctx context.Context, key string) (bool, error) Copy(ctx context.Context, dstKey, srcKey string) error }
func NewCloudStorage ¶
func NewCloudStorageWithOption ¶ added in v0.4.0
func NewCloudStorageWithOption(ctx context.Context, isTesting bool, bucketProvider, bucketName string, cloudStorageOpts CloudStorageOption) (CloudStorage, error)
type CloudStorageOption ¶ added in v0.4.0
type CloudStorageOption struct { AWSS3Endpoint string AWSS3Region string AWSS3AccessKeyID string AWSS3SecretAccessKey string AWSEnableS3Accelerate bool // AWSTokenDuration is the duration of the STS token will be valid. If not set, the assumed role will use default // expiry duration. See https://docs.aws.amazon.com/sdk-for-go/api/service/sts/#STS.AssumeRoleWithWebIdentity // for more information. // // Important notes: the value MUST BE no more than the maximum session duration of the AWS role. // If unset, it will use the default maximum session duration of the AWS role. AWSTokenDuration time.Duration // The amount of time the token will be refreshed before they expire. It's important to refresh token before they // expire to reduce risk of using expired token. The refresh token is not done periodically in the background, // instead will be triggered by any operation using AWS session. // If unset, will default to no expiry window. AWSTokenExpiryWindow time.Duration GCPCredentialsJSON string GCPStorageEmulatorHost string }
type ExplicitGCPCloudStorage ¶ added in v0.0.5
type ExplicitGCPCloudStorage struct {
// contains filtered or unexported fields
}
func (*ExplicitGCPCloudStorage) Attributes ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) Attributes( ctx context.Context, key string, ) (*Attributes, error)
func (*ExplicitGCPCloudStorage) Close ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) Close()
func (*ExplicitGCPCloudStorage) Copy ¶ added in v0.9.0
func (ts *ExplicitGCPCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
func (*ExplicitGCPCloudStorage) CreateBucket ¶ added in v0.0.5
func (*ExplicitGCPCloudStorage) Delete ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) Delete( ctx context.Context, key string, ) error
func (*ExplicitGCPCloudStorage) GetRangeReader ¶ added in v0.1.0
func (ts *ExplicitGCPCloudStorage) GetRangeReader( ctx context.Context, key string, offset, length int64, ) (io.ReadCloser, error)
func (*ExplicitGCPCloudStorage) GetReader ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) GetReader( ctx context.Context, key string, ) (io.ReadCloser, error)
func (*ExplicitGCPCloudStorage) GetSignedURL ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) GetSignedURL( ctx context.Context, key string, opts *SignedURLOption, ) (string, error)
func (*ExplicitGCPCloudStorage) GetWriter ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) GetWriter( ctx context.Context, key string, ) (io.WriteCloser, error)
func (*ExplicitGCPCloudStorage) List ¶ added in v0.0.5
func (ts *ExplicitGCPCloudStorage) List( ctx context.Context, prefix string, ) *ListIterator
func (*ExplicitGCPCloudStorage) ListWithOptions ¶ added in v0.6.0
func (ts *ExplicitGCPCloudStorage) ListWithOptions( ctx context.Context, listOptions *ListOptions, ) *ListIterator
type GCPTestCloudStorage ¶
type GCPTestCloudStorage struct {
// contains filtered or unexported fields
}
func (*GCPTestCloudStorage) Attributes ¶
func (ts *GCPTestCloudStorage) Attributes( ctx context.Context, key string, ) (*Attributes, error)
func (*GCPTestCloudStorage) Close ¶
func (ts *GCPTestCloudStorage) Close()
func (*GCPTestCloudStorage) Copy ¶ added in v0.9.0
func (ts *GCPTestCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
func (*GCPTestCloudStorage) CreateBucket ¶
func (*GCPTestCloudStorage) Delete ¶
func (ts *GCPTestCloudStorage) Delete( ctx context.Context, key string, ) error
func (*GCPTestCloudStorage) GetRangeReader ¶ added in v0.1.0
func (ts *GCPTestCloudStorage) GetRangeReader( ctx context.Context, key string, offset, length int64, ) (io.ReadCloser, error)
func (*GCPTestCloudStorage) GetReader ¶ added in v0.0.3
func (ts *GCPTestCloudStorage) GetReader( ctx context.Context, key string, ) (io.ReadCloser, error)
func (*GCPTestCloudStorage) GetSignedURL ¶
func (ts *GCPTestCloudStorage) GetSignedURL( ctx context.Context, key string, opts *SignedURLOption, ) (string, error)
func (*GCPTestCloudStorage) GetWriter ¶ added in v0.0.3
func (ts *GCPTestCloudStorage) GetWriter( ctx context.Context, key string, ) (io.WriteCloser, error)
func (*GCPTestCloudStorage) List ¶
func (ts *GCPTestCloudStorage) List( ctx context.Context, prefix string, ) *ListIterator
func (*GCPTestCloudStorage) ListWithOptions ¶ added in v0.6.0
func (ts *GCPTestCloudStorage) ListWithOptions( ctx context.Context, listOptions *ListOptions, ) *ListIterator
type ImplicitGCPCloudStorage ¶ added in v0.0.5
type ImplicitGCPCloudStorage struct {
// contains filtered or unexported fields
}
func (*ImplicitGCPCloudStorage) Attributes ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) Attributes( ctx context.Context, key string, ) (*Attributes, error)
func (*ImplicitGCPCloudStorage) Close ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) Close()
func (*ImplicitGCPCloudStorage) Copy ¶ added in v0.9.0
func (ts *ImplicitGCPCloudStorage) Copy(ctx context.Context, dstKey, srcKey string) error
func (*ImplicitGCPCloudStorage) CreateBucket ¶ added in v0.0.5
func (*ImplicitGCPCloudStorage) Delete ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) Delete( ctx context.Context, key string, ) error
func (*ImplicitGCPCloudStorage) GetRangeReader ¶ added in v0.1.0
func (ts *ImplicitGCPCloudStorage) GetRangeReader( ctx context.Context, key string, offset, length int64, ) (io.ReadCloser, error)
func (*ImplicitGCPCloudStorage) GetReader ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) GetReader( ctx context.Context, key string, ) (io.ReadCloser, error)
func (*ImplicitGCPCloudStorage) GetSignedURL ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) GetSignedURL( ctx context.Context, key string, opts *SignedURLOption, ) (string, error)
func (*ImplicitGCPCloudStorage) GetWriter ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) GetWriter( ctx context.Context, key string, ) (io.WriteCloser, error)
func (*ImplicitGCPCloudStorage) List ¶ added in v0.0.5
func (ts *ImplicitGCPCloudStorage) List( ctx context.Context, prefix string, ) *ListIterator
func (*ImplicitGCPCloudStorage) ListWithOptions ¶ added in v0.6.0
func (ts *ImplicitGCPCloudStorage) ListWithOptions( ctx context.Context, listOptions *ListOptions, ) *ListIterator
type ListIterator ¶
type ListIterator struct {
// contains filtered or unexported fields
}
ListIterator iterates over List results.
func (*ListIterator) Next ¶
func (i *ListIterator) Next(ctx context.Context) (*ListObject, error)
type ListObject ¶
type ListObject struct { // Key is the key for this blob. Key string // ModTime is the time the blob was last modified. ModTime time.Time // Size is the size of the blob's content in bytes. Size int64 // MD5 is an MD5 hash of the blob contents or nil if not available. MD5 []byte // IsDir indicates that this result represents a "directory" in the // hierarchical namespace, ending in ListOptions.Delimiter. Key can be // passed as ListOptions.Prefix to list items in the "directory". // Fields other than Key and IsDir will not be set if IsDir is true. IsDir bool }
ListObject represents a single blob returned from List.
type ListOptions ¶ added in v0.6.0
type ListOptions struct { // Prefix indicates that only blobs with a key starting with this prefix // should be returned. Prefix string // Delimiter sets the delimiter used to define a hierarchical namespace, // like a filesystem with "directories". It is highly recommended that you // use "" or "/" as the Delimiter. Other values should work through this API, // but service UIs generally assume "/". // // An empty delimiter means that the bucket is treated as a single flat // namespace. // // A non-empty delimiter means that any result with the delimiter in its key // after Prefix is stripped will be returned with ListObject.IsDir = true, // ListObject.Key truncated after the delimiter, and zero values for other // ListObject fields. These results represent "directories". Multiple results // in a "directory" are returned as a single result. Delimiter string }
ListOptions sets options for listing blobs.
Click to show internal directories.
Click to hide internal directories.