api

package
v0.9.266 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 26 Imported by: 81

Documentation

Overview

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

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

Index

Constants

View Source
const (

	// option key
	API_VERSION_KEY = "API_VERSION"
	HTTP_CLIENT_KEY = "HTTP_CLIENT"
	ENABLE_CALC_MD5 = "ENABLE_CALC_MD5"
)
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"
	STORAGE_CLASS_MAZ_STANDARD    = "MAZ_STANDARD"
	STORAGE_CLASS_MAZ_STANDARD_IA = "MAZ_STANDARD_IA"

	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

	TRAFFIC_LIMIT_MAX = 8 * (100 << 20) // 100M bit = 838860800
	TRAFFIC_LIMIT_MIN = 8 * (100 << 10) // 100K bit = 819200

	STATUS_ENABLED  = "enabled"
	STATUS_DISABLED = "disabled"

	ENCRYPTION_AES256 = "AES256"

	RESTORE_TIER_STANDARD  = "Standard"  //标准取回对象
	RESTORE_TIER_EXPEDITED = "Expedited" //快速取回对象
	RESTORE_TIER_LOWCOST   = "LowCost"   //延迟取回对象

	FORBID_OVERWRITE_FALSE = "false"
	FORBID_OVERWRITE_TRUE  = "true"

	NAMESPACE_BUCKET   = "namespace"
	BOS_CONFIG_PREFIX  = "bos://"
	BOS_SHARE_ENDPOINT = "bos-share.baidubce.com"

	INVENTORY_SCHEDULE_DAILY   = "ThreeDaily"
	INVENTORY_SCHEDULE_WEEKLY  = "Weekly"
	INVENTORY_SCHEDULE_MONTHLY = "Monthly"
	INVENTORY_SCHEDULE_ONCE    = "Once"

	INVENTORY_FILE_FORMAT_CSV = "CSV"

	INVENTORY_OBJECT_VERSIONS_ALL     = "All"
	INVENTORY_OBJECT_VERSIONS_CURRENT = "Current"

	REQUEST_PAYMENT_REQUESTER    = "Requester"
	REQUEST_PAYMENT_BUCKET_OWNER = "BucketOwner"

	EVENT_FROM_CLIENT      = "Client"
	EVENT_FROM_LIFECYCLE   = "Lifecycle"
	EVENT_FROM_REPLICATION = "Replication"
	EVENT_FROM_BATCH       = "Batch"

	API_VERSION_V1 = "v1"
	API_VERSION_V2 = "v2"
	HTTPTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
)

Variables

View Source
var (
	DEFAULT_BOS_RETRY_POLICY = NewBosRetryPolicy(3, 20000, 300)
)
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,
}

Functions

func AbortMultipartUpload

func AbortMultipartUpload(cli bce.Client, bucket, object, uploadId string, ctx *BosContext, options ...Option) 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 AddCrc64Check added in v0.9.257

func AddCrc64Check(req *BosRequest, resp *BosResponse)

func CompleteBucketObjectLock added in v0.9.238

func CompleteBucketObjectLock(cli bce.Client, bucket string,
	ctx *BosContext, options ...Option) error

CompleteBucketObjectLock - lock time-based retention policy of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucket

