View Source CozyAliyunOpenAPI.Specs.OSS.Object (cozy_aliyun_open_api v0.2.0)

Provides object related utils.

Summary

Functions

Presigns a PostObject operation and returns the necessary form data when executing the PostObject operation.

Functions

Link to this function

presign_post_object(config, region, bucket, conditions, seconds_to_expire)

View Source
@spec presign_post_object(
  CozyAliyunOpenAPI.Config.t(),
  String.t(),
  String.t(),
  list(),
  pos_integer()
) ::
  %{
    policy: String.t(),
    "x-oss-signature-version": String.t(),
    "x-oss-credential": String.t(),
    "x-oss-date": String.t(),
    "x-oss-signature": String.t()
  }

Presigns a PostObject operation and returns the necessary form data when executing the PostObject operation.

Read more at:

Adding signature

This implementation has built-in V4 signature support.

V1 signature is not supported.

Examples

region = "oss-us-west-1"
bucket = "example-bucket"
conditions = [
  ["eq", "$key", "lenna.png"],
  ["eq", "$x-oss-object-acl", "private"],
  ["content-length-range", 1, 1024 * 1024 * 5]
]
seconds_to_expire = 3600

sign_post_object_policy(config, region, bucket, conditions, seconds_to_expire)