api

package
v0.9.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 12 Imported by: 77

Documentation

Overview

Package api defines all APIs supported by the BOS service of BCE.

Index

Constants

View Source
const (
	METADATA_DIRECTIVE_COPY    = "copy"
	METADATA_DIRECTIVE_REPLACE = "replace"

	STORAGE_CLASS_STANDARD    = "STANDARD"
	STORAGE_CLASS_STANDARD_IA = "STANDARD_IA"
	STORAGE_CLASS_COLD        = "COLD"
	STORAGE_CLASS_ARCHIVE     = "ARCHIVE"

	FETCH_MODE_SYNC  = "sync"
	FETCH_MODE_ASYNC = "async"

	CANNED_ACL_PRIVATE           = "private"
	CANNED_ACL_PUBLIC_READ       = "public-read"
	CANNED_ACL_PUBLIC_READ_WRITE = "public-read-write"

	RAW_CONTENT_TYPE = "application/octet-stream"

	THRESHOLD_100_CONTINUE = 1 << 20 // add 100 continue header if body size bigger than 1MB

	STATUS_ENABLED  = "enabled"
	STATUS_DISABLED = "disabled"

	ENCRYPTION_AES256 = "AES256"

	RESTORE_TIER_STANDARD  = "Standard"  //标准取回对象
	RESTORE_TIER_EXPEDITED = "Expedited" //快速取回对象

	FORBID_OVERWRITE_FALSE = "false"
	FORBID_OVERWRITE_TRUE  = "true"
)

Variables

View Source
var DEFAULT_CNAME_LIKE_LIST = []string{
	".cdn.bcebos.com",
}
View Source
var (
	GET_OBJECT_ALLOWED_RESPONSE_HEADERS = map[string]struct{}{
		"ContentDisposition": {},
		"ContentType":        {},
		"ContentLanguage":    {},
		"Expires":            {},
		"CacheControl":       {},
		"ContentEncoding":    {},
	}
)
View Source
var VALID_FORBID_OVERWRITE = map[string]int{
	FORBID_OVERWRITE_FALSE: 1,
	FORBID_OVERWRITE_TRUE:  1,
}
View Source
var VALID_RESTORE_TIER = map[string]int{
	RESTORE_TIER_STANDARD:  1,
	RESTORE_TIER_EXPEDITED: 1,
}

Functions

func AbortMultipartUpload

func AbortMultipartUpload(cli bce.Client, bucket, object, uploadId string) error

AbortMultipartUpload - abort a multipart upload operation

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the destination bucket name
  • object: the destination object name
  • uploadId: the multipart upload id

RETURNS:

  • error: nil if ok otherwise the specific error

func DeleteBucket

func DeleteBucket(cli bce.Client, bucket string) error

DeleteBucket - delete an empty bucket by given name

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name to be deleted

RETURNS:

  • error: nil if delete success otherwise the specific error

func DeleteBucketCopyrightProtection

func DeleteBucketCopyrightProtection(cli bce.Client, bucket string) error

DeleteBucketCopyrightProtection - delete the copyright protection config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketCors

func DeleteBucketCors(cli bce.Client, bucket string) error

DeleteBucketCors - delete the CORS config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketEncryption

func DeleteBucketEncryption(cli bce.Client, bucket string) error

DeleteBucketEncryption - delete the encryption config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketLifecycle

func DeleteBucketLifecycle(cli bce.Client, bucket string) error

DeleteBucketLifecycle - delete the lifecycle rule of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketLogging

func DeleteBucketLogging(cli bce.Client, bucket string) error

DeleteBucketLogging - delete the logging setting of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketNotification

func DeleteBucketNotification(cli bce.Client, bucket string) error

func DeleteBucketReplication

func DeleteBucketReplication(cli bce.Client, bucket string, replicationRuleId string) error

DeleteBucketReplication - delete the bucket replication config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketStaticWebsite

func DeleteBucketStaticWebsite(cli bce.Client, bucket string) error

DeleteBucketStaticWebsite - delete the static website config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketTrash

func DeleteBucketTrash(cli bce.Client, bucket string) error

func DeleteObject

func DeleteObject(cli bce.Client, bucket, object string) error

DeleteObject - delete the given object

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object to be deleted
  • object: the name of the object

RETURNS:

  • error: nil if ok otherwise the specific error

func DeleteObjectAcl

func DeleteObjectAcl(cli bce.Client, bucket, object string) error

DeleteObjectAcl - delete the ACL of the given object

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name

RETURNS:

  • error: nil if success otherwise the specific error

func GeneratePresignedUrl

func GeneratePresignedUrl(conf *bce.BceClientConfiguration, signer auth.Signer, bucket,
	object string, expire int, method string, headers, params map[string]string) string

GeneratePresignedUrl - generate an authorization url with expire time and optional arguments

PARAMS:

  • conf: the client configuration
  • signer: the client signer object to generate the authorization string
  • bucket: the target bucket name
  • object: the target object name
  • expire: expire time in seconds
  • method: optional sign method, default is GET
  • headers: optional sign headers, default just set the Host
  • params: optional sign params, default is empty