func DeleteBucket(cli bce.Client, bucket string, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 DeleteBucketInventory added in v0.9.237

func DeleteBucketInventory(cli bce.Client, bucket, id string,
	ctx *BosContext, options ...Option) error

DeleteBucketInventory - delete the inventory config of the given bucket/id

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • id: inventory configuration id
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketLifecycle

func DeleteBucketLifecycle(cli bce.Client, bucket string, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 DeleteBucketMirror added in v0.9.147

func DeleteBucketMirror(cli bce.Client, bucket string, ctx *BosContext, options ...Option) error

func DeleteBucketNotification

func DeleteBucketNotification(cli bce.Client, bucket string, ctx *BosContext, options ...Option) error

func DeleteBucketObjectLock added in v0.9.238

func DeleteBucketObjectLock(cli bce.Client, bucket string,
	ctx *BosContext, options ...Option) error

DeleteBucketObjectLock - delete time-based retention policy of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketQuota added in v0.9.238

func DeleteBucketQuota(cli bce.Client, bucket string,
	ctx *BosContext, options ...Option) error

DeleteBucketQuota - delete the quota for the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteBucketReplication

func DeleteBucketReplication(cli bce.Client, bucket string, replicationRuleId string,
	ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 DeleteBucketTag added in v0.9.154

func DeleteBucketTag(cli bce.Client, bucket string, ctx *BosContext, options ...Option) error

func DeleteBucketTrash

func DeleteBucketTrash(cli bce.Client, bucket string, ctx *BosContext, options ...Option) error

func DeleteObject

func DeleteObject(cli bce.Client, bucket, object, versionId string, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 DeleteObjectTag added in v0.9.172

func DeleteObjectTag(cli bce.Client, bucket, object string, ctx *BosContext, options ...Option) error

func DeleteUserQuota added in v0.9.238

func DeleteUserQuota(cli bce.Client, ctx *BosContext, options ...Option) error

DeleteUserQuota - delete the quota for the caller(must be master user)

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func ExtendBucketObjectLock added in v0.9.238

func ExtendBucketObjectLock(cli bce.Client, bucket string, args *ExtendBucketObjectLockArgs,
	ctx *BosContext, options ...Option) error

ExtendBucketObjectLock - extend retention days for the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • args: extend retention days
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

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

func GeneratePresignedUrlInternal added in v0.9.87

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

func GeneratePresignedUrlPathStyle added in v0.9.87

func GeneratePresignedUrlPathStyle(conf *bce.BceClientConfiguration, signer auth.Signer, bucket,
	object string, expire int, method string, headers, params map[string]string) string
func GetBosShareLink(cli bce.Client, bucket, prefix, shareCode string, duration int,
	ctx *BosContext, options ...Option) (string, error)

func GetBucketCopyrightProtection

func GetBucketCopyrightProtection(cli bce.Client, bucket string,
	ctx *BosContext, options ...Option) ([]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, ctx *BosContext, options ...Option) (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, ctx *BosContext, options ...Option) (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, ctx *BosContext, options ...Option) (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,
	ctx *BosContext, options ...Option) (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 GetObjectTag added in v0.9.172

func GetObjectTag(cli bce.Client, bucket, object string, ctx *BosContext,
	options ...Option) (map[string]interface{}, error)

func HandleBosClientOptions added in v0.9.257

func HandleBosClientOptions(client bce.Client, ctx *BosContext, options []Option) error

func InitBucketObjectLock added in v0.9.238

func InitBucketObjectLock(cli bce.Client, bucket string, args *InitBucketObjectLockArgs,
	ctx *BosContext, options ...Option) error

InitBucketObjectLock - create time-based retention policy for the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • args: retention policy in days
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func ParseObjectTagResult added in v0.9.175

func ParseObjectTagResult(rawData []byte) (map[string]interface{}, error)

func PutBucket

func PutBucket(cli bce.Client, bucket string, args *PutBucketArgs,
	ctx *BosContext, options ...Option) (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,
	ctx *BosContext, options ...Option) 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, ctx *BosContext, 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, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 PutBucketInventory added in v0.9.237

func PutBucketInventory(cli bce.Client, bucket string, args *PutBucketInventoryArgs,
	ctx *BosContext, options ...Option) error

PutBucketInventory - put the inventory config for the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • args: inventory configuration
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketLifecycle

func PutBucketLifecycle(cli bce.Client, bucket string, lifecycle *bce.Body,
	ctx *BosContext, options ...Option) 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,
	ctx *BosContext, options ...Option) 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 PutBucketMirror added in v0.9.147

func PutBucketMirror(cli bce.Client, bucket string, putBucketMirrorArgs *PutBucketMirrorArgs,
	ctx *BosContext, options ...Option) error

func PutBucketNotification

func PutBucketNotification(cli bce.Client, bucket string, putBucketNotificationReq PutBucketNotificationReq,
	ctx *BosContext, options ...Option) error

func PutBucketQuota added in v0.9.238

func PutBucketQuota(cli bce.Client, bucket string, args *BucketQuotaArgs,
	ctx *BosContext, options ...Option) error

PutBucketQuota - put the quota for the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • args: quota configuration
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketReplication

func PutBucketReplication(cli bce.Client, bucket string, replicationConf *bce.Body, replicationRuleId string,
	ctx *BosContext, options ...Option) 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 PutBucketRequestPayment added in v0.9.238

func PutBucketRequestPayment(cli bce.Client, bucket string, args *RequestPaymentArgs,
	ctx *BosContext, options ...Option) error

PutBucketRequestPayment - put request payment rule for the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • args: bucket payment rule
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • error: nil if success otherwise the specific error

func PutBucketStaticWebsite

func PutBucketStaticWebsite(cli bce.Client, bucket string, confBody *bce.Body,
	ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 PutBucketTag added in v0.9.154

func PutBucketTag(cli bce.Client, bucket string, putBucketTagArgs *PutBucketTagArgs,
	ctx *BosContext, options ...Option) error

func PutBucketTrash

func PutBucketTrash(cli bce.Client, bucket string, trashReq PutBucketTrashReq,
	ctx *BosContext, options ...Option) 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 PutBucketVersioning added in v0.9.220

func PutBucketVersioning(cli bce.Client, bucket string, putBucketVersioningArgs *BucketVersioningArgs,
	ctx *BosContext, options ...Option) error

func PutObjectAcl

func PutObjectAcl(cli bce.Client, bucket, object, cannedAcl string, grantRead, grantFullControl []string,
	aclBody *bce.Body, ctx *BosContext, options ...Option) 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, ctx *BosContext, options ...Option) 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 PutObjectTag added in v0.9.172

func PutObjectTag(cli bce.Client, bucket, object string, putObjectTagArgs *PutObjectTagArgs,
	ctx *BosContext, options ...Option) error

func PutUserQuota added in v0.9.238

func PutUserQuota(cli bce.Client, args *UserQuotaArgs, ctx *BosContext, options ...Option) error

PutUserQuota - put quota configuration for the caller(must be master user)

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • error: nil if ok otherwise the specific error

func RestoreObject

func RestoreObject(cli bce.Client, bucket string, object string, args ArchiveRestoreArgs,
	ctx *BosContext, options ...Option) 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 *BosRequest, resp *BosResponse, ctx *BosContext) error

func SendRequestFromBytes added in v0.9.191

func SendRequestFromBytes(cli bce.Client, req *BosRequest, resp *BosResponse, ctx *BosContext, content []byte) error

func UploadPart

func UploadPart(cli bce.Client, bucket, object, uploadId string, partNumber int, content *bce.Body,
	args *UploadPartArgs, ctx *BosContext, options ...Option) (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, ctx *BosContext, options ...Option) (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,omitempty"`
	NotIpAddress    []string         `json:"notIpAddress,omitempty"`
	Referer         AclRefererType   `json:"referer,omitempty"`
	SecureTransport bool             `json:"secureTransport,omitempty"`
	CurrentTime     AclTimeCond      `json:"currentTime,omitempty"`
	UserAgent       AclUserAgentType `json:"userAgent,omitempty"`
	VpcId           []string         `json:"vpcId,omitempty"`
}

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,omitempty"`
	StringEquals []string `json:"stringEquals,omitempty"`
}

type AclTimeCond added in v0.9.251

type AclTimeCond struct {
	DateLessThan          string `json:"dateLessThan,omitempty"`
	DateLessThanEquals    string `json:"dateLessThanEquals,omitempty"`
	DateGreaterThan       string `json:"dateGreaterThan,omitempty"`
	DateGreaterThanEquals string `json:"dateGreaterThanEquals,omitempty"`
}

type AclUserAgentType added in v0.9.251

type AclUserAgentType struct {
	StringLike   []string `json:"stringLike,omitempty"`
	StringEquals []string `json:"stringEquals,omitempty"`
}

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
	TrafficLimit       int64
	ContentCrc32c      string
	ContentCrc32cFlag  bool
	ObjectExpires      int
	ContentEncoding    string
	ContentCrc64ECMA   string
}

AppendObjectArgs defines the optional arguments structure for appending object.

type AppendObjectResult

type AppendObjectResult struct {
	ContentMD5       string
	NextAppendOffset int64
	ContentCrc32     string
	ETag             string
	ContentCrc32c    string
	ContentCrc64ECMA 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,
	ctx *BosContext, options ...Option) (*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 BosContext added in v0.9.168

type BosContext struct {
	PathStyleEnable bool
	Ctx             context.Context // for each request
	ApiVersion      string          // "v1", "v2"
	EnableCalcMd5   bool
}

type BosRequest added in v0.9.232

type BosRequest struct {
	bce.BceRequest
	BucketName string
	ObjectKey  string
	Tracker    []RequestTracker
}

func (*BosRequest) Bucket added in v0.9.232

func (r *BosRequest) Bucket() string

func (*BosRequest) Object added in v0.9.232

func (r *BosRequest) Object() string

func (*BosRequest) SetBucket added in v0.9.232

func (r *BosRequest) SetBucket(bkt string)

func (*BosRequest) SetObject added in v0.9.232

func (r *BosRequest) SetObject(obj string)

type BosResponse added in v0.9.232

type BosResponse struct {
	bce.BceResponse
	Handler []ResponseHandler
}

func HeadBucket

func HeadBucket(cli bce.Client, bucket string, ctx *BosContext, options ...Option) (error, *BosResponse)

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

type BosRetryPolicy added in v0.9.252

type BosRetryPolicy struct {
	// contains filtered or unexported fields
}

func NewBosRetryPolicy added in v0.9.252

func NewBosRetryPolicy(maxRetry int, maxDelay, base int64) *BosRetryPolicy

func (*BosRetryPolicy) GetDelayBeforeNextRetryInMillis added in v0.9.252

func (b *BosRetryPolicy) GetDelayBeforeNextRetryInMillis(
	err bce.BceError, attempts int) time.Duration

func (*BosRetryPolicy) ShouldRetry added in v0.9.252

func (b *BosRetryPolicy) ShouldRetry(err bce.BceError, attempts int) bool

type BosShareLinkArgs added in v0.9.206

type BosShareLinkArgs struct {
	Bucket          string `json:"bucket"`
	Endpoint        string `json:"endpoint"`
	Prefix          string `json:"prefix"`
	ShareCode       string `json:"shareCode"`
	DurationSeconds int64  `json:"durationSeconds"`
}

type BosShareResBody added in v0.9.206

type BosShareResBody struct {
	ShareUrl       string `json:"shareUrl"`
	LinkExpireTime int64  `json:"linkExpireTime"`
	ShareCode      string `json:"shareCode"`
}

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 BucketInventoryRule added in v0.9.237

type BucketInventoryRule struct {
	Id                string               `json:"id"`
	Status            string               `json:"status"`
	Resource          []string             `json:"resource"`
	Schedule          string               `json:"schedule"`
	Destination       InventoryDestination `json:"destination"`
	MonthlyDate       int                  `json:"monthlyDate,omitempty"`
	IncObjectVersions string               `json:"includedObjectVersions,omitempty"`
}

type BucketObjectLockResult added in v0.9.238

type BucketObjectLockResult struct {
	LockStatus     string `json:"lockStatus"`
	CreateDate     int64  `json:"createDate"`
	ExpirationDate int64  `json:"expirationDate"`
	RetentionDays  int    `json:"retentionDays"`
}

func GetBucketObjectLock added in v0.9.238

func GetBucketObjectLock(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*BucketObjectLockResult, error)

GetBucketObjectLock - get time-based retention policy of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • result: the bucket retention configuration
  • error: nil if success otherwise the specific error

type BucketQuotaArgs added in v0.9.238

type BucketQuotaArgs struct {
	MaxObjectCount       int64 `json:"maxObjectCount"`
	MaxCapacityMegaBytes int64 `json:"maxCapacityMegaBytes"`
}

func GetBucketQuota added in v0.9.238

func GetBucketQuota(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*BucketQuotaArgs, error)

GetBucketQuota - get the quota of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • result: the bucket quota info
  • error: nil if success otherwise the specific error

type BucketReplicationDescriptor

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

BucketReplicationDescriptor defines the description data structure

type BucketReplicationType

type BucketReplicationType struct {
	Id                 string                       `json:"id"`
	Status             string                       `json:"status"`
	Resource           []string                     `json:"resource"`
	NotIncludeResource []string                     `json:"notIncludeResource,omitempty"`
	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"`
	LccLocation     string `json:"lccLocation,omitempty"`
	EnableDedicated bool   `json:"enableDedicated,omitempty"`
	EnableMultiAz   bool   `json:"enableMultiAz,omitempty"`
}

type BucketTag added in v0.9.180

type BucketTag struct {
	TagKey   string `json:"tag_key"`
	TagValue string `json:"tag_value"`
}

type BucketVersioningArgs added in v0.9.220

type BucketVersioningArgs struct {
	Status string `json:"status"`
}

func GetBucketVersioning added in v0.9.220

func GetBucketVersioning(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*BucketVersioningArgs, error)

type CallbackResult added in v0.9.175

type CallbackResult struct {
	Result string `json:"result"`
}

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:"-"`
	ContentCrc32c     string            `json:"-"`
	ContentCrc32cFlag bool              `json:"-"`
	ObjectExpires     int               `json:"-"`
	ContentCrc64ECMA  string            `json:"-"`
	IfMatch           string            `json:"-"`
	IfNoneMatch       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:"-"`
	ContentCrc32c    string `json:"-"`
	VersionId        string `json:"-"`
	ContentCrc64ECMA 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, ctx *BosContext, options ...Option) (*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
	TrafficLimit      int64
	CannedAcl         string
	TaggingDirective  string
	ObjectTagging     string
	ContentCrc32c     string
	ContentCrc32cFlag bool
	ObjectExpires     int
	ContentCrc64ECMA  string
	SrcVersionId      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"`
	VersionId    string `json:"versionId"`
	Code         string `json:"code,omitempty"`
	Message      string `json:"message,omitempty"`
	RequestId    string `json:"requestId,omitempty"`
}

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

func CopyObject

func CopyObject(cli bce.Client, bucket, object, source string, args *CopyObjectArgs,
	ctx *BosContext, options ...Option) (*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, ctx *BosContext, options ...Option) (*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 Credentials added in v0.9.238

type Credentials struct {
	AccessKeyId     string `json:"accessKeyId,omitempty"`
	SecretAccessKey string `json:"secretAccessKey,omitempty"`
	SessionToken    string `json:"sessionToken,omitempty"`
	Expiration      string `json:"expiration,omitempty"`
}

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,
	ctx *BosContext, options ...Option) (*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 EncryptionKey added in v0.9.242

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

type EndMessage

type EndMessage struct {
	CommonMessage
}

type EventContent added in v0.9.238

type EventContent struct {
	Domain                 string      `json:"domain,omitempty"`
	Bucket                 string      `json:"bucket,omitempty"`
	Object                 string      `json:"object,omitempty"`
	ETag                   string      `json:"eTag,omitempty"`
	ContentType            string      `json:"contentType,omitempty"`
	CopySourceBucket       string      `json:"copySourceBucket,omitempty"`
	CopySourceObject       string      `json:"copySourceObject,omitempty"`
	CopySourceStorageClass string      `json:"copySourceStorageClass,omitempty"`
	StorageClass           string      `json:"storageClass,omitempty"`
	FileSize               int64       `json:"fileSize,omitempty"`
	LastModified           string      `json:"lastModified,omitempty"`
	Credentials            Credentials `json:"credentials,omitempty"`
}

type EventMessage added in v0.9.238

type EventMessage struct {
	Version         string       `json:"version,omitempty"`
	EventFrom       string       `json:"eventFrom,omitempty"`
	EventId         string       `json:"eventId,omitempty"`
	EventOrigin     string       `json:"eventOrigin,omitempty"`
	EventType       string       `json:"eventType,omitempty"`
	EventTime       string       `json:"eventTime,omitempty"`
	ConfigurationId string       `json:"configurationId,omitempty"`
	Content         EventContent `json:"content,omitempty"`
	XVars           string       `json:"xVars,omitempty"`
}

type ExtendBucketObjectLockArgs added in v0.9.238

type ExtendBucketObjectLockArgs struct {
	ExtendRetentionDays int `json:"extendRetentionDays"`
}

type FetchObjectArgs

type FetchObjectArgs struct {
	FetchMode            string
	StorageClass         string
	FetchCallBackAddress string
	ObjectExpires        int
	ContentEncoding      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,
	ctx *BosContext, options ...Option) (*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, ctx *BosContext,
	options ...Option) (*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, ctx *BosContext,
	options ...Option) (*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, ctx *BosContext,
	options ...Option) (*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, ctx *BosContext,
	options ...Option) (*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,
	ctx *BosContext, options ...Option) (*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,
	ctx *BosContext, options ...Option) (*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, ctx *BosContext,
	options ...Option) (*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 GetBucketTagResult added in v0.9.180

type GetBucketTagResult struct {
	Tags []BucketTag `json:"tag"`
}

func GetBucketTag added in v0.9.154

func GetBucketTag(cli bce.Client, bucket string, ctx *BosContext, options ...Option) (*GetBucketTagResult, error)

type GetBucketTrashResult

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

func GetBucketTrash

func GetBucketTrash(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*GetBucketTrashResult, error)

type GetObjectAclResult

type GetObjectAclResult ObjectAclType

func GetObjectAcl

func GetObjectAcl(cli bce.Client, bucket, object string, ctx *BosContext,
	options ...Option) (*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 GetObjectArgs added in v0.9.257

type GetObjectArgs struct {
	Params            map[string]string // responseXXX query/ bce header
	Ranges            []int64
	IfMatch           string
	IfNoneMatch       string
	IfModifiedSince   string // example: Fri, 25 Dec 2025 17:11:53 GMT
	IfUnModifiedSince string // example: Fri, 25 Dec 2025 17:11:53 GMT
}

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, ctx *BosContext, options ...Option) (*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
	Body io.ReadCloser
}

GetObjectResult defines the result data of the get object api.

func GetObject

func GetObject(cli bce.Client, bucket, object string, ctx *BosContext, args 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
  • args: the optional args in querysring
  • 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

func GetObjectWithArgs added in v0.9.257

func GetObjectWithArgs(cli bce.Client, bucket, object string, ctx *BosContext, args *GetObjectArgs,
	options ...Option) (*GetObjectResult, error)

type GetObjectTagResult added in v0.9.266

type GetObjectTagResult struct {
	Code    string   `json:"code,omitempty"`
	Message string   `json:"message,omitempty"`
	TagSet  []TagSet `json:"tagSet,omitempty"`
}

type GetOption added in v0.9.237

type GetOption func(params map[string]interface{}) 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"`
	Effect      string        `json:"effect,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 HeaderPair added in v0.9.147

type HeaderPair struct {
	HeaderName  string `json:"headerName"`
	HeaderValue string `json:"headerValue"`
}

type InitBucketObjectLockArgs added in v0.9.238

type InitBucketObjectLockArgs struct {
	RetentionDays int `json:"RetentionDays"`
}

type InitiateMultipartUploadArgs

type InitiateMultipartUploadArgs struct {
	CacheControl       string
	ContentDisposition string
	Expires            string
	StorageClass       string
	ObjectTagging      string
	TaggingDirective   string
	CannedAcl          string
	CopySource         string
	GrantRead          []string
	GrantFullControl   []string
	ObjectExpires      int
	ContentEncoding    string
	IfMatch            string
	IfNoneMatch        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,
	ctx *BosContext, options ...Option) (*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 InventoryDestination added in v0.9.237

type InventoryDestination struct {
	TargetBucket string `json:"targetBucket"`
	TargetPrefix string `json:"targetPrefix,omitempty"`
	Format       string `json:"format"`
}

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,omitempty"`
	ObjectSize LifecycleObjectSizeType    `json:"objectSize,omitempty"`
	Tag        map[string]string          `json:"tag,omitempty"`
}

LifecycleConditionType defines the structure of condition

type LifecycleObjectSizeType added in v0.9.259

type LifecycleObjectSizeType struct {
	MinSize int64 `json:"minSize,omitempty"`
	MaxSize int64 `json:"maxSize,omitempty"`
}

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"`
	ExpiredObjectDeleteMarker string                 `json:"ExpiredObjectDeleteMarker,omitempty"`
	Not                       lifecycleNotRule       `json:"not,omitempty"`
}

LifecycleRuleType defines the structure of a single lifecycle rule

type ListBucketInventoryResult added in v0.9.237

type ListBucketInventoryResult struct {
	RuleList []BucketInventoryRule `json:"inventoryRuleList"`
}

func ListBucketInventory added in v0.9.237

func ListBucketInventory(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*ListBucketInventoryResult, error)

ListBucketInventory - list all inventory configs of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

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

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, ctx *BosContext,
	options ...Option) (*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, ctx *BosContext, options ...Option) (*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,
	ctx *BosContext, options ...Option) (*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"`
	VersionIdMarker string `json:"versionIdMarker,omitempty"`
}

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"`
	NextVersionidMarker string              `json:"nextVersionidMarker,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,
	ctx *BosContext, options ...Option) (*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

func ListObjectsVersions added in v0.9.220

func ListObjectsVersions(cli bce.Client, bucket string, args *ListObjectsArgs,
	ctx *BosContext, options ...Option) (*ListObjectsResult, 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,
	ctx *BosContext, options ...Option) (*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 MirrorConfigurationRule added in v0.9.147

type MirrorConfigurationRule struct {
	Prefix          string       `json:"prefix,omitempty"`
	SourceUrl       string       `json:"sourceUrl"`
	PassQueryString bool         `json:"passQuerystring"`
	Mode            string       `json:"mode"`
	StorageClass    string       `json:"storageClass"`
	PassHeaders     []string     `json:"passHeaders"`
	IgnoreHeaders   []string     `json:"ignoreHeaders"`
	CustomHeaders   []HeaderPair `json:"customHeaders"`
	BackSourceUrl   string       `json:"backSourceUrl"`
	Resource        string       `json:"resource"`
	Suffix          string       `json:"suffix"`
	FixedKey        string       `json:"fixedKey"`
	PrefixReplace   string       `json:"prefixReplace"`
	Version         string       `json:"version"`
}

type MultiCopyObjectArgs

type MultiCopyObjectArgs struct {
	StorageClass      string
	ObjectTagging     string
	TaggingDirective  string
	ContentCrc32      string
	ContentCrc32c     string
	ContentCrc32cFlag bool
	CannedAcl         string
	GrantRead         []string
	GrantFullControl  []string
	ObjectExpires     int
	UserMeta          map[string]string
	ContentCrc64ECMA  string
}

type NotificationContentTypeSt added in v0.9.246

type NotificationContentTypeSt struct {
	Extensions []string `json:"extensions,omitempty"`
	MimeTypes  []string `json:"mimeTypes,omitempty"`
}

type NotificationQuotaSt added in v0.9.247

type NotificationQuotaSt struct {
	QuotaDay int64   `json:"quotaDay,omitempty"`
	QuotaSec float64 `json:"quotaSec,omitempty"`
}

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
	VersionId          string
	ContentCrc32c      string
	ExpirationDate     string
	Encryption         SSEHeaders
	RetentionDate      string

	ContentCrc64ECMA string
	ContentLanguage  string
	// contains filtered or unexported fields
}

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"`
	VersionId    string    `json:"versionId,omitempty"`
	IsLatest     bool      `json:"isLatest,omitempty"`
	DeleteMarker bool      `json:"deleteMarker,omitempty"`
}

