Documentation ¶
Overview ¶
Package bunnystorage provides an API client to the BunnyCDN Storage API.
Index ¶
- Constants
- type Application
- type Client
- func (c *Client) Delete(ctx context.Context, path, filename string) (*Response, error)
- func (c *Client) Download(ctx context.Context, path, filename string) ([]byte, *Response, error)
- func (c *Client) List(ctx context.Context, path string) ([]*Object, *Response, error)
- func (c *Client) Upload(ctx context.Context, path, file string) (*Response, error)
- type Config
- type Endpoint
- type Logger
- type Object
- type Operation
- type Response
Constants ¶
const ( // ErrInvalidApplication is returned when an application is invalid. ErrInvalidApplication xerrors.Error = "invalid application" // ErrInvalidConfig is returned when Config is invalid. ErrInvalidConfig xerrors.Error = "invalid config" // ErrInvalidEndpoint is returned when an endpoint is invalid. ErrInvalidEndpoint xerrors.Error = "invalid endpoint" // ErrStorageZoneRequired is returned when a Config is created without a // storage zone. ErrStorageZoneRequired xerrors.Error = "storage zone required" // ErrStorageZoneNameRequired is returned when a storage zone is created // without a name. ErrStorageZoneNameRequired xerrors.Error = "storage zone name required" // ErrStorageZoneKeyRequired is returned when a storage zone is created // without an API key. ErrStorageZoneKeyRequired xerrors.Error = "storage zone key required" // ErrEndpointRequired is returned when a Config is created without an // endpoint. ErrEndpointRequired xerrors.Error = "endpoint required" // ErrApplicationRequired is returned when a Config is created without an // application. ErrApplicationRequired xerrors.Error = "application required" // ErrApplicationNameRequired is returned when an application is created // without a name. ErrApplicationNameRequired xerrors.Error = "application name required" // ErrApplicationVersionRequired is returned when an application is created // without a version. ErrApplicationVersionRequired xerrors.Error = "application version required" // ErrApplicationContactRequired is returned when an application is created // without contact information. ErrApplicationContactRequired xerrors.Error = "application contact required" // ErrApplicationKeyRequired is returned when an application is created // without an API key. ErrApplicationKeyRequired xerrors.Error = "application key required" )
Default values for the Config struct.
const ( // ErrConfigRequired is returned when a Client is created without a Config. ErrConfigRequired xerrors.Error = "config is required" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { // Name is the name of the application. Name string // Version is the version of the application. Version string // Contact is the contact information for the application. Either an email // or an URL. Contact string }
Application represents the application that is making requests to the API.
func DefaultApplication ¶
func DefaultApplication() *Application
DefaultApplication returns a new Application with default values.
func (*Application) UserAgent ¶
func (a *Application) UserAgent() *httpx.UserAgent
UserAgent returns the user agent string for the application.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the LanguageTool API client.
type Config ¶
type Config struct { // Application is the application that is making requests to the API. Application *Application // Logger is the logger to use for logging requests when debugging. Logger Logger // StorageZone is the name of the storage zone to connect to. StorageZone string // Key is the API key used to authenticate with the API. The storage zone // password also doubles as your key. Key string // ReadOnlyKey is the read-only API key used to authenticate with the API. // This key is optional and only used for read-only operations. ReadOnlyKey string // Endpoint is the endpoint to use for the API. Endpoint Endpoint // MaxRetries specifies the maximum number of times to retry a request if it // fails due to rate limiting. // // This field is optional. MaxRetries int // Timeout is the time limit for requests made by the client to the API. // // This field is optional. Timeout time.Duration // Debug specifies whether or not to enable debug logging. // // This field is optional. Debug bool // contains filtered or unexported fields }
Config holds the basic configuration for the Bunny.net Storage API.
type Endpoint ¶
type Endpoint int
Endpoint represents the primary storage region of a storage zone.
const ( EndpointFalkenstein Endpoint = iota + 1 EndpointNewYork EndpointLosAngeles EndpointSingapore EndpointSydney EndpointLondon EndpointStockholm EndpointSaoPaulo EndpointJohannesburg )
The following endpoints are available for use with the Edge Storage API.
type Logger ¶
Logger defines the interface for logging. It is basically a thin wrapper around the standard logger which implements only a subset of the logger API.
type Object ¶
type Object struct { UserID string `json:"UserId,omitempty"` ContentType string `json:"ContentType,omitempty"` Path string `json:"Path,omitempty"` ObjectName string `json:"ObjectName,omitempty"` ReplicatedZones string `json:"ReplicatedZones,omitempty"` LastChanged string `json:"LastChanged,omitempty"` StorageZoneName string `json:"StorageZoneName,omitempty"` Checksum string `json:"Checksum,omitempty"` DateCreated string `json:"DateCreated,omitempty"` GUID string `json:"Guid,omitempty"` Length int `json:"Length,omitempty"` ServerID int `json:"ServerId,omitempty"` StorageZoneID int `json:"StorageZoneId,omitempty"` ArrayNumber int `json:"ArrayNumber,omitempty"` IsDirectory bool `json:"IsDirectory,omitempty"` }
Object represents a file or directory in the BunnyCDN Storage API.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
build
Package build provides build information about [the bunnystorage package].
|
Package build provides build information about [the bunnystorage package]. |
cryptoutil
Package cryptoutil provides utilities to extend Go's crypto package.
|
Package cryptoutil provides utilities to extend Go's crypto package. |
testutil
Package testutil provides utilities for testing.
|
Package testutil provides utilities for testing. |