Overview

This document describes all APIs of Object Storage Service (OBS) Go SDK, including the API description, method definition, and parameter description.

SDK API Overview

Interface

Method Definition

Function Description

Creating a Bucket

obsClient.CreateBucket

You can use this API to create a bucket.

Listing Buckets

obsClient.ListBuckets

You can use this API to obtain the bucket list. In the list, bucket names are displayed in lexicographical order.

Checking Whether a Bucket Exists

obsClient.HeadBucket

You can use this API to check whether a bucket exists.

Deleting a Bucket

obsClient.DeleteBucket

You can use this API to delete a bucket. The bucket to be deleted must be empty.

Listing Objects in a Bucket

obsClient.ListObjects

You can use this API to list objects in a bucket. By default, a maximum of 1000 objects are listed.

Listing Versioned Objects in a Bucket

obsClient.ListVersions

You can use this API to list versioned objects in a bucket. By default, a maximum of 1000 versioned objects are listed.

Obtaining Bucket Metadata

obsClient.GetBucketMetadata

You can use this API to send a HEAD request to a bucket to obtain the bucket metadata such as the CORS rules (if set), storage class, and other information.

Obtaining a Bucket Location

obsClient.GetBucketLocation

You can use this API to obtain the bucket location.

Obtaining Bucket Storage Information

obsClient.GetBucketStorageInfo

You can use this API to obtain storage information about a bucket, including the bucket size and number of objects in the bucket.

Setting a Bucket Quota

obsClient.SetBucketQuota

You can use this API to set the bucket quota. A bucket quota must be expressed in bytes and the maximum value is 263-1. Value 0 indicates that no upper limit is set for the bucket quota.

Obtaining a Bucket Quota

obsClient.GetBucketQuota

You can use this API to obtain the storage capacity quota of a bucket. Value 0 indicates that no upper limit is set for the bucket storage capacity.

Setting a Storage Class for a Bucket

obsClient.SetBucketStoragePolicy

You can use this API to set a storage class for a bucket. The storage class of an object defaults to be that of its residing bucket.

Obtaining the Storage Class of a Bucket

obsClient.GetBucketStoragePolicy

You can use this API to obtain the storage class of a bucket.

Setting a Bucket ACL

obsClient.SetBucketAcl

You can use this API to set a bucket ACL.

Obtaining a Bucket ACL

obsClient.GetBucketAcl

You can use this API to obtain a bucket ACL.

Configuring Logging for a Bucket

obsClient.SetBucketLoggingConfiguration

You can use this API to configure the logging function for a bucket.

Obtaining Logging Configuration of a Bucket

obsClient.GetBucketLoggingConfiguration

You can use this API to obtain the logging configuration of a bucket.

Configuring a Bucket Policy

obsClient.SetBucketPolicy

You can use this API to set a bucket policy. If the bucket already has a policy, the policy will be overwritten by the one specified in this request.

Obtaining a Bucket Policy

obsClient.GetBucketPolicy

You can use this API to obtain the configuration information of a bucket policy.

Deleting a Bucket Policy

obsClient.DeleteBucketPolicy

You can use this API to delete a bucket policy.

Configuring Lifecycle Rules for a Bucket

obsClient.SetBucketLifecycleConfiguration

You can use this API to set lifecycle rules for a bucket, to periodically transit storage classes of objects and delete objects in the bucket.

Obtaining Lifecycle Rules of a Bucket

obsClient.GetBucketLifecycleConfiguration

You can use this API to obtain the lifecycle configuration information of a bucket.

Deleting Lifecycle Rules of a Bucket

obsClient.DeleteBucketLifecycleConfiguration

You can use this API to delete all lifecycle rules of a bucket.

Configuring Website Hosting for a Bucket

obsClient.SetBucketWebsiteConfiguration

You can use this API to configure website hosting for a bucket.

Obtaining Website Hosting Settings of a Bucket

obsClient.GetBucketWebsiteConfiguration

You can use this API to obtain the website hosting settings of a bucket.

Deleting Website Hosting Settings of a Bucket

obsClient.DeleteBucketWebsiteConfiguration

You can use this API to delete the website hosting settings of a bucket.

Setting the Versioning Status for a Bucket