type ObjectTag added in v0.9.172

type ObjectTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type ObjectTags added in v0.9.172

type ObjectTags struct {
	TagInfo []ObjectTag `json:"tagInfo"`
}

type Option added in v0.9.236

type Option func(params map[string]optionValue) error

Set various options of HTTP request

var ErrorOption Option = func(params map[string]optionValue) error {
	return fmt.Errorf("error option")
}

func ApiVersion added in v0.9.257

func ApiVersion(value string) Option

change BosContext api version

func BceDate added in v0.9.236

func BceDate(t time.Time) Option

An option to set X-Bce-Date header

func CacheControl added in v0.9.236

func CacheControl(value string) Option

An option to set Cache-Control header

func CallbackAddress added in v0.9.236

func CallbackAddress(value string) Option

An option to set x-bce-callback-address header

func CannedAcl added in v0.9.236

func CannedAcl(cannedAcl string) Option

An option to set X-Bce-Acl header

func ContentCrc32 added in v0.9.236

func ContentCrc32(crc32 uint32) Option

An option to set X-Bce-Content-Crc32 header

func ContentCrc32c added in v0.9.236

func ContentCrc32c(crc32c uint32) Option

An option to set X-Bce-Content-Crc32c header

func ContentCrc32cFlag added in v0.9.236