RETURNS:

  • string: the presigned url with authorization string

func GetBucketCopyrightProtection

func GetBucketCopyrightProtection(cli bce.Client, bucket string) ([]string, error)

GetBucketCopyrightProtection - get the copyright protection config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • result: the bucket copyright protection resources array
  • error: nil if success otherwise the specific error

func GetBucketEncryption

func GetBucketEncryption(cli bce.Client, bucket string) (string, error)

GetBucketEncryption - get the encryption config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • algorithm: the bucket encryption algorithm
  • error: nil if success otherwise the specific error

func GetBucketLocation

func GetBucketLocation(cli bce.Client, bucket string) (string, error)

GetBucketLocation - get the location of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • string: the location of the bucket
  • error: nil if delete success otherwise the specific error

func GetBucketStorageclass

func GetBucketStorageclass(cli bce.Client, bucket string) (string, error)

GetBucketStorageclass - get the storage class of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • string: the storage class of the bucket
  • error: nil if success otherwise the specific error
func GetObjectSymlink(cli bce.Client, bucket string, symlinkKey string) (string, error)

PutObjectSymlink - put the object from the string or the stream

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • symlinkKey: the name of the symlink

RETURNS:

  • string: the name of the target object
  • error: nil if ok otherwise the specific error

func HeadBucket

func HeadBucket(cli bce.Client, bucket string) error

HeadBucket - test the given bucket existed and access authority

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if exists and have authority otherwise the specific error

func PutBucket

func PutBucket(cli bce.Client, bucket string) (string, error)

PutBucket - create a new bucket with the given name

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the new bucket name

RETURNS:

  • string: the location of the new bucket if create success
  • error: nil if create success otherwise the specific error

func PutBucketAcl

func PutBucketAcl(cli bce.Client, bucket, cannedAcl string, aclBody *bce.Body) error

PutBucketAcl - set the acl of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • cannedAcl: support private, public-read, public-read-write
  • aclBody: the acl file body

RETURNS:

  • error: nil if delete success otherwise the specific error

func PutBucketCopyrightProtection

func PutBucketCopyrightProtection(cli bce.Client, bucket string, resources ...string) error

PutBucketCopyrightProtection - set the copyright protection config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • resources: the resource items in the bucket to be protected

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketCors

func PutBucketCors(cli bce.Client, bucket string, confBody *bce.Body) error

PutBucketCors - set the bucket CORS config

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • confBody: the CORS config body stream

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketEncryption

func PutBucketEncryption(cli bce.Client, bucket, algorithm string) error

PutBucketEncryption - set the bucket encrpytion config

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • algorithm: the encryption algorithm

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketLifecycle

func PutBucketLifecycle(cli bce.Client, bucket string, lifecycle *bce.Body) error

PutBucketLifecycle - set the lifecycle rule of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • lifecycle: the lifecycle rule json string body

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketLogging

func PutBucketLogging(cli bce.Client, bucket string, logging *bce.Body) error

PutBucketLogging - set the logging prefix of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • logging: the logging prefix json string body

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketNotification

func PutBucketNotification(cli bce.Client, bucket string, putBucketNotificationReq PutBucketNotificationReq) error

func PutBucketReplication

func PutBucketReplication(cli bce.Client, bucket string, replicationConf *bce.Body, replicationRuleId string) error

PutBucketReplication - set the bucket replication of different region

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • replicationConf: the replication config body stream
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketStaticWebsite

func PutBucketStaticWebsite(cli bce.Client, bucket string, confBody *bce.Body) error

PutBucketStaticWebsite - set the bucket static website config

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • confBody: the static website config body stream

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketStorageclass

func PutBucketStorageclass(cli bce.Client, bucket, storageClass string) error

PutBucketStorageclass - set the storage class of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • storageClass: the storage class string

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketTrash

func PutBucketTrash(cli bce.Client, bucket string, trashReq PutBucketTrashReq) error

PutBucketTrash - put the trash setting of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • trashDir: the trash dir name

RETURNS:

  • error: nil if success otherwise the specific error

func PutObject

func PutObject(cli bce.Client, bucket, object string, body *bce.Body,
	args *PutObjectArgs) (string, error)

PutObject - put the object from the string or the stream

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • object: the name of the object
  • body: the input content of the object
  • args: the optional arguments of this api

RETURNS:

  • string: the etag of the object
  • error: nil if ok otherwise the specific error

func PutObjectAcl

func PutObjectAcl(cli bce.Client, bucket, object, cannedAcl string,
	grantRead, grantFullControl []string, aclBody *bce.Body) error

PutObjectAcl - set the ACL of the given object

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name
  • cannedAcl: support private and public-read
  • grantRead: user id list
  • grantFullControl: user id list
  • aclBody: the acl file body

RETURNS:

  • error: nil if success otherwise the specific error
func PutObjectSymlink(cli bce.Client, bucket string, object string, symlinkKey string, symlinkArgs *PutSymlinkArgs) error

