bos

package
v0.9.52 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 97

Documentation

Overview

Package bos defines the BOS services of BCE. The supported APIs are all defined in sub-package model with three types: 16 bucket APIs, 9 object APIs and 7 multipart APIs.

Index

Constants

View Source
const (
	DEFAULT_SERVICE_DOMAIN = bce.DEFAULT_REGION + ".bcebos.com"
	DEFAULT_MAX_PARALLEL   = 10
	MULTIPART_ALIGN        = 1 << 20        // 1MB
	MIN_MULTIPART_SIZE     = 1 << 20        // 1MB
	DEFAULT_MULTIPART_SIZE = 12 * (1 << 20) // 12MB

	MAX_PART_NUMBER        = 10000
	MAX_SINGLE_PART_SIZE   = 5 * (1 << 30) // 5GB
	MAX_SINGLE_OBJECT_SIZE = 5 * (1 << 40) // 5TB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BosClientConfiguration added in v0.9.21

type BosClientConfiguration struct {
	Ak               string
	Sk               string
	Endpoint         string
	RedirectDisabled bool
}

BosClientConfiguration defines the config components structure by user.

type Client

type Client struct {
	*bce.BceClient

	// Fileds that used in parallel operation for BOS service
	MaxParallel   int64
	MultipartSize int64
}

Client of BOS service is a kind of BceClient, so derived from BceClient

func NewClient

func NewClient(ak, sk, endpoint string) (*Client, error)

NewClient make the BOS service client with default configuration. Use `cli.Config.xxx` to access the config or change it to non-default value.

func NewClientWithConfig added in v0.9.21

func NewClientWithConfig(config *BosClientConfiguration) (*Client, error)

func (*Client) AbortMultipartUpload

func (c *Client) AbortMultipartUpload(bucket, object, uploadId string) error

AbortMultipartUpload - abort a multipart upload operation

PARAMS:

  • 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 (*Client) AppendObject

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

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

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • content: the append object stream
  • args: the optional arguments to append object

RETURNS:

  • *api.AppendObjectResult: the result of the appended object
  • error: any error if it occurs

func (*Client) BasicCopyObject

func (c *Client) BasicCopyObject(bucket, object, srcBucket,
	srcObject string) (*api.CopyObjectResult, error)

BasicCopyObject - the basic interface of copying a object to another one

PARAMS:

  • bucket: the name of the destination bucket
  • object: the name of the destination object
  • srcBucket: the name of the source bucket
  • srcObject: the name of the source object

RETURNS:

  • *api.CopyObjectResult: result struct which contains "ETag" and "LastModified" fields
  • error: any error if it occurs

func (*Client) BasicFetchObject

func (c *Client) BasicFetchObject(bucket, object, source string) (*api.FetchObjectResult, error)

BasicFetchObject - the basic interface of the fetch object api

PARAMS:

  • bucket: the name of the bucket to store
  • object: the name of the object to store
  • source: fetch source url

RETURNS:

  • *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields
  • error: any error if it occurs

func (*Client) BasicGeneratePresignedUrl

func (c *Client) BasicGeneratePresignedUrl(bucket, object string, expireInSeconds int) string

BasicGeneratePresignedUrl - basic interface to generate an authorization url with expire time

PARAMS:

  • bucket: the target bucket name
  • object: the target object name
  • expireInSeconds: the expire time in seconds of the signed url

RETURNS:

  • string: the presigned url with authorization string

func (*Client) BasicGetObject

func (c *Client) BasicGetObject(bucket, object string) (*api.GetObjectResult, error)

BasicGetObject - the basic interface of geting the given object

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object

RETURNS:

func (*Client) BasicGetObjectToFile

func (c *Client) BasicGetObjectToFile(bucket, object, filePath string) error

BasicGetObjectToFile - use basic interface to get the given object to the given file path

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • filePath: the file path to store the object content

RETURNS:

  • error: any error if it occurs

func (*Client) BasicInitiateMultipartUpload

func (c *Client) BasicInitiateMultipartUpload(bucket,
	object string) (*api.InitiateMultipartUploadResult, error)

BasicInitiateMultipartUpload - basic interface to initiate a multipart upload

PARAMS:

  • bucket: the bucket name
  • object: the object name

RETURNS:

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

func (*Client) BasicListMultipartUploads

func (c *Client) BasicListMultipartUploads(bucket string) (
	*api.ListMultipartUploadsResult, error)

BasicListMultipartUploads - basic interface to list the unfinished uploaded parts

PARAMS:

  • bucket: the destination bucket name

RETURNS:

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

func (*Client) BasicListParts

func (c *Client) BasicListParts(bucket, object, uploadId string) (*api.ListPartsResult, error)

BasicListParts - basic interface to list the successfully uploaded parts info by upload id

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • uploadId: the multipart upload id

RETURNS:

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

func (*Client) BasicPutObject

func (c *Client) BasicPutObject(bucket, object string, body *bce.Body) (string, error)

BasicPutObject - the basic interface of uploading an object

PARAMS:

  • bucket: the name of the bucket to store the object
  • object: the name of the object
  • body: the object content body

RETURNS:

  • string: etag of the uploaded object
  • error: the uploaded error if any occurs

func (*Client) BasicUploadPart

func (c *Client) BasicUploadPart(bucket, object, uploadId string, partNumber int,
	content *bce.Body) (string, error)

BasicUploadPart - basic interface to upload the single part in the multipart upload process

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • uploadId: the multipart upload id
  • partNumber: the current part number
  • content: the uploaded part content

RETURNS:

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

func (*Client) BasicUploadPartCopy

func (c *Client) BasicUploadPartCopy(bucket, object, srcBucket, srcObject, uploadId string,
	partNumber int) (*api.CopyObjectResult, error)

BasicUploadPartCopy - basic interface to copy the multipart object

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • srcBucket: the source bucket
  • srcObject: the source object
  • uploadId: the multipart upload id
  • partNumber: the current part number

RETURNS:

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

func (*Client) CompleteMultipartUpload

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

CompleteMultipartUpload - finish a multipart upload operation with parts stream

PARAMS:

  • 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

func (*Client) CompleteMultipartUploadFromStruct

func (c *Client) CompleteMultipartUploadFromStruct(bucket, object, uploadId string,
	args *api.CompleteMultipartUploadArgs) (*api.CompleteMultipartUploadResult, error)

CompleteMultipartUploadFromStruct - finish a multipart upload operation with parts struct

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • uploadId: the multipart upload id
  • args: args info struct object

RETURNS:

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

func (*Client) CopyObject

func (c *Client) CopyObject(bucket, object, srcBucket, srcObject string,
	args *api.CopyObjectArgs) (*api.CopyObjectResult, error)

CopyObject - copy a remote object to another one

PARAMS:

  • bucket: the name of the destination bucket
  • object: the name of the destination object
  • srcBucket: the name of the source bucket
  • srcObject: the name of the source object
  • args: the optional arguments for copying object which are MetadataDirective, StorageClass, IfMatch, IfNoneMatch, ifModifiedSince, IfUnmodifiedSince

RETURNS:

  • *api.CopyObjectResult: result struct which contains "ETag" and "LastModified" fields
  • error: any error if it occurs

func (*Client) DeleteBucket

func (c *Client) DeleteBucket(bucket string) error

DeleteBucket - delete a empty bucket

PARAMS:

  • bucket: the bucket name to be deleted

RETURNS:

  • error: nil if delete success otherwise the specific error

func (*Client) DeleteBucketCopyrightProtection

func (c *Client) DeleteBucketCopyrightProtection(bucket string) error

DeleteBucketCopyrightProtection - delete the bucket copyright protection config

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketCors

func (c *Client) DeleteBucketCors(bucket string) error

DeleteBucketCors - delete the bucket CORS config of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketEncryption

func (c *Client) DeleteBucketEncryption(bucket string) error

DeleteBucketEncryption - delete the bucket encryption config of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketLifecycle

func (c *Client) DeleteBucketLifecycle(bucket string) error

DeleteBucketLifecycle - delete the lifecycle rule of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketLogging

func (c *Client) DeleteBucketLogging(bucket string) error

DeleteBucketLogging - delete the logging setting of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketNotification

func (c *Client) DeleteBucketNotification(bucket string) error

DeleteBucketNotification - delete the notification of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketReplication

func (c *Client) DeleteBucketReplication(bucket string, replicationRuleId string) error

DeleteBucketReplication - delete the bucket replication config of the given bucket

PARAMS:

  • 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 (*Client) DeleteBucketStaticWebsite

func (c *Client) DeleteBucketStaticWebsite(bucket string) error

DeleteBucketStaticWebsite - delete the bucket static website config of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteBucketTrash

func (c *Client) DeleteBucketTrash(bucket string) error

DeleteBucketTrash - delete the trash of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DeleteMultipleObjects

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

DeleteMultipleObjects - delete a list of objects

PARAMS:

  • bucket: the name of the bucket to delete
  • objectListStream: the object list stream to be deleted

RETURNS:

  • *api.DeleteMultipleObjectsResult: the delete information
  • error: any error if it occurs

func (*Client) DeleteMultipleObjectsFromKeyList

func (c *Client) DeleteMultipleObjectsFromKeyList(bucket string,
	keyList []string) (*api.DeleteMultipleObjectsResult, error)

DeleteMultipleObjectsFromKeyList - delete a list of objects with given key string array

PARAMS:

  • bucket: the name of the bucket to delete
  • keyList: the key string list to be deleted

RETURNS:

  • *api.DeleteMultipleObjectsResult: the delete information
  • error: any error if it occurs

func (*Client) DeleteMultipleObjectsFromString

func (c *Client) DeleteMultipleObjectsFromString(bucket,
	objectListString string) (*api.DeleteMultipleObjectsResult, error)

DeleteMultipleObjectsFromString - delete a list of objects with json format string

PARAMS:

  • bucket: the name of the bucket to delete
  • objectListString: the object list string to be deleted

RETURNS:

  • *api.DeleteMultipleObjectsResult: the delete information
  • error: any error if it occurs

func (*Client) DeleteMultipleObjectsFromStruct

func (c *Client) DeleteMultipleObjectsFromStruct(bucket string,
	objectListStruct *api.DeleteMultipleObjectsArgs) (*api.DeleteMultipleObjectsResult, error)

DeleteMultipleObjectsFromStruct - delete a list of objects with object list struct

PARAMS:

  • bucket: the name of the bucket to delete
  • objectListStruct: the object list struct to be deleted

RETURNS:

  • *api.DeleteMultipleObjectsResult: the delete information
  • error: any error if it occurs

func (*Client) DeleteObject

func (c *Client) DeleteObject(bucket, object string) error

DeleteObject - delete the given object

PARAMS:

  • bucket: the name of the bucket to delete
  • object: the name of the object to delete

RETURNS:

  • error: any error if it occurs

func (*Client) DeleteObjectAcl

func (c *Client) DeleteObjectAcl(bucket, object string) error

DeleteObjectAcl - delete the acl of the given object

PARAMS:

  • bucket: the bucket name
  • object: the object name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DoesBucketExist

func (c *Client) DoesBucketExist(bucket string) (bool, error)

DoesBucketExist - test the given bucket existed or not

PARAMS:

  • bucket: the bucket name

RETURNS:

  • bool: true if exists and false if not exists or occurs error
  • error: nil if exists or not exist, otherwise the specific error

func (*Client) DownloadSuperFile

func (c *Client) DownloadSuperFile(bucket, object, fileName string) (err error)

DownloadSuperFile - parallel download the super file using the get object with range

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • fileName: the local full path filename to store the object

RETURNS:

  • error: nil if ok otherwise the specific error

func (*Client) FetchObject

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

FetchObject - fetch the object content from the given source and store

PARAMS:

  • bucket: the name of the bucket to store
  • object: the name of the object to store
  • source: fetch source url
  • args: the optional arguments to fetch the object

RETURNS:

  • *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields
  • error: any error if it occurs

func (*Client) GeneratePresignedUrl

func (c *Client) GeneratePresignedUrl(bucket, object string, expireInSeconds int, method string,
	headers, params map[string]string) string

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

PARAMS:

  • bucket: the target bucket name
  • object: the target object name
  • expireInSeconds: the expire time in seconds of the signed url
  • 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 (*Client) GetBucketAcl

func (c *Client) GetBucketAcl(bucket string) (*api.GetBucketAclResult, error)

GetBucketAcl - get the acl of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketCopyrightProtection

func (c *Client) GetBucketCopyrightProtection(bucket string) ([]string, error)

GetBucketCopyrightProtection - get the bucket copyright protection config

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketCors

func (c *Client) GetBucketCors(bucket string) (*api.GetBucketCorsResult, error)

GetBucketCors - get the bucket CORS config

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketEncryption

func (c *Client) GetBucketEncryption(bucket string) (string, error)

GetBucketEncryption - get the bucket encryption config

PARAMS:

  • bucket: the bucket name

RETURNS:

  • string: the encryption algorithm name
  • error: nil if success otherwise the specific error

func (*Client) GetBucketLifecycle

func (c *Client) GetBucketLifecycle(bucket string) (*api.GetBucketLifecycleResult, error)

GetBucketLifecycle - get the lifecycle rule of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketLocation

func (c *Client) GetBucketLocation(bucket string) (string, error)

GetBucketLocation - get the location fo the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketLogging

func (c *Client) GetBucketLogging(bucket string) (*api.GetBucketLoggingResult, error)

GetBucketLogging - get the logging setting of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketNotification

func (c *Client) GetBucketNotification(bucket string) (*api.PutBucketNotificationReq, error)

GetBucketNotification - get the bucket notification

PARAMS:

  • bucket: the bucket name

RETURNS:

  • *api.PutBucketNotificationReq,: the result of the bucket notification
  • error: nil if success otherwise the specific error

func (*Client) GetBucketReplication

func (c *Client) GetBucketReplication(bucket string, replicationRuleId string) (*api.GetBucketReplicationResult, error)

GetBucketReplication - get the bucket replication config of the given bucket

PARAMS:

  • bucket: the bucket name
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

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

func (*Client) GetBucketReplicationProgress

func (c *Client) GetBucketReplicationProgress(bucket string, replicationRuleId string) (
	*api.GetBucketReplicationProgressResult, error)

GetBucketReplicationProgress - get the bucket replication process of the given bucket

PARAMS:

  • bucket: the bucket name
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

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

func (*Client) GetBucketStaticWebsite

func (c *Client) GetBucketStaticWebsite(bucket string) (
	*api.GetBucketStaticWebsiteResult, error)

GetBucketStaticWebsite - get the bucket static website config

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) GetBucketStorageclass