func ContentCrc32cFlag(crc32cFlag bool) Option

An option to set X-Bce-Content-Crc32c-Flag header

func ContentDisposition added in v0.9.236

func ContentDisposition(value string) Option

An option to set Content-Disposition header

func ContentEncoding added in v0.9.236

func ContentEncoding(value string) Option

An option to set Content-Encoding header

func ContentLanguage added in v0.9.236

func ContentLanguage(value string) Option

An option to set Content-Language header

func ContentLength added in v0.9.236

func ContentLength(length int64) Option

An option to set Content-Length header

func ContentMD5 added in v0.9.236

func ContentMD5(value string) Option

An option to set Content-Md5 header

func ContentRange added in v0.9.236

func ContentRange(start, end int64) Option

An option to set Content-Range header

func ContentSha256 added in v0.9.236

func ContentSha256(value string) Option

An option to set X-Bce-Content-Sha256 header

func ContentType added in v0.9.236

func ContentType(value string) Option

An option to set Content-Type header

func CopySource added in v0.9.236

func CopySource(srcBucket, srcObject string) Option

An option to set x-bce-copy-source header

func CopySourceIfMatch added in v0.9.236

func CopySourceIfMatch(value string) Option

An option to set x-bce-copy-source-if-match header

func CopySourceIfModifiedSince added in v0.9.236

