Skip to main content

oss

Aliyun Object Storage

Project#

https://github.com/beyondstorage/go-service-oss

Config#

Servicer#

Available Pairs#

NameRequiredComments
credentialYonly support hmac protocol
endpointY

Examples#

Init servicer (see this page for details)

import (    _ "github.com/beyondstorage/go-service-oss/v3"    "github.com/beyondstorage/go-storage/v4/services")
srv, err := services.NewServicerFromString("oss://?credential=hmac:<account_name>:<account_key>&endpoint=https:<location>.aliyuncs.com")if err != nil {    log.Fatalf("oss new service: %v", err)}

Storager#

Available Pairs#

NameRequiredComments
nameYbucket name
work_dirNwork dir

Examples#

Init storager (see this page for details)

import (    _ "github.com/beyondstorage/go-service-oss/v3"    "github.com/beyondstorage/go-storage/v4/services")
store, err := services.NewStoragerFromString("oss://<container_name>/<work_dir>?credential=hmac:<account_name>:<account_key>&endpoint=https:<location>.aliyuncs.com")if err != nil {    log.Fatalf("oss new service: %v", err)}

Implementation#

This service implements following interfaces:

Pairs#

Server-Side Encryption (SSE)#

Aliyun Object Storage supports two options for Server-Side Encryption:

  • Server-side encryption by using Key Management Service (SSE-KMS)
  • Server-side encryption by using OSS-managed keys (SSE-OSS)

Note: there exists inconsistency between the two OSS docs. And take care if you want to use the SM4 algorithm.

For Chinese users, refer to https://help.aliyun.com/document_detail/31871.html for details.

For global users, refer to https://www.alibabacloud.com/help/doc-detail/31871.htm for details, and double-check whether the SM4 algorithm can be used.

SSE-KMS#

NameComments
server_side_encryptionspecifies the encryption algorithm. It should be KMS
server_side_data_encryptionspecifies the encryption algorithm when server_side_encryption is KMS. Can only be set to SM4. If this is not set, AES256 algorithm will be used.
server-side-encryption-key-idspecifies the ID of the customer managed CMK used to protect the data
Supported Operations#

SSE-OSS#

NameComments
server_side_encryptionspecifies the encryption algorithm. It should be AES256 or SM4.
Supported Operations#