All Products
Search
Document Center

Object Storage Service:Introduction

Last Updated:Jun 27, 2024

This topic describes the sample code of Object Storage Service (OSS) SDK for Go in various scenarios based on the OSS SDK for Go V1 code repository.

Source code and API documents

For the source code of OSS SDK for Go, visit GitHub. For more information, visit Documentation.

Sample programs

OSS SDK for Go provides various sample programs for your reference or use. The following table describes the sample programs.

Sample code file

Content

new_bucket.go

Initialization

create_bucket.go

Create buckets

bucket_acl.go

Manage bucket ACLs

bucket_policy.go

Bucket policies

bucket_referer.go

Hotlink protection

bucket_lifecycle.go

Lifecycle

bucket_logging.go

Logging

bucket_cors.go

CORS

bucket_website.go

Static website hosting (mirroring-based back-to-origin)

bucket_encryption.go

Server-side encryption

bucket_requestpayment.go

Pay-by-requester

bucket_inventory.go

Bucket inventory

bucket_accessmonitor.go

Access tracking

bucket_metaquery.go

Data indexing

list_buckets.go

List buckets

bucket_stat.go

Query the storage capacity of a bucket

bucket_tagging.go

Manage bucket tagging

put_object.go

Upload objects, including Simple upload and Resumable upload.

append_object.go

Append upload

get_object.go

Download objects, including Streaming download and Conditional download.

delete_object.go

Delete objects

copy_object.go

Copy objects

list_objects.go

List objects

archive.go

Restore objects

object_acl.go

Manage object ACLs

sign_url.go

Authorize access

object_tagging.go

Configure object tagging

select_object.go

Query objects

object_meta.go

Manage file metadata

livechannel.go

Manage LiveChannels

OSS SDK for Go V2

OSS SDK for Go V2 is a major rewrite of the OSS SDK for Go V1 code repository. OSS SDK for Go V2 is built based on Go 1.18 and later, which simplifies underlying operations such as identification authentication, automatic retry of failed requests, and error handling. OSS SDK for Go V2 provides flexible parameter configuration methods and rich advanced operations, such as paginator, transmission managers, and File-like operations. This comprehensively improves development efficiency and experience.