func CopySourceIfModifiedSince(t time.Time) Option

An option to set x-bce-copy-source-if-modified-since header

func CopySourceIfNoneMatch added in v0.9.236

func CopySourceIfNoneMatch(value string) Option

An option to set x-bce-copy-source-if-none-match header

func CopySourceIfUnmodifiedSince added in v0.9.236

func CopySourceIfUnmodifiedSince(t time.Time) Option

An option to set x-bce-copy-source-if-unmodified-since header

func CopySourceRange added in v0.9.236

func CopySourceRange(start, end int64) Option

An option to set x-bce-copy-source-range header

func Date added in v0.9.236

func Date(t time.Time) Option

An option to set Date header

func EnableCalcMd5 added in v0.9.257

func EnableCalcMd5(value bool) Option

func Expires added in v0.9.236

func Expires(t time.Time) Option

An option to set Expires header

func ForbidOverwrite added in v0.9.236

func ForbidOverwrite(forbidOverwrite bool) Option

An options to set x-bce-forbid-overwrite header

func GrantFullControl added in v0.9.236

func GrantFullControl(ids []string) Option

An option to set X-Bce-Grant-Full-Control header

func GrantRead added in v0.9.236

func GrantRead(ids []string) Option

An option to set X-Bce-Grant-Read header

