Documentation ¶
Index ¶
- type Allowed
- type AuthConfig
- type AuthorizationResp
- type Bucket
- type BucketType
- type CanxUpLgFileReq
- type CanxUpLgFileResp
- type CorsRules
- type CreateBucketReq
- type CreateBucketResp
- type CreateKeyReq
- type CreateKeyResp
- type DeleteBucketReq
- type DeleteBucketResp
- type DeleteFileVersionReq
- type DeleteFileVersionResponse
- type DeleteKeyReq
- type DeleteKeyResp
- type DownloadAuthReq
- type DownloadAuthResponse
- type DownloadFileByIDReq
- type File
- type FileInfo
- type FinishUpLgFileReq
- type FinishUpLgFileResp
- type GetFileInfoReq
- type GetFileInfoResponse
- type GetFileUploadPartReq
- type GetFileUploadPartResponse
- type HideFileReq
- type HideFileResponse
- type Key
- type KeysResp
- type LifecycleRules
- type ListBucketReq
- type ListBucketsResp
- type ListFileReq
- type ListFileVersionsReq
- type ListFileVersionsResponse
- type ListFilesResponse
- type ListKeyReq
- type ListPartsReq
- type ListPartsResponse
- type ListUnfinishUpLgFilesReq
- type ListUnfinishUpLgFilesResp
- type ListUnfinishedLargeFilesReq
- type ListUnfinishedLargeFilesResponse
- type MaxFileCount
- type Part
- type StartLargeFileReq
- type StartLargeFileResponse
- type StartUpLgFileReq
- type StartUpLgFileResp
- type UpdateBucketReq
- type UploadPartResponse
- type UploadResp
- type UploadURLReq
- type UploadURLResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allowed ¶
type Allowed struct { BucketId string `json:"bucketId"` // when present, access is restricted to one bucket BucketName string `json:"bucketName"` // if it exists and bucketId is present this will be the name Capability []string `json:"capabilities"` // listKeys, writeKeys, deleteKeys, listBuckets, writeBuckets, // deleteBuckets, listFiles, readFiles, shareFiles, writeFiles, // and deleteFiles NamePrefix string `json:"namePrefix"` // when present, access restricted to names that start with this }
Allowed lists capabilities and any restrictions
type AuthConfig ¶
type AuthorizationResp ¶
type AuthorizationResp struct { AbsoluteMinimumPartSize int64 `json:"absoluteMinimumPartSize"` // smallest possible size part of a large file except last one AccountID string `json:"accountId"` Allowed Allowed `json:"allowed"` // base url for all calls except up/download APIURL string `json:"apiUrl"` AuthorizationToken string `json:"authorizationToken"` // valid for 24hr DownloadURL string `json:"downloadUrl"` // base url for downloading files RecommendedPartSize int64 `json:"recommendedPartSize"` // recommended size for each part of a large file }
B2Response contains the response from the B2Cloud
func (*AuthorizationResp) Valid ¶
func (a *AuthorizationResp) Valid() bool
Valid is authorization valid
type Bucket ¶
type Bucket struct { AccountID string `json:"accountId"` BucketID string `json:"bucketId"` BucketName string `json:"bucketName"` BucketType string `json:"bucketType"` //"allPublic", "allPrivate", "snapshot", or other values in future BucketInfo json.RawMessage `json:"bucketInfo"` //user data stored with this bucket CorsRules []CorsRules `json:"corsRules"` // CORS rules for this bucket. LifecycleRules []LifecycleRules `json:"lifecycleRules"` Revision int `json:"revision"` }
Bucket bucket struct
type BucketType ¶
type BucketType int
BucketType enum type
const ( All BucketType = 1 + iota AllPublic AllPrivate Snapshot )
type CanxUpLgFileReq ¶
type CanxUpLgFileReq struct {
FileId string `json:"fileId"` // id returned by B2StartLargeFileResp
}
B2CanxUpLgFileReq struct
type CanxUpLgFileResp ¶
type CanxUpLgFileResp struct { FileId string `json:"fileId"` AccountId string `json:"accountId"` BucketId string `json:"bucketId"` FileName string `json:"fileName"` }
B2CanxUpLgFileResp struct
type CorsRules ¶
type CorsRules struct { CorsRuleName string `json:"corsRuleName"` ExposeHeaders string `json:"exposeHeaders"` MaxAgeSeconds int `json:"maxAgeSeconds"` AllowedHeaders []string `json:"allowedHeaders"` AllowedOperations []string `json:"allowedOperations"` AllowedOrigins []string `json:"allowedOrigins"` }
CorsRules struct
type CreateBucketReq ¶
type CreateBucketReq struct { AccountID string `json:"accountId"` // required BucketName string `json:"bucketName"` // required BucketType string `json:"bucketType"` // BucketType .Id or .String or Types BucketInfo string `json:"bucketInfo,omitempty"` // optional CorsRules []CorsRules `json:"corsRules,omitempty"` // https://www.backblaze.com/b2/docs/cors_rules.html LifecycleRules []LifecycleRules `json:"lifecycleRules,omitempty"` // https://www.backblaze.com/b2/docs/lifecycle_rules.html }
B2CreateBucketReq create bucket request
type CreateBucketResp ¶
type CreateBucketResp struct {
Bucket
}
B2CreateBucketResp create bucket response
type CreateKeyReq ¶
type CreateKeyReq struct { AccountId string `json:"accountId"` Capabilities []string `json:"capabilities,omitempty"` KeyName string `json:"keyName,omitempty"` ValidDurationInSeconds int `json:"validDurationInSeconds,omitempty"` BucketId string `json:"bucketId,omitempty"` NamePrefix string `json:"namePrefix,omitempty"` }
B2CreateKeyReq create req
type CreateKeyResp ¶
type CreateKeyResp struct { KeyName string `json:"keyName"` ApplicationKeyId string `json:"applicationKeyId"` ApplicationKey string `json:"applicationKey"` Capability []string `json:"capabilities"` // listKeys, writeKeys, deleteKeys, listBuckets, writeBuckets, // deleteBuckets, listFiles, readFiles, shareFiles, writeFiles, // and deleteFiles AccountID string `json:"accountId"` ExpirationTimestamp string `json:"expirationTimestamp"` BucketId string `json:"bucketId"` NamePrefix string `json:"namePrefix"` // when present, access restricted to names that start with this }
B2CreateKeyResp create key response
type DeleteBucketReq ¶
type DeleteBucketReq struct { AccountID string `json:"accountId"` // required BucketID string `json:"bucketId"` // filter (optional) }
B2DeleteBucketReq delete bucket request
type DeleteBucketResp ¶
type DeleteBucketResp struct {
Bucket
}
B2DeleteBucketResp delete bucket response
type DeleteFileVersionReq ¶
type DeleteKeyReq ¶
type DeleteKeyReq struct {
ApplicationKeyId string `json:"applicationKeyId"`
}
B2DeleteKeyReq delete key req
type DownloadAuthReq ¶
type DownloadAuthReq struct { BucketId string `json:"bucketId"` // FilenamePrefix string `json:"fileNamePrefix"` // Directory name below bucket ValidDurationInSeconds int64 `json:"validDurationInSeconds"` // Min 1 second. The maximum value is 604800 B2ContentDisposition string `json:"b2ContentDisposition,omitempty"` // Optional RFC 6266 }
type DownloadAuthResponse ¶
type DownloadFileByIDReq ¶
type DownloadFileByIDReq struct {
FileID string `json:"fileId"`
}
type FinishUpLgFileReq ¶
type FinishUpLgFileReq struct { FileId string `json:"fileId"` // id returned by B2StartLargeFileResp Sha1Ar []string `json:"partSha1Array"` // file part sha1 arrays in correct order }
B2FinishUpLgFileReq struct
type GetFileInfoReq ¶
type GetFileInfoReq struct {
FileID string `json:"fileId"`
}
type GetFileInfoResponse ¶
type GetFileInfoResponse struct {
UploadResp
}
type GetFileUploadPartReq ¶
type GetFileUploadPartReq struct {
FileID string `json:"fileId"` // Unique ID of file being uploaded
}
type HideFileReq ¶
type HideFileResponse ¶
type HideFileResponse struct {
UploadResp
}
type Key ¶
type Key struct { KeyName string `json:"keyName"` ApplicationKeyId string `json:"applicationKeyId"` Capabilities []string `json:"capabilities"` AccountId string `json:"accountId"` ExpirationTimestamp string `json:"expirationTimestamp"` BucketId string `json:"bucketId"` NamePrefix string `json:"namePrefix"` }
Key struct
type KeysResp ¶
type KeysResp struct { NextApplicationKeyId string `json:"nextApplicationKeyId"` Keys []Key `json:"keys"` }
B2KeysResp keys response
type LifecycleRules ¶
type LifecycleRules struct { DaysFromHidingToDeleting int `json:"daysFromHidingToDeleting"` DaysFromUploadingToHiding int `json:"daysFromUploadingToHiding"` FileNamePrefix string `json:"fileNamePrefix"` }
LifecycleRules struct
type ListBucketReq ¶
type ListBucketReq struct { AccountID string `json:"accountId"` // required BucketID string `json:"bucketId,omitempty"` // filter (optional) BucketName string `json:"bucketName,omitempty"` // filter (optional) BucketTypes []string `json:"bucketTypes,omitempty"` // BucketType .Id or .String or Types }
B2ListBucketReq b2 bucket list request
type ListBucketsResp ¶
type ListBucketsResp struct {
Buckets []Bucket `json:"buckets"`
}
B2ListBucketsResp list buckets response
type ListFileReq ¶
type ListFileReq struct { BucketID string `json:"bucketId"` StartFileName string `json:"startFileName,omitempty"` MaxFileCount MaxFileCount `json:"maxFileCount,omitempty"` Prefix string `json:"prefix,omitempty"` Delimiter string `json:"delimiter,omitempty"` }
type ListFileVersionsReq ¶
type ListFileVersionsReq struct { BucketID string `json:"bucketId"` StartFileName string `json:"startFileName,omitempty"` StartFileID string `json:"startFileId,omitempty"` // requires StartFileName if defined MaxFileCount MaxFileCount `json:"maxFileCount,omitempty"` Prefix string `json:"prefix,omitempty"` Delimiter string `json:"delimiter,omitempty"` }
type ListFilesResponse ¶
type ListKeyReq ¶
type ListKeyReq struct { AccountId string `json:"accountId"` MaxKeyCount int `json:"maxKeyCount,omitempty"` StartApplicationKeyId string `json:"startApplicationKeyId,omitempty"` }
B2ListKeyReq list key request
type ListPartsReq ¶
type ListPartsResponse ¶
type ListPartsResponse struct { FileID string `json:"fileId"` // Unique ID of file being uploaded UploadURL string `json:"uploadUrl"` // URL that can be used to upload parts of this file AuthorizationToken string `json:"authorizationToken"` // Valid 24hrs or until endpoint rejects upload Parts []Part `json:"parts"` NextPartNumber int64 `json:"nextPartNumber"` // What to pass into startPartNumber for next search to continue }
type ListUnfinishUpLgFilesReq ¶
type ListUnfinishUpLgFilesReq struct { BucketId string `json:"bucketId"` NamePrefix string `json:"namePrefix,omitempty"` // optional, only files matching prefix will return StartFileId string `json:"startFileId,omitempty"` // optional, first to return, if not found next will return MaxFileCount MaxFileCount `json:"maxFileCount,omitempty"` // optional, default 100, max 100 }
B2ListUnfinishUpLgFilesReq struct
type ListUnfinishUpLgFilesResp ¶
type ListUnfinishUpLgFilesResp struct { Files []File `json:"files"` NextField string `json:"nextField"` }
B2ListUnfinishUpLgFilesResp struct
type ListUnfinishedLargeFilesReq ¶
type ListUnfinishedLargeFilesReq struct { BucketId string `json:"bucketId"` // NamePrefix string `json:"namePrefix,omitempty"` // Optional StartFileId string `json:"startFileId,omitempty"` // Optional MaxFileCount MaxFileCount `json:"maxFileCount,omitempty"` // Optional }
type ListUnfinishedLargeFilesResponse ¶
type ListUnfinishedLargeFilesResponse struct { Files []UploadResp `json:"files"` NextFileId string `json:"nextFileId"` }
type MaxFileCount ¶
type MaxFileCount int
MaxFileCount type for default
func (*MaxFileCount) UnmarshalJSON ¶
func (m *MaxFileCount) UnmarshalJSON(b []byte) error
UnmarshalJSON Overrides and sets default to 100 on custom type
type StartLargeFileReq ¶
type StartLargeFileResponse ¶
type StartLargeFileResponse struct {
UploadResp
}
type StartUpLgFileReq ¶
type StartUpLgFileReq struct { BucketId string `json:"bucketId"` FileName string `json:"fileName"` ContentType string `json:"contentType"` FileInfo string `json:"fileInfo"` }
B2StartUpLgFileReq struct
type StartUpLgFileResp ¶
type StartUpLgFileResp struct { AccountId string `json:"accountId"` UploadResp // FileId stores unique id to reuse for part uploads }
B2StartUpLgFileResp struct
type UpdateBucketReq ¶
type UpdateBucketReq struct { AccountID string `json:"accountId"` // required BucketID string `json:"bucketId,omitempty"` // BucketId used instead of name BucketType string `json:"bucketType,omitempty"` // BucketType .Id or .String or Types BucketInfo string `json:"bucketInfo,omitempty"` // optional CorsRules []CorsRules `json:"corsRules,omitempty"` // https://www.backblaze.com/b2/docs/cors_rules.html LifecycleRules []LifecycleRules `json:"lifecycleRules,omitempty"` // https://www.backblaze.com/b2/docs/lifecycle_rules.html IfRevisionIs bool `json:"ifRevisionIs,omitempty"` // }
B2UpdateBucketReq update request
type UploadPartResponse ¶
type UploadResp ¶
type UploadResp struct { AccountID string `json:"accountId"` Action string `json:"action"` // start,upload,hide,folder currently but others can be added BucketID string `json:"bucketId"` ContentLength int64 `json:"contentLength"` ContentSha1 string `json:"contentSha1"` ContentType string `json:"contentType"` FileID string `json:"fileId"` FileInfo FileInfo `json:"fileInfo"` FileName string `json:"fileName"` UploadTimestamp int64 `json:"uploadTimestamp"` // time in millis }
B2UploadResp struct
type UploadURLReq ¶
type UploadURLReq struct {
BucketId string `json:"bucketId"`
}
B2UploadURLReq struct
type UploadURLResp ¶
type UploadURLResp struct { BucketId string `json:"bucketId"` UploadURL string `json:"uploadUrl"` AuthorizationToken string `json:"authorizationToken"` }
B2UploadURLResp struct