Help Center/ Object Storage Service/ SDK Reference/ Go/ API Overview of OBS SDK for Go
Updated on 2023-12-22 GMT+08:00

API Overview of OBS SDK for Go

Table 1 describes the APIs provided by OBS SDK for Go. You can click an API name in the table to see its detailed information and sample code.

Table 1 APIs provided by OBS SDK for Go

API

Method

Function

Creating a Bucket

obsClient.CreateBucket

Creates a bucket.

Obtaining a Bucket List

obsClient.ListBuckets

Returns a list of buckets in alphabetical order.

Checking Whether a Bucket Exists

obsClient.HeadBucket

Determines whether a bucket exists.

Deleting a Bucket

obsClient.DeleteBucket

Deletes an empty bucket.

Listing Objects in a Bucket

obsClient.ListObjects

Returns some or all (up to 1,000) of the objects in a bucket.

Listing Object Versions in a Bucket

obsClient.ListVersions

Lists some or all (up to 1,000) of the object versions in a bucket.

Obtaining Bucket Metadata

obsClient.GetBucketMetadata

Returns the metadata information of a bucket.

Obtaining the Region of a Bucket

obsClient.GetBucketLocation

Returns the region where the bucket is created.

Obtaining Storage Information of a Bucket

obsClient.GetBucketStorageInfo

Returns the storage information of a bucket, including the number of objects and the space occupied by the objects in the bucket.

Configuring a Storage Quota

obsClient.SetBucketQuota

Sets a storage quota for a bucket.

Obtaining a Bucket Storage Quota

obsClient.GetBucketQuota

Returns the storage quota of a bucket.

Configuring Storage Class for a Bucket

obsClient.SetBucketStoragePolicy

Configures a storage class for a bucket.

Obtaining the Storage Class of a Bucket

obsClient.GetBucketStoragePolicy

Returns the storage class of a bucket.

Configuring a Bucket ACL

obsClient.SetBucketAcl

Configures the ACL for a bucket.

Obtaining the Bucket ACL

obsClient.GetBucketAcl

Returns the bucket ACL.

Configuring Logging for a Bucket

obsClient.SetBucketLoggingConfiguration

Configures logging for a bucket.

Obtaining the Logging Configuration of a Bucket

obsClient.GetBucketLoggingConfiguration

Returns the logging configuration of a bucket.

Configuring a Bucket Policy

obsClient.SetBucketPolicy

Configures a policy for a bucket.

Obtaining the Policy of a Bucket

obsClient.GetBucketPolicy

Returns the policy of a bucket.

Deleting a Bucket Policy

obsClient.DeleteBucketPolicy

Deletes the policy of a bucket.

Configuring Lifecycle Rules for a Bucket

obsClient.SetBucketLifecycleConfiguration

Configure lifecycle rules for a bucket to periodically transition objects between storage classes and delete objects.

Obtaining the Lifecycle Configuration of a Bucket

obsClient.GetBucketLifecycleConfiguration

Returns the lifecycle configuration of a bucket.

Deleting the Lifecycle Configuration of a Bucket

obsClient.DeleteBucketLifecycleConfiguration

Deletes all lifecycle rules of a bucket.

Configuring Static Website Hosting for a Bucket

obsClient.SetBucketWebsiteConfiguration

Configures static website hosting for a bucket.

Obtaining the Static Website Hosting Configuration of a Bucket

obsClient.GetBucketWebsiteConfiguration

Returns the static website hosting configuration of a bucket.

Deleting the Static Website Hosting Configuration of a Bucket

obsClient.DeleteBucketWebsiteConfiguration

Deletes the static website hosting configuration of a bucket.

Configuring Versioning for a Bucket

obsClient.SetBucketVersioning

Configures versioning for a bucket.

Obtaining the Versioning Status of a Bucket

obsClient.GetBucketVersioning

Returns the versioning status of a bucket.

Configuring CORS for a Bucket

obsClient.SetBucketCors

Configures CORS for a bucket to allow cross-origin requests.

Obtaining the CORS Configuration of a Bucket

obsClient.GetBucketCors

Returns the CORS rules of a bucket.

Deleting the CORS Configuration of a Bucket

obsClient.DeleteBucketCors

Deletes the CORS configuration of a bucket.

Configuring Tags for a Bucket

obsClient.SetBucketTagging

Adds tags to a bucket.

Obtaining Bucket Tags

obsClient.GetBucketTagging

Returns the tags of a bucket.

Deleting Bucket Tags

obsClient.DeleteBucketTagging

Deletes the tags of a bucket.

Uploading an Object

obsClient.PutObject

Uploads an object to a bucket.

Uploading a File

obsClient.PutFile

Uploads a file or folder to a bucket.

Download an Object

obsClient.GetObject

Downloads an object from a bucket.

Copying an Object

obsClient.CopyObject

Creates a copy for a specified object.

Deleting an Object

obsClient.DeleteObject

Deletes a single object from a bucket.

Batch Deleting Objects

obsClient.DeleteObjects

Delete multiple objects from a bucket in a batch.

Obtaining Object Metadata

obsClient.GetObjectMetadata

Returns the object metadata.

Configuring Object Metadata

obsClient.SetObjectMetadata

Configures the metadata for an object.

Configuring an Object ACL

obsClient.SetObjectAcl

Configures the ACL for an object.

Obtaining Object ACL Information

obsClient.GetObjectAcl

Returns the ACL of an object.

Initiating a Multipart Upload

obsClient.InitiateMultipartUpload

Initiates a multipart upload in a bucket.

Uploading a Part

obsClient.UploadPart

Uploads parts to a bucket by specifying the multipart upload ID.

Copying a Part

obsClient.CopyPart

Copies a part to a specified bucket.

Listing Uploaded Parts

obsClient.ListParts

Returns the uploaded parts in a bucket by specifying the multipart upload ID.

Listing Multipart Uploads

obsClient.ListMultipartUploads

Returns the multipart uploads that are initiated but have not been assembled or aborted in a bucket.

Assembling Parts

obsClient.CompleteMultipartUpload

Completes a multipart upload based on the multipart upload ID and information (including PartNumber and ETag) about the uploaded parts.

Aborting a Multipart Upload

obsClient.AbortMultipartUpload

Aborts a multipart upload in a bucket by specifying the multipart upload ID.

Restoring an Archive Object

obsClient.RestoreObject

Restores an Archive object.

Creating a Signed URL

obsClient.CreateSignedUrl

Creates a signed URL based on the specified AK and SK, HTTP method, and request parameters.

Creating Parameters for Browser-based Upload

obsClient.CreateBrowserBasedSignature

Creates request parameters for authentication to enable browser-based upload with POST.

Uploading an Object - Resumable

obsClient.UploadFile

Enables resumable uploads of objects in the event of unstable network connections or program crashes.

Downloading an Object - Resumable

obsClient.DownloadFile

Enables resumable downloads of objects in the event of unstable network connections or program crashes.