func HTTPClient added in v0.9.257

func HTTPClient(httpClient *net_http.Client) Option

func IfMatch added in v0.9.257

func IfMatch(value string) Option

func IfModifiedSince added in v0.9.257

func IfModifiedSince(value string) Option

func IfNoneMatch added in v0.9.257

func IfNoneMatch(value string) Option

func IfUnModifiedSince added in v0.9.257

func IfUnModifiedSince(value string) Option

func MetadataDirective added in v0.9.236

func MetadataDirective(value string) Option

An option to set x-bce-metadata-directive header

func ObjectExpires added in v0.9.236

func ObjectExpires(days int) Option

An option to set x-bce-object-expires header

func PostCacheControl added in v0.9.238

func PostCacheControl(value string) Option

An option to set Cache-Control field to multipart form

func PostContentDisposition added in v0.9.238

func PostContentDisposition(value string) Option

An option to add Content-Disposition field to multipart form

func PostContentEncoding added in v0.9.238

func PostContentEncoding(value string) Option

An option to set Content-Encoding field to multipart form

func PostContentType added in v0.9.238

func PostContentType(value string) Option

An option to set Content-Type field to multipart form

func PostUserMeta added in v0.9.238

func PostUserMeta(key, value string) Option

An option to add X-Bce-Meta-* field to multipart form

