This topic describes the sample code of OSS SDK for Go in various scenarios.

Source code and API documents

For the source code of OSS SDK for Go, visit GitHub. For more information, see OSS SDK for Go API documents.

Sample programs

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

Sample 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.goAccess tracking
bucket_metaquery.go Data indexing
list_buckets.go List buckets
bucket_stat.go Query the storage capacity of a bucket
bucket_tagging.go Configure and 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 the ACL of an object
sign_url.go Authorized access
object_tagging.go Configure object tagging
select_object.go Query objects
object_meta.go Manage object metadata
livechannel.go Common operations on LiveChannels