func (c *Client) GetBucketStorageclass(bucket string) (string, error)

GetBucketStorageclass - get the storage class of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • string: the storage class string value
  • error: nil if success otherwise the specific error

func (*Client) GetBucketTrash

func (c *Client) GetBucketTrash(bucket string) (*api.GetBucketTrashResult, error)

GetBucketTrash - get the bucket trash

PARAMS:

  • bucket: the bucket name

RETURNS:

  • *api.GetBucketTrashResult,: the result of the bucket trash
  • error: nil if success otherwise the specific error

func (*Client) GetObject

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

GetObject - get the given object with raw stream return

PARAMS:

  • bucket: the name of the bucket
  • 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:

func (*Client) GetObjectAcl

func (c *Client) GetObjectAcl(bucket, object string) (*api.GetObjectAclResult, error)

GetObjectAcl - get the acl of the given object

PARAMS:

  • bucket: the bucket name
  • object: the object name

RETURNS:

  • *api.GetObjectAclResult: the result of the object acl
  • error: nil if success otherwise the specific error

func (*Client) GetObjectMeta

func (c *Client) GetObjectMeta(bucket, object string) (*api.GetObjectMetaResult, error)

GetObjectMeta - get the given object metadata

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object

RETURNS:

func (c *Client) GetSymlink(bucket string, object string) (string, error)

