Documentation ¶
Overview ¶
Package s3blob provides a blob implementation that uses S3. Use OpenBucket to construct a blob.Bucket.
Open URLs ¶
For blob.Open URLs, s3blob registers for the scheme "s3"; URLs start with "s3://".
The URL's Host is used as the bucket name. The AWS session is created as described in https://docs.aws.amazon.com/sdk-for-go/api/aws/session/. The following query options are supported:
- region: The AWS region for requests; sets aws.Config.Region.
Example URL:
s3://mybucket?region=us-east-1
As ¶
s3blob exposes the following types for As:
- Bucket: *s3.S3
- Error: awserr.Error
- ListObject: s3.Object for objects, s3.CommonPrefix for "directories".
- ListOptions.BeforeList: *s3.ListObjectsV2Input
- Reader: s3.GetObjectOutput
- Attributes: s3.HeadObjectOutput
- WriterOptions.BeforeWrite: *s3manager.UploadInput
Example ¶
package main import ( "context" "github.com/aws/aws-sdk-go/aws/session" "github.com/google/go-cloud/blob/s3blob" ) func main() { ctx := context.Background() // Create an AWS session. // This example uses defaults for finding credentials, which region to use, // etc. // See https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ // for more info on available options. sess, err := session.NewSession() if err != nil { // Handle errror. return } // Create a *blob.Bucket. _, _ = s3blob.OpenBucket(ctx, "my-bucket", sess, nil) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.