Documentation
¶
Overview ¶
Example (BucketManagementWorkflow) ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Create a new bucket
info, err := client.CreateBucket(ctx, "my-new-bucket",
simplestorage.WithEnableSnapshot(),
)
if err != nil {
log.Fatal(err) // handle the error here
}
// Create a snapshot
snapshot, err := client.CreateBucketSnapshot(ctx, "my-new-bucket", "Initial state")
if err != nil {
log.Fatal(err) // handle the error here
}
// Fork from the snapshot
forkInfo, err := client.ForkBucket(ctx, "my-new-bucket", "my-forked-bucket",
simplestorage.WithSnapshotVersion(snapshot.Version),
)
if err != nil {
log.Fatal(err) // handle the error here
}
_ = forkInfo // Use the fork info
// Get bucket info
info, err = client.GetBucketInfo(ctx, "my-forked-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Forked bucket info: %+v\n", info)
// Clean up - delete both buckets
// Note: Buckets must be empty before they can be deleted
err = client.DeleteBucket(ctx, "my-forked-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
err = client.DeleteBucket(ctx, "my-new-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
}
Output:
Index ¶
- Variables
- type BucketInfo
- type BucketList
- type BucketOption
- type BucketOptions
- type Client
- func (c *Client) CreateBucket(ctx context.Context, bucket string, opts ...BucketOption) (*BucketInfo, error)
- func (c *Client) CreateBucketSnapshot(ctx context.Context, bucket, description string, opts ...BucketOption) (*SnapshotInfo, error)
- func (c *Client) Delete(ctx context.Context, key string, opts ...ClientOption) error
- func (c *Client) DeleteBucket(ctx context.Context, bucket string, opts ...BucketOption) error
- func (c *Client) For(bucket string) *Client
- func (c *Client) ForkBucket(ctx context.Context, source, target string, opts ...BucketOption) (*BucketInfo, error)
- func (c *Client) Get(ctx context.Context, key string, opts ...ClientOption) (*Object, error)
- func (c *Client) GetBucketInfo(ctx context.Context, bucket string, opts ...BucketOption) (*BucketInfo, error)
- func (c *Client) Head(ctx context.Context, key string, opts ...ClientOption) (*Object, error)
- func (c *Client) List(ctx context.Context, opts ...ClientOption) (*ListResult, error)
- func (c *Client) ListBucketSnapshots(ctx context.Context, bucket string, opts ...BucketOption) (*SnapshotList, error)
- func (c *Client) ListBuckets(ctx context.Context, opts ...BucketOption) (*BucketList, error)
- func (c *Client) PresignURL(ctx context.Context, method string, key string, expiry time.Duration, ...) (string, error)
- func (c *Client) Put(ctx context.Context, obj *Object, opts ...ClientOption) (*Object, error)
- type ClientOption
- func OverrideBucket(bucket string) ClientOption
- func WithContentDisposition(disposition string) ClientOption
- func WithContentType(contentType string) ClientOption
- func WithDelimiter(delimiter string) ClientOption
- func WithMaxKeys(maxKeys int32) ClientOption
- func WithPaginationToken(token string) ClientOption
- func WithPrefix(prefix string) ClientOption
- func WithS3Options(opts ...func(*s3.Options)) ClientOption
- func WithStartAfter(startAfter string) ClientOption
- type ClientOptions
- type ListResult
- type Object
- type Option
- type Options
- type SnapshotInfo
- type SnapshotList
Examples ¶
- Package (BucketManagementWorkflow)
- Client.CreateBucket
- Client.CreateBucket (Snapshot)
- Client.CreateBucketSnapshot
- Client.DeleteBucket
- Client.ForkBucket
- Client.GetBucketInfo
- Client.ListBucketSnapshots
- Client.ListBuckets
- Client.PresignURL (Delete)
- Client.PresignURL (Get)
- Client.PresignURL (Put)
- WithBucketRegion
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBucketNameRequired is returned when a bucket name is required but not provided. ErrBucketNameRequired = errors.New("simplestorage: bucket name required for bucket management operations") // ErrBucketNotFound is returned when a bucket operation fails because the bucket doesn't exist. ErrBucketNotFound = errors.New("simplestorage: bucket not found") // ErrBucketNotEmpty is returned when trying to delete a non-empty bucket. ErrBucketNotEmpty = errors.New("simplestorage: bucket not empty") // ErrSnapshotRequired is returned when a snapshot version is required but not provided. ErrSnapshotRequired = errors.New("simplestorage: snapshot version required for this operation") )
var ErrNoBucketName = errors.New("bucket name not set: provide the TIGRIS_STORAGE_BUCKET environment variable or use WithBucket option")
ErrNoBucketName is returned when no bucket name is provided via the TIGRIS_STORAGE_BUCKET environment variable or the WithBucket option.
Functions ¶
This section is empty.
Types ¶
type BucketInfo ¶
type BucketInfo struct {
Name string // Bucket name
Created time.Time // Creation time
// Tigris-specific fields
SnapshotsEnabled bool // True if snapshots are enabled
IsForkParent bool // True if this bucket has forks
SourceBucket string // If this is a fork, the source bucket
SourceSnapshot string // If this is a fork, the snapshot version
}
BucketInfo contains metadata about a bucket.
type BucketList ¶
type BucketList struct {
Buckets []BucketInfo // List of buckets
NextToken string // Pagination token for next page
Truncated bool // True if more results available
}
BucketList contains a paginated list of buckets.
type BucketOption ¶
type BucketOption func(*BucketOptions)
BucketOption is a functional option for bucket management operations.
func WithBucketRegion ¶
func WithBucketRegion(region string) BucketOption
WithBucketRegion sets static replication region for the bucket.
For more information, see the Tigris documentation1.
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Create a bucket with static replication to specific regions
info, err := client.CreateBucket(ctx, "my-multi-region-bucket",
simplestorage.WithBucketRegion("fra"), // Frankfurt, Germany
)
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Created bucket: %s\n", info.Name)
}
Output:
func WithEnableSnapshot ¶
func WithEnableSnapshot() BucketOption
WithEnableSnapshot enables snapshot capability when creating a bucket.
func WithListLimit ¶
func WithListLimit(limit int32) BucketOption
WithListLimit sets the maximum number of buckets to return in ListBuckets.
func WithListToken ¶
func WithListToken(token string) BucketOption
WithListToken sets the continuation token for paginated ListBuckets calls.
func WithSnapshotVersion ¶
func WithSnapshotVersion(version string) BucketOption
WithSnapshotVersion specifies a snapshot version to target. Use this when forking from a specific snapshot version.
type BucketOptions ¶
type BucketOptions struct {
// EnableSnapshot enables snapshot capability on bucket creation.
EnableSnapshot bool
// SnapshotVersion specifies a snapshot version to target (for forking from specific snapshot).
SnapshotVersion string
// Region sets static replication region for the bucket.
// This field is stored for visibility but the actual behavior is configured
// via S3Options (see WithBucketRegion). Keeping the field enables debugging
// and potential future use in bucket info responses.
Region string
// MaxKeys sets the maximum number of results to return in ListBuckets.
MaxKeys *int32
// ContinuationToken is the pagination token for ListBuckets.
ContinuationToken *string
// S3Options are additional S3 options passed through to the underlying client.
S3Options []func(*s3.Options)
}
BucketOptions for bucket-level operations.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a high-level client for Tigris that simplifies common interactions to very high level calls.
func New ¶
New creates a new Client based on the options provided and defaults loaded from the environment.
By default New reads the following environment variables for setting its defaults:
* `TIGRIS_STORAGE_BUCKET`: the name of the bucket for all Tigris operations. If this is not set in the environment or via the WithBucket, New() will return an error containing ErrNoBucketName. * `TIGRIS_STORAGE_ACCESS_KEY_ID`: The access key ID of the Tigris authentication keypair. If this is not set in the environment or via WithAccessKeypair, New() will load configuration via the AWS configuration resolution method. * `TIGRIS_STORAGE_SECRET_ACCESS_KEY`: The secret access key of the Tigris authentication keypair. If this is not set in the environment or via WithAccessKeypair, New() will load configuration via the AWS configuration resolution method.
The returned Client will default to having its operations performed on the specified bucket. If individual calls need to operate against arbitrary buckets, override it with OverrideBucket.
func (*Client) CreateBucket ¶
func (c *Client) CreateBucket(ctx context.Context, bucket string, opts ...BucketOption) (*BucketInfo, error)
CreateBucket creates a new bucket with the given name.
For Tigris-specific features like snapshots, use options like WithEnableSnapshot().
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
// Create a simplestorage client (requires TIGRIS_STORAGE_BUCKET env var or WithBucket option)
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Create a standard bucket
info, err := client.CreateBucket(ctx, "my-new-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Created bucket: %s\n", info.Name)
}
Output:
Example (Snapshot) ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Create a snapshot-enabled bucket (Tigris feature)
info, err := client.CreateBucket(ctx, "my-snapshot-bucket",
simplestorage.WithEnableSnapshot(),
)
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Created bucket with snapshots: %s\n", info.Name)
}
Output:
func (*Client) CreateBucketSnapshot ¶
func (c *Client) CreateBucketSnapshot(ctx context.Context, bucket, description string, opts ...BucketOption) (*SnapshotInfo, error)
CreateBucketSnapshot creates a snapshot with the given description for a bucket.
The bucket must have snapshots enabled (created with WithEnableSnapshot()).
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Create a named snapshot
snapshot, err := client.CreateBucketSnapshot(ctx, "my-bucket", "Backup before migration")
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Created snapshot: %s (version: %s)\n", snapshot.Name, snapshot.Version)
}
Output:
func (*Client) DeleteBucket ¶
DeleteBucket deletes the bucket with the given name.
If the bucket is not empty, returns ErrBucketNotEmpty. The bucket must be manually emptied before deletion.
Example ¶
package main
import (
"context"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Delete a bucket (fails if not empty)
err = client.DeleteBucket(ctx, "my-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
}
Output:
func (*Client) For ¶ added in v0.5.0
For returns a copy of the Client with the bucket set as the default for all operations.
This is useful when you need to work with multiple buckets while reusing the same underlying connection and configuration.
func (*Client) ForkBucket ¶
func (c *Client) ForkBucket(ctx context.Context, source, target string, opts ...BucketOption) (*BucketInfo, error)
ForkBucket creates a fork of the source bucket with the given target name.
Use WithSnapshotVersion() to fork from a specific snapshot version.
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Fork a bucket
forkInfo, err := client.ForkBucket(ctx, "original-bucket", "forked-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Forked bucket: %s (from: %s)\n", forkInfo.Name, forkInfo.SourceBucket)
// Fork from a specific snapshot version
forkInfo, err = client.ForkBucket(ctx, "original-bucket", "forked-bucket-v2",
simplestorage.WithSnapshotVersion("snapshot-version-id"),
)
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Forked from snapshot: %s\n", forkInfo.SourceSnapshot)
}
Output:
func (*Client) GetBucketInfo ¶
func (c *Client) GetBucketInfo(ctx context.Context, bucket string, opts ...BucketOption) (*BucketInfo, error)
GetBucketInfo retrieves metadata about the bucket with the given name.
This includes Tigris-specific information like whether snapshots are enabled and whether the bucket is a fork of another bucket.
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Get bucket information
info, err := client.GetBucketInfo(ctx, "my-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Printf("Snapshots enabled: %v\n", info.SnapshotsEnabled)
fmt.Printf("Is fork parent: %v\n", info.IsForkParent)
fmt.Printf("Source bucket: %s\n", info.SourceBucket)
fmt.Printf("Source snapshot: %s\n", info.SourceSnapshot)
}
Output:
func (*Client) Head ¶ added in v0.4.0
Head retrieves metadata for an object without downloading its content.
func (*Client) List ¶
func (c *Client) List(ctx context.Context, opts ...ClientOption) (*ListResult, error)
List returns a list of objects matching the given criteria.
The returned ListResult contains pagination information; use NextToken with WithPaginationToken() to fetch the next page. HasMore indicates whether additional objects are available.
func (*Client) ListBucketSnapshots ¶
func (c *Client) ListBucketSnapshots(ctx context.Context, bucket string, opts ...BucketOption) (*SnapshotList, error)
ListBucketSnapshots lists all snapshots for the given bucket.
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// List all snapshots for a bucket
snapshots, err := client.ListBucketSnapshots(ctx, "my-bucket")
if err != nil {
log.Fatal(err) // handle the error here
}
for _, snap := range snapshots.Snapshots {
fmt.Printf("Snapshot: %s (version: %s, created: %s)\n", snap.Name, snap.Version, snap.Created)
}
}
Output:
func (*Client) ListBuckets ¶
func (c *Client) ListBuckets(ctx context.Context, opts ...BucketOption) (*BucketList, error)
ListBuckets lists all buckets that the authenticated user has access to.
Use WithListToken() for pagination. Note that WithListLimit() is not supported by the underlying S3 ListBuckets API and is ignored.
Example ¶
package main
import (
"context"
"fmt"
"log"
_ "github.com/joho/godotenv/autoload"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// List all buckets
list, err := client.ListBuckets(ctx)
if err != nil {
log.Fatal(err) // handle the error here
}
for _, bucket := range list.Buckets {
fmt.Printf("Bucket: %s (created: %s)\n", bucket.Name, bucket.Created)
}
// Paginated listing
for {
list, err = client.ListBuckets(ctx,
simplestorage.WithListLimit(50),
simplestorage.WithListToken(list.NextToken),
)
if err != nil {
log.Fatal(err) // handle the error here
}
// Process buckets...
if !list.Truncated {
break
}
}
}
Output:
func (*Client) PresignURL ¶ added in v0.5.0
func (c *Client) PresignURL(ctx context.Context, method string, key string, expiry time.Duration, opts ...ClientOption) (string, error)
PresignURL generates a presigned URL for the specified HTTP method, key, and expiry duration.
The following HTTP methods are supported:
- http.MethodGet: Generate a URL for downloading an object
- http.MethodPut: Generate a URL for uploading an object
- http.MethodDelete: Generate a URL for deleting an object
For PUT operations, use WithContentType() and WithContentDisposition() to set headers.
The expiry duration must be positive; the returned URL will only be valid for this duration.
Example (Delete) ¶
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Generate a 30-minute URL for deletion
url, err := client.PresignURL(ctx, http.MethodDelete, "temp/file.txt", 30*time.Minute)
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Println("Presigned DELETE URL:", url)
}
Output:
Example (Get) ¶
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Generate a 1-hour URL for temporary download access
url, err := client.PresignURL(ctx, http.MethodGet, "documents/report.pdf", time.Hour)
if err != nil {
log.Fatal(err) // handle the error here
}
fmt.Println("Presigned GET URL:", url)
}
Output:
Example (Put) ¶
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
simplestorage "github.com/tigrisdata/storage-go/simplestorage"
)
func main() {
ctx := context.Background()
client, err := simplestorage.New(ctx,
simplestorage.WithBucket("my-default-bucket"),
)
if err != nil {
log.Fatal(err)
}
// Generate a 15-minute URL for direct upload
url, err := client.PresignURL(ctx, http.MethodPut, "uploads/avatar.png", 15*time.Minute,
simplestorage.WithContentType("image/png"),
simplestorage.WithContentDisposition("attachment"),
)
if err != nil {
log.Fatal(err) // handle the error here
}
// Client can now PUT directly to url
fmt.Println("Presigned PUT URL:", url)
}
Output:
type ClientOption ¶
type ClientOption func(*ClientOptions)
ClientOption is a function option that allows callers to override settings in calls to Tigris via Client.
func OverrideBucket ¶
func OverrideBucket(bucket string) ClientOption
OverrideBucket overrides the bucket used for Tigris calls.
func WithContentDisposition ¶ added in v0.5.0
func WithContentDisposition(disposition string) ClientOption
WithContentDisposition sets the Content-Disposition header for presigned PUT URLs.
func WithContentType ¶ added in v0.5.0
func WithContentType(contentType string) ClientOption
WithContentType sets the Content-Type header for presigned PUT URLs.
func WithDelimiter ¶ added in v0.3.0
func WithDelimiter(delimiter string) ClientOption
WithDelimiter sets a delimiter for grouping keys in List calls.
func WithMaxKeys ¶
func WithMaxKeys(maxKeys int32) ClientOption
WithMaxKeys sets the maximum number of keys in List calls. Use this along with WithStartAfter for pagination in your List calls.
func WithPaginationToken ¶ added in v0.3.0
func WithPaginationToken(token string) ClientOption
WithPaginationToken sets the pagination token to continue listing objects.
func WithPrefix ¶ added in v0.3.0
func WithPrefix(prefix string) ClientOption
WithPrefix sets the prefix to filter keys in List calls.
func WithS3Options ¶
func WithS3Options(opts ...func(*s3.Options)) ClientOption
WithS3Options sets S3 options for individual Tigris calls.
func WithStartAfter ¶
func WithStartAfter(startAfter string) ClientOption
WithStartAfter sets the StartAfter setting in List calls. Use this if you need pagination in your List calls.
type ClientOptions ¶
type ClientOptions struct {
BucketName string
S3Options []func(*s3.Options)
// List options
StartAfter *string
MaxKeys *int32
Delimiter *string
Prefix *string
PaginationToken *string
// Presign options
ContentType *string
ContentDisposition *string
}
ClientOptions is the collection of options that are set for individual Tigris calls.
type ListResult ¶ added in v0.3.0
type ListResult struct {
Items []Object // List of objects
NextToken string // Pagination token for the next page
HasMore bool // Whether there are more objects to list
}
ListResult contains the result of a List operation, including pagination information.
type Object ¶
type Object struct {
Bucket string // Bucket the object is in
Key string // Key for the object
ContentType string // MIME type for the object or application/octet-stream
ContentDisposition string // Content disposition of the object (inline or attachment)
Etag string // Entity tag for the object (usually a checksum)
Version string // Version tag for the object
Size int64 // Size of the object in bytes or 0 if unknown
LastModified time.Time // Creation date of the object
Metadata map[string]string // Custom metadata headers
URL string // Public or presigned URL for the object
Body io.ReadCloser // Body of the object so it can be read, don't forget to close it.
}
Object contains metadata about an individual object read from or put into Tigris.
Some calls may not populate all fields. Ensure that the values are valid before consuming them.
type Option ¶
type Option func(o *Options)
Option is a functional option for new client creation.
func WithAccessKeypair ¶
WithAccessKeypair lets you specify a custom access key and secret access key for interfacing with Tigris.
This is useful when you need to load environment variables from somewhere other than the default AWS configuration path.
func WithBucket ¶
WithBucket sets the default bucket for Tigris operations. If this is not set via the `TIGRIS_STORAGE_BUCKET` environment variable or this call, New() will return ErrNoBucketName.
func WithEndpoint ¶
WithEndpoint sets a custom endpoint for connecting to Tigris.
This allows you to connect to a custom Tigris endpoint instead of the default global endpoint. Use this for:
- Using a custom proxy or gateway
- Testing against local development endpoints
For most use cases, consider using WithGlobalEndpoint or WithFlyEndpoint instead.
func WithFlyEndpoint ¶
func WithFlyEndpoint() Option
WithFlyEndpoint lets you connect to Tigris' fly.io optimized endpoint.
If you are deployed to fly.io, this zero-rates your traffic to Tigris.
If you are not deployed to fly.io, please use WithGlobalEndpoint instead.
func WithGlobalEndpoint ¶
func WithGlobalEndpoint() Option
WithGlobalEndpoint lets you connect to Tigris' globally available endpoint.
If you are deployed to fly.io, please use WithFlyEndpoint instead.
func WithPathStyle ¶
WithPathStyle configures whether to use path-style addressing for S3 requests.
By default, Tigris uses virtual-hosted-style addressing (e.g., https://bucket.t3.storage.dev). Path-style addressing (e.g., https://t3.storage.dev/bucket) may be needed for:
- Compatibility with older S3 clients that don't support virtual-hosted-style
- Working through certain proxies or load balancers that don't support virtual-hosted-style
- Local development environments with custom DNS setups
Enable this only if you encounter issues with the default virtual-hosted-style addressing.
func WithRegion ¶
WithRegion lets you statically specify a region for interacting with Tigris.
You will almost certainly never need this. This is here for development usecases where the default region is not "auto".
type Options ¶
type Options struct {
// The bucket to operate against. Defaults to the contents of the environment variable
// `TIGRIS_STORAGE_BUCKET`.
BucketName string
// The access key ID of the Tigris keypair the Client should use. Defaults to the contents
// of the environment variable `TIGRIS_STORAGE_ACCESS_KEY_ID`.
AccessKeyID string
// The access key ID of the Tigris keypair the Client should use. Defaults to the contents
// of the environment variable `TIGRIS_STORAGE_SECRET_ACCESS_KEY`.
SecretAccessKey string
BaseEndpoint string // The Tigris base endpoint the Client should use (defaults to GlobalEndpoint)
Region string // The S3 region the Client should use (defaults to "auto").
UsePathStyle bool // Should the Client use S3 path style resolution? (defaults to false).
}
Options is the set of options for client creation.
These fields are made public so you can implement your own configuration resolution methods.
type SnapshotInfo ¶
type SnapshotInfo struct {
Name string // Snapshot name/description
Version string // Snapshot version ID
Created time.Time // Creation time
Bucket string // Source bucket name
}
SnapshotInfo contains metadata about a bucket snapshot.
type SnapshotList ¶
type SnapshotList struct {
Snapshots []SnapshotInfo // List of snapshots
Bucket string // Source bucket name
}
SnapshotList contains a list of snapshots for a bucket.