PutSymlink - create symlink for exist target object

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the symlink

RETURNS:

  • string: the target of the symlink
  • error: the put error if any occurs

func (*Client) HeadBucket

func (c *Client) HeadBucket(bucket string) error

HeadBucket - test the given bucket existed and access authority

PARAMS:

  • bucket: the bucket name

RETURNS:

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

func (*Client) InitiateMultipartUpload

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

InitiateMultipartUpload - initiate a multipart upload to get a upload ID

PARAMS:

  • 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

func (*Client) ListBucketReplication added in v0.9.16

func (c *Client) ListBucketReplication(bucket string) (*api.ListBucketReplicationResult, error)

ListBucketReplication - get all replication config of the given bucket

PARAMS:

  • bucket: the bucket name

RETURNS:

  • *api.ListBucketReplicationResult: the list of the bucket replication config
  • error: nil if success otherwise the specific error

func (*Client) ListBuckets

func (c *Client) ListBuckets() (*api.ListBucketsResult, error)

ListBuckets - list all buckets

RETURNS:

  • *api.ListBucketsResult: the all buckets
  • error: the return error if any occurs

func (*Client) ListMultipartUploads

func (c *Client) ListMultipartUploads(bucket string,
	args *api.ListMultipartUploadsArgs) (*api.ListMultipartUploadsResult, error)

