Documentation
¶
Overview ¶
Package cloud lets privconvert convert files in Amazon S3 (and S3-compatible storage such as Backblaze B2 or Cloudflare R2), Google Cloud Storage and Azure Blob Storage:
store := cloud.New(cloud.Options{})
defer store.Close()
res, err := pc.ConvertStorage(ctx, store, "word-to-pdf",
"s3://my-bucket/input.docx", "s3://my-bucket/output.pdf", nil)
Each cloud's standard sign-in is used unless you pass your own client: the AWS default chain (environment, shared config, IAM role), Google Application Default Credentials, and for Azure AZURE_STORAGE_CONNECTION_STRING or DefaultAzureCredential. Clients are created on first use, so only the clouds you touch need credentials.
Index ¶
- type Options
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Exists(ctx context.Context, loc privconvert.Location) (bool, error)
- func (s *Storage) Read(ctx context.Context, loc privconvert.Location) ([]byte, error)
- func (s *Storage) Write(ctx context.Context, loc privconvert.Location, data []byte, contentType string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// S3Client is used for s3:// locations. For Backblaze B2 or Cloudflare R2,
// create it with that provider's endpoint (s3.Options.BaseEndpoint).
S3Client *s3.Client
// GCSClient is used for gs:// locations.
GCSClient *storage.Client
// AzureClient is used for Azure locations. Its account must match the
// account in the location.
AzureClient *azblob.Client
// S3PutObject adjusts the upload of a converted file, e.g. to set
// ServerSideEncryption.
S3PutObject func(*s3.PutObjectInput)
// GCSWriter adjusts the upload of a converted file, e.g. to set Metadata.
GCSWriter func(*storage.Writer)
// AzureUpload adjusts the upload of a converted file, e.g. to set AccessTier.
AzureUpload func(*azblob.UploadBufferOptions)
}
Options sets the clients and upload settings. Every field is optional.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage implements privconvert.Storage for all supported clouds. It is safe for concurrent use.
func (*Storage) Close ¶
Close releases the Google Cloud Storage client this Storage created, if any.