Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct {
AbsoluteMinimumPartSize int `json:"absoluteMinimumPartSize"`
AccountID string `json:"accountId"`
Allowed TokenCapability `json:"allowed"`
APIURL string `json:"apiUrl"`
AuthorizationToken string `json:"authorizationToken"`
DownloadURL string `json:"downloadUrl"`
RecommendedPartSize int `json:"recommendedPartSize"`
}
Authorization represents the authorization response from the B2 API
type Bucket ¶
type Bucket struct {
AccountID string `json:"accountId"`
ID string `json:"bucketId"`
Info map[string]string `json:"bucketInfo"`
Name string `json:"bucketName"`
Type string `json:"bucketType"`
LifecycleRules []BucketLifecycleRule `json:"lifecycleRules"`
Revision int `json:"revision"`
}
Bucket is used to represent a B2 Bucket
type BucketCorsRule ¶
type BucketCorsRule struct {
Name string `json:"corsRuleName"`
AllowedOrigins []string `json:"allowedOrigins"`
AllowedHeaders []string `json:"allowedHeaders"`
AllowedOperations []string `json:"allowedOperations"`
ExposeHeaders []string `json:"exposeHeaders"`
MaxAgeSeconds int `json:"maxAgeSeconds"`
}
BucketCorsRule is used to represent a Bucket's CORS rule
See more on https://www.backblaze.com/b2/docs/cors_rules.html
type BucketCreateRequest ¶
type BucketCreateRequest struct {
AccountID string `json:"accountId"`
Name string `json:"bucketName"`
Type string `json:"bucketType"`
Info map[string]string `json:"bucketInfo,omitempty"`
CorsRules []BucketCorsRule `json:"corsRules,omitempty"`
LifecycleRules []BucketLifecycleRule `json:"lifecycleRules,omitempty"`
}
BucketCreateRequest represents a request to create a Bucket
type BucketLifecycleRule ¶
type BucketLifecycleRule struct {
DaysFromHidingToDeleting int `json:"daysFromHidingToDeleting"`
DaysFromUploadingToHiding int `json:"daysFromUploadingToHiding"`
FileNamePrefix string `json:"fileNamePrefix"`
}
BucketLifecycleRule tells B2 to automatically hide and/or delete old files
See more on https://www.backblaze.com/b2/docs/lifecycle_rules.html
type BucketListRequest ¶
type BucketListRequest struct {
AccountID string `json:"accountId"`
BucketID string `json:"bucketId,omitempty"`
Name string `json:"bucketName,omitempty"`
Types string `json:"bucketTypes,omitempty"`
}
BucketListRequest represents a request to list Buckets
type BucketService ¶
type BucketService struct {
// contains filtered or unexported fields
}
BucketService handles communication with the Bucket related methods of the B2 API
func (*BucketService) Create ¶
func (s *BucketService) Create(createRequest *BucketCreateRequest) (*Bucket, *http.Response, error)
Create a new Bucket
func (*BucketService) List ¶
func (s *BucketService) List(listRequest *BucketListRequest) ([]Bucket, *http.Response, error)
List all Buckets
type Client ¶
type Client struct {
// The identifier for the account
AccountID string
// Services used for communicating with the API
Bucket *BucketService
// contains filtered or unexported fields
}
Client manages communication with Backblaze API
func (*Client) Do ¶
Do sends an API request and returns the API response
The API response is JSON decoded and stored in the value pointed to by v
func (*Client) NewRequest ¶
NewRequest creates an API request suitable for use with Client.Do
The path should always be specified without a preceding slash. It will be resolved to the BaseURL of the Client.
If specified, the value pointed to by body is JSON encoded and included in as the request body.
type ClientOpt ¶
ClientOpt are options for New
func SetAuthentication ¶
func SetAuthentication(auth *Authorization) ClientOpt
SetAuthentication is a client option for setting authentication data
func SetBaseURL ¶
SetBaseURL is a client option for setting the base URL