ListMultipartUploads - list the unfinished uploaded parts of the given bucket

PARAMS:

  • 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

func (*Client) ListObjects

func (c *Client) ListObjects(bucket string,
	args *api.ListObjectsArgs) (*api.ListObjectsResult, error)

ListObjects - list all objects of the given bucket

PARAMS:

  • bucket: the bucket name
  • args: the optional arguments to list objects

RETURNS:

  • *api.ListObjectsResult: the all objects of the bucket
  • error: the return error if any occurs

func (*Client) ListParts

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

ListParts - list the successfully uploaded parts info by upload id

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • uploadId: the multipart upload id
  • args: the optional arguments

RETURNS:

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

func (*Client) ParallelCopy

func (c *Client) ParallelCopy(srcBucketName string, srcObjectName string,
	destBucketName string, destObjectName string,
	args *api.MultiCopyObjectArgs, srcClient *Client) (*api.CompleteMultipartUploadResult, error)

ParallelCopy - auto multipart copy object

PARAMS:

  • srcBucketName: the src bucket name
  • srcObjectName: the src object name
  • destBucketName: the dest bucket name
  • destObjectName: the dest object name
  • args: the copy args
  • srcClient: the src region client

RETURNS:

  • *api.CompleteMultipartUploadResult: multipart upload result
  • error: nil if success otherwise the specific error