func Process added in v0.9.236

func Process(value string) Option

An option to set x-bce-process header

func Range added in v0.9.236

func Range(start, end int64) Option

An option to set Range header

func RestoreDays added in v0.9.236

func RestoreDays(days int) Option

An option to set x-bce-restore-days header

func RestoreTier added in v0.9.236

func RestoreTier(value string) Option

An option to set x-bce-restore-tier header Expedited:加急取回,30min内完成取回 Standard:标准取回,2~5小时内完成取回 LowCost:延缓取回,12小时内完成取回

func SSECKey added in v0.9.236

func SSECKey(value string) Option

An option to set x-bce-server-side-encryption-customer-key header

func SSECKeyMd5 added in v0.9.236

func SSECKeyMd5(value string) Option

An option to set x-bce-server-side-encryption-customer-key-md5 header

func SSEKmsKeyId added in v0.9.236

func SSEKmsKeyId(value string) Option

An option to set x-bce-server-side-encryption-bos-key-id header

func SecurityToken added in v0.9.236

func SecurityToken(value string) Option

An option to set X-Bce-Security-Token header

func ServerSideEncryption added in v0.9.236

func ServerSideEncryption(value string) Option

An option to set x-bce-server-side-encryption header, "AES256" or "SM4"

func SetHeader added in v0.9.236

func SetHeader(key string, value interface{}) Option

func SetParam added in v0.9.236

func SetParam(key string, value interface{}) Option

func SetPostField added in v0.9.238

func SetPostField(key string, value interface{}) Option

func StorageClass added in v0.9.236

func StorageClass(value string) Option

An option to set x-bce-storage-class header

func SymlinkBucket added in v0.9.236

func SymlinkBucket(targetBucket string) Option

An option to set x-bce-symlink-bucket header

func SymlinkTarget added in v0.9.236

func SymlinkTarget(targetObjectKey string) Option

An option to set x-bce-symlink-target header

func TagList added in v0.9.236

func TagList(tags map[string]string) Option

An option to set X-Bce-Tag-List header

func Tagging added in v0.9.236

func Tagging(tags map[string]string) Option

An option to set X-Bce-Tagging header

func TaggingDirective added in v0.9.236

func TaggingDirective(value string) Option

An option to set x-bce-tagging-directive header

func TaggingStr added in v0.9.257

func TaggingStr(tagStr string) Option

func TrafficLimit added in v0.9.236

func TrafficLimit(value int64) Option

An option to set x-bce-traffic-limit header

func UserAgent added in v0.9.236

func UserAgent(userAgent string) Option

An option to set User-Agent header

func UserMeta added in v0.9.236

func UserMeta(key, value string) Option

An option to set X-Bce-Meta-* header

func VersionId added in v0.9.236

func VersionId(value string) Option

An option to set x-bce-version-id header

type OptionsObjectArgs added in v0.9.239

type OptionsObjectArgs struct {
	Origin         string
	RequestMethod  string
	RequestHeaders []string
}

type OptionsObjectResult added in v0.9.239

type OptionsObjectResult struct {
	AllowCredentials bool
	AllowHeaders     []string
	AllowMethods     []string
	AllowOrigin      string
	ExposeHeaders    []string
	MaxAge           int
}

func OptionsObject added in v0.9.239

func OptionsObject(cli bce.Client, bucket, object string, args *OptionsObjectArgs,
	ctx *BosContext, options ...Option) (*OptionsObjectResult, error)

OptionsObject - Get the options of the given object for CORS

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 of this api

RETURNS:

  • result: the supported options of the given object
  • error: nil if ok otherwise the specific error

type OwnerType

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

type PostEventArgs added in v0.9.238

type PostEventArgs struct {
	Events []EventMessage `json:"events,omitempty"`
}

type PostObjectArgs added in v0.9.238

type PostObjectArgs struct {
	Expiration         time.Duration
	ContentLengthLower int64
	ContentLengthUpper int64
}

type PostObjectResult added in v0.9.238

type PostObjectResult struct {
	ETag         string
	ContentMD5   string
	ContentCrc32 string
}

func PostObject added in v0.9.238

func PostObject(cli bce.Client, bucket, object string, content *bytes.Buffer, args *PostObjectArgs,
	ctx *BosContext, options ...Option) (*PostObjectResult, error)

PostObject - put the object by multipart/form-data

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:

  • result: the result of post object
  • error: nil if ok otherwise the specific error

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 PutBucketArgs added in v0.9.173

type PutBucketArgs struct {
	TagList         string `json:"-"`
	EnableMultiAz   bool   `json:"enableMultiAz"`
	LccLocation     string `json:"lccLocation,omitempty"`
	EnableDedicated bool   `json:"enableDedicated,omitempty"`
}

type PutBucketCorsArgs

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

PutBucketCorsArgs defines the request argument for bucket CORS setting

type PutBucketInventoryArgs added in v0.9.237

type PutBucketInventoryArgs struct {
	Rule BucketInventoryRule
}

func GetBucketInventory added in v0.9.237

func GetBucketInventory(cli bce.Client, bucket, id string, ctx *BosContext,
	options ...Option) (*PutBucketInventoryArgs, error)

GetBucketInventory - get the inventory config of the given bucket/id

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • id: inventory configuration id
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

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

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 PutBucketMirrorArgs added in v0.9.147

type PutBucketMirrorArgs struct {
	BucketMirroringConfiguration []MirrorConfigurationRule `json:"bucketMirroringConfiguration"`
}

func GetBucketMirror added in v0.9.147

func GetBucketMirror(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*PutBucketMirrorArgs, error)

type PutBucketNotificationAppsSt

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

type PutBucketNotificationReq

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

func GetBucketNotification

func GetBucketNotification(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*PutBucketNotificationReq, error)

type PutBucketNotificationSt

type PutBucketNotificationSt struct {
	Id          string                        `json:"id"`
	Name        string                        `json:"name"`
	AppId       string                        `json:"appId"`
	Status      string                        `json:"status"`
	Encryption  EncryptionKey                 `json:"encryption"`
	Resources   []string                      `json:"resources"`
	Events      []string                      `json:"events"`
	Apps        []PutBucketNotificationAppsSt `json:"apps"`
	ContentType NotificationContentTypeSt     `json:"contentType,omitempty"`
	Quota       NotificationQuotaSt           `json:"quota,omitempty"`
}

type PutBucketReplicationArgs

type PutBucketReplicationArgs BucketReplicationType

type PutBucketStaticWebsiteArgs

type PutBucketStaticWebsiteArgs BucketStaticWebsiteType

type PutBucketTagArgs added in v0.9.156

type PutBucketTagArgs struct {
	Tags []Tag `json:"tags"`
}

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
	CannedAcl          string
	ObjectTagging      string
	TrafficLimit       int64
	ContentCrc32c      string
	ContentCrc32cFlag  bool
	ObjectExpires      int
	ContentEncoding    string
	ForbidOverwrite    bool
	Encryption         SSEHeaders
	ContentCrc64ECMA   string
	IfMatch            string
	IfNoneMatch        string
}

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

type PutObjectResult added in v0.9.175

type PutObjectResult struct {
	Callback             CallbackResult `json:"callback"`
	ContentCrc32         string         `json:"-"`
	ContentCrc32c        string         `json:"-"`
	StorageClass         string         `json:"-"`
	VersionId            string         `json:"-"`
	ServerSideEncryption string         `json:"-"`
	ContentCrc64ECMA     string         `json:"-"`
}

func PutObject

func PutObject(cli bce.Client, bucket, object string, body *bce.Body, args *PutObjectArgs,
	ctx *BosContext, options ...Option) (string, *PutObjectResult, 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

type PutObjectTagArgs added in v0.9.172

type PutObjectTagArgs struct {
	ObjectTags []ObjectTags `json:"tagSet"`
}

type PutSymlinkArgs added in v0.9.18

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

type RecordsMessage

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

type RequestPaymentArgs added in v0.9.238

type RequestPaymentArgs struct {
	RequestPayment string `json:"requestPayment"`
}

func GetBucketRequestPayment added in v0.9.238

func GetBucketRequestPayment(cli bce.Client, bucket string, ctx *BosContext,
	options ...Option) (*RequestPaymentArgs, error)

GetBucketRequestPayment - get request payment rule of the given bucket

PARAMS:

  • cli: the client agent which can perform sending request
  • bucket: the bucket name
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • result: the bucket request payment rule
  • error: nil if success otherwise the specific error

type RequestTracker added in v0.9.257

type RequestTracker func(*BosRequest) error

func AddWriter added in v0.9.257

func AddWriter(writer io.Writer) RequestTracker

type ResponseHandler added in v0.9.257

type ResponseHandler func(*BosResponse) error

func Crc64Handler added in v0.9.257

func Crc64Handler(writer io.Writer) ResponseHandler

type SSEHeaders added in v0.9.236

type SSEHeaders struct {
	SSECKey              string
	SSECKeyMD5           string
	SSEKmsKeyId          string
	ServerSideEncryption string
}

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,
	ctx *BosContext, options ...Option) (*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 Tag added in v0.9.154

type Tag struct {
	TagKey   string `json:"tagKey"`
	TagValue string `json:"tagValue"`
}

type TagSet added in v0.9.266

type TagSet struct {
	TagInfo map[string]interface{} `json:"tagInfo,omitempty"`
}

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
	TrafficLimit      int64
	ContentCrc32c     string
	ContentCrc32cFlag bool
	ContentCrc64ECMA  string
}

UploadPartArgs defines the optinoal argumets for uploading part.

type UploadPartCopyArgs

type UploadPartCopyArgs struct {
	SourceRange       string
	IfMatch           string
	IfNoneMatch       string
	IfModifiedSince   string
	IfUnmodifiedSince string
	TrafficLimit      int64
	ContentCrc32c     string
	ContentCrc32cFlag bool
	ContentCrc64ECMA  string
}

UploadPartCopyArgs defines the optional arguments of UploadPartCopy.

type UserQuotaArgs added in v0.9.238

type UserQuotaArgs struct {
	MaxBucketCount       int64 `json:"maxBucketCount"`
	MaxCapacityMegaBytes int64 `json:"maxCapacityMegaBytes"`
}

func GetUserQuota added in v0.9.238

func GetUserQuota(cli bce.Client, ctx *BosContext, options ...Option) (*UserQuotaArgs, error)

GetUserQuota - get the quota of the caller(must be master user)

PARAMS:

  • cli: the client agent which can perform sending request
  • ctx: the context to control the request
  • options: the function set to set HTTP headers/params

RETURNS:

  • result: the user quota info
  • error: nil if success otherwise the specific error

Jump to

Keyboard shortcuts

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