This topic describes how to use code samples.

SDK source code and API documents

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

Code samples

OSS Go SDK provides a variety of code samples for your reference or use. The following table describes the content of code samples:

Sample file Content
new_bucket.go Initialize the client
put_object.go Upload objects, including simple upload and resumable upload.
append_object.go Append upload
get_object.go Download objects, including streaming download,conditional download, download object into compressed objects
delete_object.go Delete objects
copy_object.go Copy objects within a bucket, Copy objects across bucketsand conditional copy
list_objects.go List objects, including listing objects with a specified prefix and list a specified number of objects.
object_meta.go Configure and read Object Meta
object_acl.go Set and read ACL for an object
sign_url.go Generate a signed URL
cname_sample.go Bind custom domain (CNAME)
create_bucket.go Create a bucket
list_buckets.go List buckets with default or specified parameters
bucket_acl.go Set ACL for buckets
bucket_referer.go Configure, view, and delete the anti-leechsettings of a bucket
bucket_logging.go Configure, view, and delete theaccess logs of a bucket
bucket_lifecycle.go Configure, view, and delete thelifecycle settings of a bucket
bucket_cors.go Configure, view, and delete the CORS settings of a bucket