PutObjectSymlink - put the object from the string or the stream

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • object: the name of the object
  • symlinkKey: the name of the symlink
  • symlinkArgs: the optional arguments of this api

RETURNS:

  • error: nil if ok otherwise the specific error

func RestoreObject

func RestoreObject(cli bce.Client, bucket string, object string, args ArchiveRestoreArgs) error

RestoreObject - restore the archive object

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name
  • args: the restore args

RETURNS:

  • error: nil if success otherwise the specific error

func SendRequest added in v0.9.10

func SendRequest(cli bce.Client, req *bce.BceRequest, resp *bce.BceResponse) error

func UploadPart

func UploadPart(cli bce.Client, bucket, object, uploadId string, partNumber int,
	content *bce.Body, args *UploadPartArgs) (string, error)

UploadPart - upload the single part in the multipart upload process

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name
  • uploadId: the multipart upload id
  • partNumber: the current part number
  • content: the uploaded part content
  • args: the optional arguments

RETURNS:

  • string: the etag of the uploaded part
  • error: nil if ok otherwise the specific error

func UploadPartFromBytes added in v0.9.18

func UploadPartFromBytes(cli bce.Client, bucket, object, uploadId string, partNumber int,
	content []byte, args *UploadPartArgs) (string, error)

UploadPartFromBytes - upload the single part in the multipart upload process

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name
  • uploadId: the multipart upload id
  • partNumber: the current part number
  • content: the uploaded part content
  • args: the optional arguments

RETURNS:

  • string: the etag of the uploaded part
  • error: nil if ok otherwise the specific error

Types

type AclCondType

type AclCondType struct {
	IpAddress []string       `json:"ipAddress"`
	Referer   AclRefererType `json:"referer"`
}

type AclOwnerType

type AclOwnerType struct {
	Id string `json:"id"`
}

AclOwnerType defines the owner struct in ACL setting

type AclRefererType

type AclRefererType struct {
	StringLike   []string `json:"stringLike"`
	StringEquals []string `json:"stringEquals"`
}

type AppendObjectArgs

type AppendObjectArgs struct {
	Offset             int64
	CacheControl       string
	ContentDisposition string
	ContentMD5         string
	ContentType        string
	Expires            string
	UserMeta           map[string]string
	ContentSha256      string
	ContentCrc32       string
	StorageClass       string
}

AppendObjectArgs defines the optional arguments structure for appending object.

type AppendObjectResult

type AppendObjectResult struct {
	ContentMD5       string
	NextAppendOffset int64
	ContentCrc32     string
	ETag             string
}

AppendObjectResult defines the result data structure for appending object.

func AppendObject

func AppendObject(cli bce.Client, bucket, object string, content *bce.Body,
	args *AppendObjectArgs) (*AppendObjectResult, error)

AppendObject - append the given content to a new or existed object which is appendable

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • object: the name of the object
  • content: the content to be appended
  • args: the optional arguments to perform the append operation

RETURNS:

  • *AppendObjectResult: the result status for this api
  • error: nil if ok otherwise the specific error

type ArchiveRestoreArgs

type ArchiveRestoreArgs struct {
	RestoreTier string
	RestoreDays int
}

type BucketCORSType

type BucketCORSType struct {
	AllowedOrigins       []string `json:"allowedOrigins"`
	AllowedMethods       []string `json:"allowedMethods"`
	AllowedHeaders       []string `json:"allowedHeaders,omitempty"`
	AllowedExposeHeaders []string `json:"allowedExposeHeaders,omitempty"`
	MaxAgeSeconds        int64    `json:"maxAgeSeconds,omitempty"`
}

type BucketEncryptionType

type BucketEncryptionType struct {
	EncryptionAlgorithm string `json:"encryptionAlgorithm"`
}

BucketEncryptionType defines the data structure for Put and Get of bucket encryption

type BucketReplicationDescriptor

type BucketReplicationDescriptor struct {
	Bucket       string `json:"bucket,omitempty"`
	StorageClass string `json:"storageClass,omitempty"`
}

BucketReplicationDescriptor defines the description data structure

type BucketReplicationType

type BucketReplicationType struct {
	Id               string                       `json:"id"`
	Status           string                       `json:"status"`
	Resource         []string                     `json:"resource"`
	ReplicateDeletes string                       `json:"replicateDeletes"`
	Destination      *BucketReplicationDescriptor `json:"destination,omitempty"`
	ReplicateHistory *BucketReplicationDescriptor `json:"replicateHistory,omitempty"`
	CreateTime       int64                        `json:"createTime"`
	DestRegion       string                       `json:"destRegion"`
}

BucketReplicationType defines the data structure for Put and Get of bucket replication

type BucketStaticWebsiteType

type BucketStaticWebsiteType struct {
	Index    string `json:"index"`
	NotFound string `json:"notFound"`
}

BucketStaticWebsiteType defines the data structure for Put and Get of bucket static website

type BucketSummaryType

type BucketSummaryType struct {
	Name         string `json:"name"`
	Location     string `json:"location"`
	CreationDate string `json:"creationDate"`
}

type CommonMessage