func (*Client) ParallelUpload

func (c *Client) ParallelUpload(bucket string, object string, filename string, contentType string, args *api.InitiateMultipartUploadArgs) (*api.CompleteMultipartUploadResult, error)

ParallelUpload - auto multipart upload object

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • filename: the filename
  • contentType: the content type default(application/octet-stream)
  • args: the bucket name nil using default

RETURNS:

  • *api.CompleteMultipartUploadResult: multipart upload result
  • error: nil if success otherwise the specific error

func (*Client) PutBucket

func (c *Client) PutBucket(bucket string) (string, error)

PutBucket - create a new bucket

PARAMS:

  • 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 (*Client) PutBucketAcl

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

PutBucketAcl - set the acl of the given bucket with acl body stream

PARAMS:

  • bucket: the bucket name
  • aclBody: the acl json body stream

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketAclFromCanned

func (c *Client) PutBucketAclFromCanned(bucket, cannedAcl string) error

PutBucketAclFromCanned - set the canned acl of the given bucket

PARAMS:

  • bucket: the bucket name
  • cannedAcl: the cannedAcl string

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketAclFromFile

func (c *Client) PutBucketAclFromFile(bucket, aclFile string) error

PutBucketAclFromFile - set the acl of the given bucket with acl json file name

PARAMS:

  • bucket: the bucket name
  • aclFile: the acl file name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketAclFromString

func (c *Client) PutBucketAclFromString(bucket, aclString string) error

PutBucketAclFromString - set the acl of the given bucket with acl json string

PARAMS:

  • bucket: the bucket name
  • aclString: the acl string with json format

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketAclFromStruct

func (c *Client) PutBucketAclFromStruct(bucket string, aclObj *api.PutBucketAclArgs) error

PutBucketAclFromStruct - set the acl of the given bucket with acl data structure

PARAMS:

  • bucket: the bucket name
  • aclObj: the acl struct object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketCopyrightProtection

func (c *Client) PutBucketCopyrightProtection(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 (*Client) PutBucketCors

func (c *Client) PutBucketCors(bucket string, config *bce.Body) error

PutBucketCors - set the bucket CORS config

PARAMS:

  • bucket: the bucket name
  • config: the bucket CORS config body stream

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketCorsFromFile

func (c *Client) PutBucketCorsFromFile(bucket, filename string) error

PutBucketCorsFromFile - set the bucket CORS config from json config file

PARAMS:

  • bucket: the bucket name
  • filename: the bucket CORS json config file name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketCorsFromString

func (c *Client) PutBucketCorsFromString(bucket, jsonConfig string) error

PutBucketCorsFromString - set the bucket CORS config from json config string

PARAMS:

  • bucket: the bucket name
  • filename: the bucket CORS json config string

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketCorsFromStruct

func (c *Client) PutBucketCorsFromStruct(bucket string, confObj *api.PutBucketCorsArgs) error

PutBucketCorsFromStruct - set the bucket CORS config from json config object

PARAMS:

  • bucket: the bucket name
  • filename: the bucket CORS json config object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketEncryption

func (c *Client) PutBucketEncryption(bucket, algorithm string) error

PutBucketEncryption - set the bucket encryption config of the given bucket

PARAMS:

  • bucket: the bucket name
  • algorithm: the encryption algorithm name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketLifecycle

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

PutBucketLifecycle - set the lifecycle rule of the given bucket with raw stream

PARAMS:

  • bucket: the bucket name
  • lifecycle: the lifecycle rule json body

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketLifecycleFromString

func (c *Client) PutBucketLifecycleFromString(bucket, lifecycle string) error

PutBucketLifecycleFromString - set the lifecycle rule of the given bucket with string

PARAMS:

  • bucket: the bucket name
  • lifecycle: the lifecycle rule json format string body

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketLogging

func (c *Client) PutBucketLogging(bucket string, body *bce.Body) error

PutBucketLogging - set the loging setting of the given bucket with json stream

PARAMS:

  • bucket: the bucket name
  • body: the json body

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketLoggingFromString

func (c *Client) PutBucketLoggingFromString(bucket, logging string) error

PutBucketLoggingFromString - set the loging setting of the given bucket with json string

PARAMS:

  • bucket: the bucket name
  • logging: the json format string

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketLoggingFromStruct

func (c *Client) PutBucketLoggingFromStruct(bucket string, obj *api.PutBucketLoggingArgs) error

PutBucketLoggingFromStruct - set the loging setting of the given bucket with args object

PARAMS:

  • bucket: the bucket name
  • obj: the logging setting object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketNotification

func (c *Client) PutBucketNotification(bucket string, putBucketNotificationReq api.PutBucketNotificationReq) error

PutBucketNotification - put the bucket notification

PARAMS:

  • bucket: the bucket name
  • putBucketNotificationReq: the bucket notification request

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketReplication

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

PutBucketReplication - set the bucket replication config of different region

PARAMS:

  • bucket: the bucket name
  • replicationConf: the replication config json 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 (*Client) PutBucketReplicationFromFile

func (c *Client) PutBucketReplicationFromFile(bucket, confFile string, replicationRuleId string) error

PutBucketReplicationFromFile - set the bucket replication config with json file name

PARAMS:

  • bucket: the bucket name
  • confFile: the config json file name
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketReplicationFromString

func (c *Client) PutBucketReplicationFromString(bucket, confString string, replicationRuleId string) error

PutBucketReplicationFromString - set the bucket replication config with json string

PARAMS:

  • bucket: the bucket name
  • confString: the config string with json format
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketReplicationFromStruct

func (c *Client) PutBucketReplicationFromStruct(bucket string,
	confObj *api.PutBucketReplicationArgs, replicationRuleId string) error

PutBucketReplicationFromStruct - set the bucket replication config with struct

PARAMS:

  • bucket: the bucket name
  • confObj: the replication config struct object
  • replicationRuleId: the replication rule id composed of [0-9 A-Z a-z _ -]

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketStaticWebsite

func (c *Client) PutBucketStaticWebsite(bucket string, config *bce.Body) error

PutBucketStaticWebsite - set the bucket static website config

PARAMS:

  • bucket: the bucket name
  • config: the static website config body stream

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketStaticWebsiteFromString

func (c *Client) PutBucketStaticWebsiteFromString(bucket, jsonConfig string) error

PutBucketStaticWebsiteFromString - set the bucket static website config from json string

PARAMS:

  • bucket: the bucket name
  • jsonConfig: the static website config json string

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketStaticWebsiteFromStruct

func (c *Client) PutBucketStaticWebsiteFromStruct(bucket string,
	confObj *api.PutBucketStaticWebsiteArgs) error

PutBucketStaticWebsiteFromStruct - set the bucket static website config from struct

PARAMS:

  • bucket: the bucket name
  • confObj: the static website config object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketStorageclass

func (c *Client) PutBucketStorageclass(bucket, storageClass string) error

PutBucketStorageclass - set the storage class of the given bucket

PARAMS:

  • bucket: the bucket name
  • storageClass: the storage class string value

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutBucketTrash

func (c *Client) PutBucketTrash(bucket string, trashReq api.PutBucketTrashReq) error

PutBucketTrash - put the bucket trash

PARAMS:

  • bucket: the bucket name
  • trashReq: the trash request

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObject

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

PutObject - upload a new object or rewrite the existed object with raw stream

PARAMS:

  • bucket: the name of the bucket to store the object
  • object: the name of the object
  • body: the object content body
  • args: the optional arguments

RETURNS:

  • string: etag of the uploaded object
  • error: the uploaded error if any occurs

func (*Client) PutObjectAcl

func (c *Client) PutObjectAcl(bucket, object string, aclBody *bce.Body) error

PutObjectAcl - set the ACL of the given object

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • aclBody: the acl json body stream

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectAclFromCanned

func (c *Client) PutObjectAclFromCanned(bucket, object, cannedAcl string) error

PutObjectAclFromCanned - set the canned acl of the given object

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • cannedAcl: the cannedAcl string

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectAclFromFile

func (c *Client) PutObjectAclFromFile(bucket, object, aclFile string) error

PutObjectAclFromFile - set the acl of the given object with acl json file name

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • aclFile: the acl file name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectAclFromString

func (c *Client) PutObjectAclFromString(bucket, object, aclString string) error

PutObjectAclFromString - set the acl of the given object with acl json string

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • aclString: the acl string with json format

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectAclFromStruct

func (c *Client) PutObjectAclFromStruct(bucket, object string, aclObj *api.PutObjectAclArgs) error

PutObjectAclFromStruct - set the acl of the given object with acl data structure

PARAMS:

  • bucket: the bucket name
  • aclObj: the acl struct object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectAclGrantFullControl

func (c *Client) PutObjectAclGrantFullControl(bucket, object string, ids ...string) error

PutObjectAclGrantFullControl - set the canned grant full-control acl of the given object

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • ids: the user id list to grant full-control for this object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectAclGrantRead

func (c *Client) PutObjectAclGrantRead(bucket, object string, ids ...string) error

PutObjectAclGrantRead - set the canned grant read acl of the given object

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • ids: the user id list to grant read for this object

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) PutObjectFromBytes

