Documentation ¶
Overview ¶
package bifrost
provides a rainbow bridge for shipping files to any cloud storage service.
It's like bifrost from marvel comics, but for files.
Index ¶
Constants ¶
View Source
const ( // WasabiCloudStorage is the identifier of the Wasabi Cloud Storage provider WasabiCloudStorage types.Provider = "wasabi" // PinataCloud is the identifier of the Pinata Cloud storage PinataCloud types.Provider = "pinata" // SimpleStorageService is the identifier of the S3 provider SimpleStorageService types.Provider = "s3" // GoogleCloudStorage is the identifier of the Google Cloud Storage provider GoogleCloudStorage types.Provider = "gcs" )
Misc constants
View Source
const ( // ErrBadRequest is returned when something fails due to client error. ErrBadRequest = "bad request" ErrUnauthorized = "unauthorized" // ErrInvalidConfig is returned when the config is invalid. ErrInvalidConfig = "invalid config" // ErrInvalidBucket is returned when the bucket is invalid. ErrInvalidBucket = "invalid bucket" // ErrInvalidProvider is returned when the provider is invalid. ErrInvalidProvider = "invalid provider" // ErrInvalidCredentials is returned when the authentication credentials are invalid. ErrInvalidCredentials = "invalid credentials" // ErrFileOperationFailed is returned when a file operation fails. ErrFileOperationFailed = "file operation failed" // ErrClientError is returned when the client returns an error. ErrClientError = "client error" )
Error constants.
View Source
const ( // ACL is the option to set the ACL of the file. OptACL = "acl" // PublicRead is the option to set the ACL of the file to public read. ACLPublicRead = "public-read" // Private is the option to set the ACL of the file to private. ACLPrivate = "private" // ContentType is the option to set the content type of the file. OptContentType = "content-type" // Metadata is the option to set the metadata of the file. OptMetadata = "metadata" // OptPinata is the option to set the pinataOptions OptPinata = "pinataOptions" )
Options constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeConfig ¶
type BridgeConfig types.BridgeConfig
BridgeConfig is the configuration for the rainbow bridge.
type MultiFile ¶
MultiFile is the struct for uploading multiple files. Along with options, you can also set global options that will be applied to all files.
type PinataPinFileResponse ¶
type PinataPinFileResponse = types.PinataPinFileResponse
PinataPinFileResponse is the response from Pinata Cloud when pinning a file.
type RainbowBridge ¶
type RainbowBridge interface { /* UploadFile uploads a file to the provider storage and returns an error if one occurs. Note: for some providers, UploadFile requires that a default bucket be set in bifrost.BridgeConfig. */ UploadFile(fileFace interface{}) (*types.UploadedFile, error) /* UploadMultiFile uploads mutliple files to the provider storage and returns an error if one occurs. If any of the uploads fail, the error is appended to the []UploadedFile.Error and also logged when debug is enabled while the rest of the uploads continue. Note: for some providers, UploadMultiFile requires that a default bucket be set in bifrost.BridgeConfig. */ UploadMultiFile(multiFace interface{}) ([]*types.UploadedFile, error) /* Disconnect closes the provider client connection and returns an error if one occurs. Disconnect should only be called when the connection is no longer needed. */ Disconnect() error // Config returns the provider configuration. Config() *types.BridgeConfig // IsConnected returns true if there is an active connection to the provider. IsConnected() bool /* UploadFolder uploads a folder to the provider storage and returns an error if one occurs. Note: for some providers, UploadFolder requires that a default bucket be set in bifrost.BridgeConfig. */ UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error) /* DeleteFile deletes a file from a bucket in provider's storage and returns an error if one occurs. Note: DeleteFile requires that a default bucket be set in bifrost.BridgeConfig. */ DeleteFile(fileFace interface{}) error }
func NewRainbowBridge ¶
func NewRainbowBridge(bc *BridgeConfig) (RainbowBridge, error)
NewRainbowBridge returns a new Rainbow Bridge for shipping files to your specified cloud storage service.
Directories ¶
Path | Synopsis |
---|---|
Bifrost interface for Google Cloud Storage
|
Bifrost interface for Google Cloud Storage |
Bifrost interface for Pinata Cloud
|
Bifrost interface for Pinata Cloud |
Bifrost interface for Simple Storage Service (S3)
|
Bifrost interface for Simple Storage Service (S3) |
shared
|
|
Bifrost interface for Wasabi Cloud Storage
|
Bifrost interface for Wasabi Cloud Storage |
Click to show internal directories.
Click to hide internal directories.