type CommonMessage struct {
	Prelude
	Headers map[string]string // message-type/content-type……
	Crc32   uint32            // crc32 of RecordsMessage
}

selectObject response msg

type CompleteMultipartUploadArgs

type CompleteMultipartUploadArgs struct {
	Parts        []UploadInfoType  `json:"parts"`
	UserMeta     map[string]string `json:"-"`
	Process      string            `json:"-"`
	ContentCrc32 string            `json:"-"`
}

CompleteMultipartUploadArgs defines the input arguments structure of CompleteMultipartUpload.

type CompleteMultipartUploadResult

type CompleteMultipartUploadResult struct {
	Location     string `json:"location"`
	Bucket       string `json:"bucket"`
	Key          string `json:"key"`
	ETag         string `json:"eTag"`
	ContentCrc32 string `json:"-"`
}

CompleteMultipartUploadResult defines the result structure of CompleteMultipartUpload.

func CompleteMultipartUpload

func CompleteMultipartUpload(cli bce.Client, bucket, object, uploadId string,
	body *bce.Body, args *CompleteMultipartUploadArgs) (*CompleteMultipartUploadResult, error)

CompleteMultipartUpload - finish a multipart upload operation

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the destination bucket name
  • object: the destination object name
  • uploadId: the multipart upload id
  • parts: all parts info stream
  • meta: user defined meta data

RETURNS:

  • *CompleteMultipartUploadResult: the result data
  • error: nil if ok otherwise the specific error

type ContinuationMessage

type ContinuationMessage struct {
	CommonMessage
	BytesScanned  uint64
	BytesReturned uint64
}

type CopyObjectArgs

type CopyObjectArgs struct {
	ObjectMeta
	MetadataDirective string
	IfMatch           string
	IfNoneMatch       string
	IfModifiedSince   string
	IfUnmodifiedSince string
}

CopyObjectArgs defines the optional args structure for the copy object api.

type CopyObjectResult

type CopyObjectResult struct {
	LastModified string `json:"lastModified"`
	ETag         string `json:"eTag"`
}

CopyObjectResult defines the result json structure for the copy object api.

func CopyObject

func CopyObject(cli bce.Client, bucket, object, source string,
	args *CopyObjectArgs) (*CopyObjectResult, error)

CopyObject - copy one object to a new object with new bucket and/or name. It can alse set the metadata of the object with the same source and target.

PARAMS:

  • cli: the client object which can perform sending request
  • bucket: the bucket name of the target object
  • object: the name of the target object
  • source: the source object uri
  • *CopyObjectArgs: the optional input args for copying object

RETURNS:

  • *CopyObjectResult: the result object which contains etag and lastmodified
  • error: nil if ok otherwise the specific error

func UploadPartCopy

func UploadPartCopy(cli bce.Client, bucket, object, source, uploadId string, partNumber int,
	args *UploadPartCopyArgs) (*CopyObjectResult, error)

UploadPartCopy - copy the multipart data

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the destination bucket name
  • object: the destination object name
  • source: the copy source uri
  • uploadId: the multipart upload id
  • partNumber: the current part number
  • args: the optional arguments

RETURNS:

  • *CopyObjectResult: the lastModified and eTag of the part
  • error: nil if ok otherwise the specific error

type CopyrightProtectionType

type CopyrightProtectionType struct {
	Resource []string `json:"resource"`
}

CopyrightProtectionType defines the data structure for Put and Get copyright protection API

type DeleteMultipleObjectsArgs

type DeleteMultipleObjectsArgs struct {
	Objects []DeleteObjectArgs `json:"objects"`
}

DeleteMultipleObjectsResult defines the input args structure for deleting multiple objects.

type DeleteMultipleObjectsResult

type DeleteMultipleObjectsResult struct {
	Errors []DeleteObjectResult `json:"errors"`
}

DeleteMultipleObjectsResult defines the result structure for deleting multiple objects.

func DeleteMultipleObjects

func DeleteMultipleObjects(cli bce.Client, bucket string,
	objectListStream *bce.Body) (*DeleteMultipleObjectsResult, error)

DeleteMultipleObjects - delete the given objects within a single http request

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the objects to be deleted
  • objectListStream: the objects list to be delete with json format

RETURNS:

  • *DeleteMultipleObjectsResult: the objects failed to delete
  • error: nil if ok otherwise the specific error

type DeleteObjectArgs

type DeleteObjectArgs struct {
	Key string `json:"key"`
}

DeleteObjectArgs defines the input args structure for a single object.

type DeleteObjectResult