func (c *Client) PutObjectFromBytes(bucket, object string, bytesArr []byte,
	args *api.PutObjectArgs) (string, error)

PutObjectFromBytes - upload a new object or rewrite the existed object from a byte array

PARAMS:

  • bucket: the name of the bucket to store the object
  • object: the name of the object
  • bytesArr: the content byte array
  • args: the optional arguments

RETURNS:

  • string: etag of the uploaded object
  • error: the uploaded error if any occurs

func (*Client) PutObjectFromFile

func (c *Client) PutObjectFromFile(bucket, object, fileName string,
	args *api.PutObjectArgs) (string, error)

PutObjectFromFile - upload a new object or rewrite the existed object from a local file

PARAMS:

  • bucket: the name of the bucket to store the object
  • object: the name of the object
  • fileName: the local file full path name
  • args: the optional arguments

RETURNS:

  • string: etag of the uploaded object
  • error: the uploaded error if any occurs

func (*Client) PutObjectFromString

func (c *Client) PutObjectFromString(bucket, object, content string,
	args *api.PutObjectArgs) (string, error)

PutObjectFromString - upload a new object or rewrite the existed object from a string

PARAMS:

  • bucket: the name of the bucket to store the object
  • object: the name of the object
  • content: the content string
  • args: the optional arguments

RETURNS:

  • string: etag of the uploaded object
  • error: the uploaded error if any occurs
func (c *Client) PutSymlink(bucket string, object string, symlinkKey string, symlinkArgs *api.PutSymlinkArgs) error

PutSymlink - create symlink for exist target object

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • symlinkKey: the name of the symlink
  • symlinkArgs: the optional arguments

RETURNS:

  • error: the put error if any occurs

func (*Client) RestoreObject

func (c *Client) RestoreObject(bucket string, object string, restoreDays int, restoreTier string) error

RestoreObject - restore the archive object

PARAMS:

  • bucket: the bucket name
  • object: the object name
  • restoreDays: the effective time of restore
  • restoreTier: the tier of restore

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SelectObject

func (c *Client) SelectObject(bucket, object string, args *api.SelectObjectArgs) (*api.SelectObjectResult, error)

SelectObject - select the object content

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • args: the optional arguments to select the object

RETURNS:

  • *api.SelectObjectResult: select object result
  • error: any error if it occurs

func (*Client) SimpleAppendObject

func (c *Client) SimpleAppendObject(bucket, object string, content *bce.Body,
	offset int64) (*api.AppendObjectResult, error)

SimpleAppendObject - the interface to append object with simple offset argument

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • content: the append object stream
  • offset: the offset of where to append

RETURNS:

  • *api.AppendObjectResult: the result of the appended object
  • error: any error if it occurs

func (*Client) SimpleAppendObjectFromFile

func (c *Client) SimpleAppendObjectFromFile(bucket, object, filePath string,
	offset int64) (*api.AppendObjectResult, error)

SimpleAppendObjectFromFile - the simple interface of appending an object from a file

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • filePath: the full file path
  • offset: the offset of where to append

RETURNS:

  • *api.AppendObjectResult: the result of the appended object
  • error: any error if it occurs

func (*Client) SimpleAppendObjectFromString

func (c *Client) SimpleAppendObjectFromString(bucket, object, content string,
	offset int64) (*api.AppendObjectResult, error)

SimpleAppendObjectFromString - the simple interface of appending an object from a string

PARAMS:

  • bucket: the name of the bucket
  • object: the name of the object
  • content: the object string to append
  • offset: the offset of where to append

RETURNS:

  • *api.AppendObjectResult: the result of the appended object
  • error: any error if it occurs

func (*Client) SimpleFetchObject

func (c *Client) SimpleFetchObject(bucket, object, source, mode,
	storageClass string) (*api.FetchObjectResult, error)

SimpleFetchObject - fetch object with simple arguments interface

PARAMS:

  • bucket: the name of the bucket to store
  • object: the name of the object to store
  • source: fetch source url
  • mode: fetch mode which supports sync and async
  • storageClass: the storage class of the fetched object

RETURNS:

  • *api.FetchObjectResult: result struct with Code, Message, RequestId and JobId fields
  • error: any error if it occurs

func (*Client) SimpleListObjects

func (c *Client) SimpleListObjects(bucket, prefix string, maxKeys int, marker,
	delimiter string) (*api.ListObjectsResult, error)

SimpleListObjects - list all objects of the given bucket with simple arguments

PARAMS:

  • bucket: the bucket name
  • prefix: the prefix for listing
  • maxKeys: the max number of result objects
  • marker: the marker to mark the beginning for the listing
  • delimiter: the delimiter for list objects

RETURNS:

  • *api.ListObjectsResult: the all objects of the bucket
  • error: the return error if any occurs

func (*Client) SimplePutBucketStaticWebsite

func (c *Client) SimplePutBucketStaticWebsite(bucket, index, notFound string) error

SimplePutBucketStaticWebsite - simple set the bucket static website config

PARAMS:

  • bucket: the bucket name
  • index: the static website config for index file name
  • notFound: the static website config for notFound file name

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) UploadPart

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

UploadPart - upload the single part in the multipart upload process

PARAMS:

  • 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 (*Client) UploadPartCopy

func (c *Client) UploadPartCopy(bucket, object, srcBucket, srcObject, uploadId string,
	partNumber int, args *api.UploadPartCopyArgs) (*api.CopyObjectResult, error)

UploadPartCopy - copy the multipart object

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • srcBucket: the source bucket
  • srcObject: the source object
  • 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

func (*Client) UploadPartFromBytes added in v0.9.18

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

UploadPartFromBytes - upload the single part in the multipart upload process

PARAMS:

  • 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 (*Client) UploadSuperFile

func (c *Client) UploadSuperFile(bucket, object, fileName, storageClass string) error

UploadSuperFile - parallel upload the super file by using the multipart upload interface

PARAMS:

  • bucket: the destination bucket name
  • object: the destination object name
  • fileName: the local full path filename of the super file
  • storageClass: the storage class to be set to the uploaded file

RETURNS:

  • error: nil if ok otherwise the specific error

Directories

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

Jump to

Keyboard shortcuts

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