obsClient.SetBucketVersioning

You can use this API to set the versioning status for a bucket.

Obtaining the Versioning Status of a Bucket

obsClient.GetBucketVersioning

You can use this API to obtain the versioning status of a bucket.

Configuring CORS Rules for a Bucket

obsClient.SetBucketCors

You can use this API to configure CORS rules for a bucket to allow client browsers to send cross-domain requests.

Obtaining CORS Rules of a Bucket

obsClient.GetBucketCors

You can use this API to obtain the CORS rules of a specified bucket.

Deleting CORS Rules of a Bucket

obsClient.DeleteBucketCors

You can use this API to delete the CORS rules of a specified bucket.

Configuring the Event Notifications for a Bucket

obsClient.SetBucketNotification

You can use this API to configure event notification for a bucket, so that you can be notified of all specified operations performed on the bucket.

Obtaining the Event Notification Settings of a Bucket

obsClient.GetBucketNotification

You can use this API to obtain the event notification settings of a bucket.

Setting Bucket Tags

obsClient.SetBucketTagging

You can use this API to add tags to a bucket.

Obtaining Bucket Tags

obsClient.GetBucketTagging

You can use this API to obtain the tag settings of a specified bucket.

Deleting Bucket Tags

obsClient.DeleteBucketTagging

You can use this API to delete tags of a specified bucket.

Object Upload Overview

obsClient.PutObject

You can use this API to upload an object to a specified bucket.

Uploading Objects - File-Based

obsClient.PutFile

You can use this API to upload a file or folder to a specified bucket.

Object Download Overview

obsClient.GetObject

You can use this API to download an object in a specified bucket.

Copying an Object

obsClient.CopyObject

You can use this API to create a copy for an object in a specified bucket.

Deleting an Object

obsClient.DeleteObject

You can use this API to delete an object from a specified bucket.

Deleting Objects in a Batch

obsClient.DeleteObjects

You can use this API to delete objects from a specified bucket in a batch.

Obtaining Object Metadata

obsClient.GetObjectMetadata

You can use this API to send a HEAD request to obtain the metadata of an object in a specified bucket.

Setting an Object ACL

obsClient.SetObjectAcl

You can use this API to set the ACL for an object in a specified bucket.

Obtaining an Object ACL

obsClient.GetObjectAcl

You can use this API to obtain the ACL information of an object in a specified bucket.

Initializing a Multipart Upload

obsClient.InitiateMultipartUpload

You can use this API to initialize a multipart upload in a specified bucket.

Uploading a Part

obsClient.UploadPart

After a multipart upload is initialized, you can use this API to upload a part to a specified bucket by using the multipart upload ID.

Copying a Part

obsClient.CopyPart

After a multipart upload is initialized, you can use this API to copy a part of a multipart upload task to a specified bucket.

Listing Uploaded Parts

obsClient.ListParts

You can use this API to list the uploaded parts in a specified bucket by using the multipart upload ID.

Listing Multipart Uploads

obsClient.ListMultipartUploads

You can use this API to list the multipart upload tasks that are initialized but not combined or aborted in a specified bucket.

Combining Parts

obsClient.CompleteMultipartUpload

You can use this API to combine the uploaded parts in a specified bucket by using the multipart upload ID.

Aborting a Multipart Upload

obsClient.AbortMultipartUpload

You can use this API to abort a multipart upload in a bucket by specifying the multipart upload ID.

Restoring Archive Objects

obsClient.RestoreObject

You can use this API to restore an object from the OBS Archive storage class in a specified bucket.

obsClient.RestoreObject

You can use this API to restore an object from the OBS Cold storage class in a specified bucket.

Creating a Signed URL

obsClient.CreateSignedUrl

You can use this API to generate a URL whose Query parameter is carried with authentication information, by specifying the AK and SK, HTTP method, and request parameter. You can use a signed URL to perform specific operations on OBS.

Uploading Objects - Resumable Transfer

obsClient.UploadFile

You can use this API to encapsulate and enhance multipart upload in response to an upload failure of large files due to unstable network or program breakdown.

Downloading Objects - Resumable Transfer

obsClient.DownloadFile

You can use this API to encapsulate and enhance partial download in response to a download failure of large files due to unstable network or program breakdown.