type DeleteObjectResult struct {
	Key     string `json:"key"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

DeleteObjectResult defines the result structure for deleting a single object.

type EndMessage

type EndMessage struct {
	CommonMessage
}

type FetchObjectArgs

type FetchObjectArgs struct {
	FetchMode    string
	StorageClass string
}

FetchObjectArgs defines the optional arguments structure for the fetch object api.

type FetchObjectResult

type FetchObjectResult struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	RequestId string `json:"requestId"`
	JobId     string `json:"jobId"`
}

FetchObjectResult defines the result json structure for the fetch object api.

func FetchObject

func FetchObject(cli bce.Client, bucket, object, source string,
	args *FetchObjectArgs) (*FetchObjectResult, error)

FetchObject - fetch the object by the given url and store it to a bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name to store the object
  • object: the name of the object to be stored
  • source: the source url to fetch
  • args: the optional arguments to perform the fetch operation

RETURNS:

  • *FetchObjectArgs: the result of this api
  • error: nil if ok otherwise the specific error

type GetBucketAclResult

type GetBucketAclResult struct {
	AccessControlList []GrantType  `json:"accessControlList"`
	Owner             AclOwnerType `json:"owner"`
}

GetBucketAclResult defines the result structure of getting bucket acl.

func GetBucketAcl

func GetBucketAcl(cli bce.Client, bucket string) (*GetBucketAclResult, error)

GetBucketAcl - get the acl of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • *GetBucketAclResult: the result of the bucket acl
  • error: nil if success otherwise the specific error

type GetBucketCorsResult

type GetBucketCorsResult struct {
	CorsConfiguration []BucketCORSType `json:"corsConfiguration"`
}

GetBucketCorsResult defines the data structure of getting bucket CORS result

func GetBucketCors

func GetBucketCors(cli bce.Client, bucket string) (
	*GetBucketCorsResult, error)

GetBucketCors - get the CORS config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • result: the bucket CORS config result object
  • error: nil if success otherwise the specific error

type GetBucketLifecycleResult

type GetBucketLifecycleResult struct {
	Rule []LifecycleRuleType `json:"rule"`
}

GetBucketLifecycleResult defines the lifecycle result structure for getting

func GetBucketLifecycle

func GetBucketLifecycle(cli bce.Client, bucket string) (*GetBucketLifecycleResult, error)

GetBucketLifecycle - get the lifecycle rule of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • *GetBucketLifecycleResult: the lifecycle rule of the bucket
  • error: nil if success otherwise the specific error

type GetBucketLoggingResult

type GetBucketLoggingResult struct {
	Status       string `json:"status"`
	TargetBucket string `json:"targetBucket,omitempty"`
	TargetPrefix string `json:"targetPrefix, omitempty"`
}

GetBucketLoggingResult defines the result structure for getting bucket logging.

func GetBucketLogging

func GetBucketLogging(cli bce.Client, bucket string) (*GetBucketLoggingResult, error)

GetBucketLogging - get the logging config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • *GetBucketLoggingResult: the logging setting of the bucket
  • error: nil if success otherwise the specific error

type GetBucketReplicationProgressResult

type GetBucketReplicationProgressResult struct {
	Status                    string  `json:"status"`
	HistoryReplicationPercent float64 `json:"historyReplicationPercent"`
	LatestReplicationTime     string  `json:"latestReplicationTime"`
}

GetBucketReplicationProgressResult defines output result for replication process

func GetBucketReplicationProgress

func GetBucketReplicationProgress(cli bce.Client, bucket string, replicationRuleId string) (
	*GetBucketReplicationProgressResult, error)

GetBucketReplicationProgress - get the bucket replication process of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • *GetBucketReplicationProgressResult: the result of the bucket replication process
  • error: nil if success otherwise the specific error

type GetBucketReplicationResult

type GetBucketReplicationResult BucketReplicationType

func GetBucketReplication

func GetBucketReplication(cli bce.Client, bucket string, replicationRuleId string) (*GetBucketReplicationResult, error)

GetBucketReplication - get the bucket replication config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • *GetBucketReplicationResult: the result of the bucket replication config
  • error: nil if success otherwise the specific error

type GetBucketStaticWebsiteResult

type GetBucketStaticWebsiteResult BucketStaticWebsiteType

func GetBucketStaticWebsite

func GetBucketStaticWebsite(cli bce.Client, bucket string) (
	*GetBucketStaticWebsiteResult, error)

GetBucketStaticWebsite - get the static website config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • result: the bucket static website config result object
  • error: nil if success otherwise the specific error

type GetBucketTrashResult

type GetBucketTrashResult struct {
	TrashDir string `json:"trashDir"`
}

func GetBucketTrash

func GetBucketTrash(cli bce.Client, bucket string) (*GetBucketTrashResult, error)

type GetObjectAclResult

type GetObjectAclResult ObjectAclType

func GetObjectAcl

func GetObjectAcl(cli bce.Client, bucket, object string) (*GetObjectAclResult, error)

GetObjectAcl - get the ACL of the given object

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name

RETURNS:

  • result: the object acl result object
  • error: nil if success otherwise the specific error

type GetObjectMetaResult

type GetObjectMetaResult struct {
	ObjectMeta
}

GetObjectMetaResult defines the result data of the get object meta api.

func GetObjectMeta

func GetObjectMeta(cli bce.Client, bucket, object string) (*GetObjectMetaResult, error)

GetObjectMeta - get the meta data of the given object

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • object: the name of the object

RETURNS:

  • *GetObjectMetaResult: the result of this api
  • error: nil if ok otherwise the specific error

type GetObjectResult

type GetObjectResult struct {
	ObjectMeta
	ContentLanguage string
	Body            io.ReadCloser
}

GetObjectResult defines the result data of the get object api.

func GetObject

func GetObject(cli bce.Client, bucket, object string, responseHeaders map[string]string,
	ranges ...int64) (*GetObjectResult, error)

GetObject - get the object content with range and response-headers-specified support

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • object: the name of the object
  • responseHeaders: the optional response headers to get the given object
  • ranges: the optional range start and end to get the given object

RETURNS:

  • *GetObjectResult: the output content result of the object
  • error: nil if ok otherwise the specific error

type GrantType

type GrantType struct {
	Grantee     []GranteeType `json:"grantee"`
	Permission  []string      `json:"permission"`
	Resource    []string      `json:"resource,omitempty"`
	NotResource []string      `json:"notResource,omitempty"`
	Condition   AclCondType   `json:"condition,omitempty"`
}

GrantType defines the grant struct in ACL setting

type GranteeType

type GranteeType struct {
	Id string `json:"id"`
}

GranteeType defines the grantee struct in ACL setting

type InitiateMultipartUploadArgs

type InitiateMultipartUploadArgs struct {
	CacheControl       string
	ContentDisposition string
	Expires            string
	StorageClass       string
}

InitiateMultipartUploadArgs defines the input arguments to initiate a multipart upload.

type InitiateMultipartUploadResult

type InitiateMultipartUploadResult struct {
	Bucket   string `json:"bucket"`
	Key      string `json:"key"`
	UploadId string `json:"uploadId"`
}

InitiateMultipartUploadResult defines the result structure to initiate a multipart upload.

func InitiateMultipartUpload

func InitiateMultipartUpload(cli bce.Client, bucket, object, contentType string,
	args *InitiateMultipartUploadArgs) (*InitiateMultipartUploadResult, error)

InitiateMultipartUpload - initiate a multipart upload to get a upload ID

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • object: the object name
  • contentType: the content type of the object to be uploaded which should be specified, otherwise use the default(application/octet-stream)
  • args: the optional arguments

RETURNS:

  • *InitiateMultipartUploadResult: the result data structure
  • error: nil if ok otherwise the specific error

type LifecycleActionType

type LifecycleActionType struct {
	Name         string `json:"name"`
	StorageClass string `json:"storageClass,omitempty"`
}

LifecycleActionType defines the structure of lifecycle action

type LifecycleConditionTimeType

type LifecycleConditionTimeType struct {
	DateGreaterThan string `json:"dateGreaterThan"`
}

LifecycleConditionTimeType defines the structure of time condition

type LifecycleConditionType

type LifecycleConditionType struct {
	Time LifecycleConditionTimeType `json:"time"`
}

LifecycleConditionType defines the structure of condition

type LifecycleRuleType

type LifecycleRuleType struct {
	Id        string                 `json:"id"`
	Status    string                 `json:"status"`
	Resource  []string               `json:"resource"`
	Condition LifecycleConditionType `json:"condition"`
	Action    LifecycleActionType    `json:"action"`
}

LifecycleRuleType defines the structure of a single lifecycle rule

type ListBucketReplicationResult added in v0.9.16

type ListBucketReplicationResult struct {
	Rules []BucketReplicationType `json:"rules"`
}

ListBucketReplicationResult defines output result for replication conf list

func ListBucketReplication added in v0.9.16

func ListBucketReplication(cli bce.Client, bucket string) (*ListBucketReplicationResult, error)

ListBucketReplication - list all replication config of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

type ListBucketsResult

type ListBucketsResult struct {
	Owner   OwnerType           `json:"owner"`
	Buckets []BucketSummaryType `json:"buckets"`
}

ListBucketsResult defines the result structure of ListBuckets api.

func ListBuckets

func ListBuckets(cli bce.Client) (*ListBucketsResult, error)

ListBuckets - list all buckets of the account

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • *ListBucketsResult: the result bucket list structure
  • error: nil if ok otherwise the specific error

type ListMultipartUploadsArgs

type ListMultipartUploadsArgs struct {
	Delimiter  string
	KeyMarker  string
	MaxUploads int
	Prefix     string
}

ListMultipartUploadsArgs defines the optional arguments for ListMultipartUploads.

type ListMultipartUploadsResult

type ListMultipartUploadsResult struct {
	Bucket         string                     `json:"bucket"`
	CommonPrefixes []PrefixType               `json:"commonPrefixes"`
	Delimiter      string                     `json:"delimiter"`
	Prefix         string                     `json:"prefix"`
	IsTruncated    bool                       `json:"isTruncated"`
	KeyMarker      string                     `json:"keyMarker"`
	MaxUploads     int                        `json:"maxUploads"`
	NextKeyMarker  string                     `json:"nextKeyMarker"`
	Uploads        []ListMultipartUploadsType `json:"uploads"`
}

ListMultipartUploadsResult defines the multipart uploads result structure.

func ListMultipartUploads

func ListMultipartUploads(cli bce.Client, bucket string,
	args *ListMultipartUploadsArgs) (*ListMultipartUploadsResult, error)

ListMultipartUploads - list the unfinished uploaded parts of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the destination bucket name
  • args: the optional arguments

RETURNS:

  • *ListMultipartUploadsResult: the unfinished uploaded parts info result
  • error: nil if ok otherwise the specific error

type ListMultipartUploadsType

type ListMultipartUploadsType struct {
	Key          string    `json:"key"`
	UploadId     string    `json:"uploadId"`
	Owner        OwnerType `json:"owner"`
	Initiated    string    `json:"initiated"`
	StorageClass string    `json:"storageClass,omitempty"`
}

type ListObjectsArgs

type ListObjectsArgs struct {
	Delimiter string `json:"delimiter"`
	Marker    string `json:"marker"`
	MaxKeys   int    `json:"maxKeys"`
	Prefix    string `json:"prefix"`
}

ListObjectsArgs defines the optional arguments for ListObjects api.

type ListObjectsResult

type ListObjectsResult struct {
	Name           string              `json:"name"`
	Prefix         string              `json:"prefix"`
	Delimiter      string              `json:"delimiter"`
	Marker         string              `json:"marker"`
	NextMarker     string              `json:"nextMarker,omitempty"`
	MaxKeys        int                 `json:"maxKeys"`
	IsTruncated    bool                `json:"isTruncated"`
	Contents       []ObjectSummaryType `json:"contents"`
	CommonPrefixes []PrefixType        `json:"commonPrefixes"`
}

ListObjectsResult defines the result structure of ListObjects api.

func ListObjects

func ListObjects(cli bce.Client, bucket string,
	args *ListObjectsArgs) (*ListObjectsResult, error)

ListObjects - list all objects of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • args: the optional arguments to list objects

RETURNS:

  • *ListObjectsResult: the result object list structure
  • error: nil if ok otherwise the specific error

type ListPartType

type ListPartType struct {
	PartNumber   int    `json:"partNumber"`
	LastModified string `json:"lastModified"`
	ETag         string `json:"eTag"`
	Size         int    `json:"size"`
}

type ListPartsArgs

type ListPartsArgs struct {
	MaxParts         int
	PartNumberMarker string
}

ListPartsArgs defines the input optional arguments of listing parts information.

type ListPartsResult

type ListPartsResult struct {
	Bucket               string         `json:"bucket"`
	Key                  string         `json:"key"`
	UploadId             string         `json:"uploadId"`
	Initiated            string         `json:"initiated"`
	Owner                OwnerType      `json:"owner"`
	StorageClass         string         `json:"storageClass"`
	PartNumberMarker     int            `json:"partNumberMarker"`
	NextPartNumberMarker int            `json:"nextPartNumberMarker"`
	MaxParts             int            `json:"maxParts"`
	IsTruncated          bool           `json:"isTruncated"`
	Parts                []ListPartType `json:"parts"`
}

ListPartsResult defines the parts info result from ListParts.

func ListParts

func ListParts(cli bce.Client, bucket, object, uploadId string,
	args *ListPartsArgs) (*ListPartsResult, error)

ListParts - list the successfully uploaded parts info by upload id

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the destination bucket name
  • object: the destination object name
  • uploadId: the multipart upload id
  • args: the optional arguments partNumberMarker: return parts after this marker maxParts: the max number of return parts, default and maximum is 1000

RETURNS:

  • *ListPartsResult: the uploaded parts info result
  • error: nil if ok otherwise the specific error

type LocationType

type LocationType struct {
	LocationConstraint string `json:"locationConstraint"`
}

type MultiCopyObjectArgs

type MultiCopyObjectArgs struct {
	StorageClass string
}

type ObjectAclType

type ObjectAclType struct {
	AccessControlList []GrantType `json:"accessControlList"`
}

ObjectAclType defines the data structure for Put and Get object acl API

type ObjectMeta

type ObjectMeta struct {
	CacheControl       string
	ContentDisposition string
	ContentEncoding    string
	ContentLength      int64
	ContentRange       string
	ContentType        string
	ContentMD5         string
	ContentSha256      string
	ContentCrc32       string
	Expires            string
	LastModified       string
	ETag               string
	UserMeta           map[string]string
	StorageClass       string
	NextAppendOffset   string
	ObjectType         string
	BceRestore         string
	BceObjectType      string
}

type ObjectSummaryType

type ObjectSummaryType struct {
	Key          string    `json:"key"`
	LastModified string    `json:"lastModified"`
	ETag         string    `json:"eTag"`
	Size         int       `json:"size"`
	StorageClass string    `json:"storageClass"`
	Owner        OwnerType `json:"owner"`
}

type OwnerType

type OwnerType struct {
	Id          string `json:"id"`
	DisplayName string `json:"displayName"`
}

type PrefixType

type PrefixType struct {
	Prefix string `json:"prefix"`
}

type Prelude

type Prelude struct {
	TotalLen   uint32
	HeadersLen uint32
}

type PutBucketAclArgs

type PutBucketAclArgs struct {
	AccessControlList []GrantType `json:"accessControlList"`
}

PutBucketAclArgs defines the input args structure for putting bucket acl.

type PutBucketCorsArgs

type PutBucketCorsArgs struct {
	CorsConfiguration []BucketCORSType `json:"corsConfiguration"`
}

PutBucketCorsArgs defines the request argument for bucket CORS setting

type PutBucketLifecycleArgs

type PutBucketLifecycleArgs struct {
	Rule []LifecycleRuleType `json:"rule"`
}

GetBucketLifecycleResult defines the lifecycle argument structure for putting

type PutBucketLoggingArgs

type PutBucketLoggingArgs struct {
	TargetBucket string `json:"targetBucket"`
	TargetPrefix string `json:"targetPrefix"`
}

PutBucketLoggingArgs defines the input args structure for putting bucket logging.

type PutBucketNotificationAppsSt

type PutBucketNotificationAppsSt struct {
	Id       string `json:"id"`
	EventUrl string `json:"eventUrl"`
	XVars    string `json:"xVars"`
}

type PutBucketNotificationReq

type PutBucketNotificationReq struct {
	Notifications []PutBucketNotificationSt `json:"notifications"`
}

func GetBucketNotification

func GetBucketNotification(cli bce.Client, bucket string) (*PutBucketNotificationReq, error)

type PutBucketNotificationSt

type PutBucketNotificationSt struct {
	Id        string                        `json:"id"`
	Name      string                        `json:"name"`
	AppId     string                        `json:"appId"`
	Status    string                        `json:"status"`
	Resources []string                      `json:"resources"`
	Events    []string                      `json:"events"`
	Apps      []PutBucketNotificationAppsSt `json:"apps"`
}

type PutBucketReplicationArgs

type PutBucketReplicationArgs BucketReplicationType

type PutBucketStaticWebsiteArgs

type PutBucketStaticWebsiteArgs BucketStaticWebsiteType

type PutBucketTrashReq

type PutBucketTrashReq struct {
	TrashDir string `json:"trashDir"`
}

type PutObjectAclArgs

type PutObjectAclArgs ObjectAclType

type PutObjectArgs

type PutObjectArgs struct {
	CacheControl       string
	ContentDisposition string
	ContentMD5         string
	ContentType        string
	ContentLength      int64
	Expires            string
	UserMeta           map[string]string
	ContentSha256      string
	ContentCrc32       string
	StorageClass       string
	Process            string
}

PutObjectArgs defines the optional args structure for the put object api.

type PutSymlinkArgs added in v0.9.18

type PutSymlinkArgs struct {
	ForbidOverwrite string
	StorageClass    string
	UserMeta        map[string]string
}

type RecordsMessage

type RecordsMessage struct {
	CommonMessage
	Records []string // csv/json seleted data, one or more records
}

type SelectObjectArgs

type SelectObjectArgs struct {
	SelectType    string               `json: "-"`
	SelectRequest *SelectObjectRequest `json: "selectRequest"`
}

selectObject request args

type SelectObjectInput

type SelectObjectInput struct {
	CompressionType string            `json:"compressionType"`
	CsvParams       map[string]string `json:"csv"`
	JsonParams      map[string]string `json:"json"`
}

type SelectObjectOutput

type SelectObjectOutput struct {
	OutputHeader bool              `json:"outputHeader"`
	CsvParams    map[string]string `json:"csv"`
	JsonParams   map[string]string `json:"json"`
}

type SelectObjectProgress

type SelectObjectProgress struct {
	Enabled bool `json:"enabled"`
}

type SelectObjectRequest

type SelectObjectRequest struct {
	Expression          string                `json:"expression"`
	ExpressionType      string                `json:"expressionType"` // SQL
	InputSerialization  *SelectObjectInput    `json:"inputSerialization"`
	OutputSerialization *SelectObjectOutput   `json:"outputSerialization"`
	RequestProgress     *SelectObjectProgress `json:"requestProgress"`
}

type SelectObjectResult

type SelectObjectResult struct {
	Body io.ReadCloser
}

SelectObjectResult defines the result data of the select object api.

func SelectObject

func SelectObject(cli bce.Client, bucket, object string, args *SelectObjectArgs) (*SelectObjectResult, error)

SelectObject - select the object content

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name of the object
  • object: the name of the object
  • args: the optional arguments to perform the select operation

RETURNS:

  • *SelectObjectResult: the output select content result of the object
  • error: nil if ok otherwise the specific error

type StorageClassType

type StorageClassType struct {
	StorageClass string `json:"storageClass"`
}

type UploadInfoType

type UploadInfoType struct {
	PartNumber int    `json:"partNumber"`
	ETag       string `json:"eTag"`
}

UploadInfoType defines an uploaded part info structure.

type UploadPartArgs

type UploadPartArgs struct {
	ContentMD5    string
	ContentSha256 string
	ContentCrc32  string
}

UploadPartArgs defines the optinoal argumets for uploading part.

type UploadPartCopyArgs

type UploadPartCopyArgs struct {
	SourceRange       string
	IfMatch           string
	IfNoneMatch       string
	IfModifiedSince   string
	IfUnmodifiedSince string
}

UploadPartCopyArgs defines the optional arguments of UploadPartCopy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL