← All procedures

s3.presign

A presigned URL for a GET or a PUT of an object, with an expiry in seconds

CLI
Package
@procedures/s3 · README
Path
["s3","presign"]
CLI
mark s3 presign --bucket <string> --key <string>
As data
{"$proc":["s3","presign"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/s3/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["s3","presign"], { bucket: "<bucket>", key: "<key>" });
console.log(JSON.stringify(result));

From the command line

$ mark s3 presign --bucket <string> --key <string>

As data, in a program

{
  "$proc": ["s3", "presign"],
  "input": { "bucket": "<bucket>", "key": "<key>" }
}

Input

FieldTypeRequiredDefaultDescription
bucketstringyesThe bucket
keystringyesThe object key
method"GET" | "PUT"noGET (download) or PUT (upload). The default is GET.
expiresInintegernoThe seconds until the URL expires (default 900, the most 604800)
contentTypestringnoPUT only: the content type that the upload must send
versionIdstringnoGET only: a version of the object

Output

FieldTypeRequiredDefaultDescription
urlstringyesThe presigned URL
method"GET" | "PUT"yesThe HTTP method of the URL
expiresInnumberyesThe seconds until the URL expires
expiresAtstringyesThe time at which the URL expires (ISO 8601)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "bucket": {
        "type": "string",
        "minLength": 1,
        "description": "The bucket"
      },
      "key": {
        "type": "string",
        "minLength": 1,
        "description": "The object key"
      },
      "method": {
        "description": "GET (download) or PUT (upload). The default is GET.",
        "type": "string",
        "enum": [
          "GET",
          "PUT"
        ]
      },
      "expiresIn": {
        "description": "The seconds until the URL expires (default 900, the most 604800)",
        "type": "integer",
        "minimum": 1,
        "maximum": 604800
      },
      "contentType": {
        "description": "PUT only: the content type that the upload must send",
        "type": "string"
      },
      "versionId": {
        "description": "GET only: a version of the object",
        "type": "string"
      }
    },
    "required": [
      "bucket",
      "key"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "description": "The presigned URL"
      },
      "method": {
        "type": "string",
        "enum": [
          "GET",
          "PUT"
        ],
        "description": "The HTTP method of the URL"
      },
      "expiresIn": {
        "type": "number",
        "description": "The seconds until the URL expires"
      },
      "expiresAt": {
        "type": "string",
        "description": "The time at which the URL expires (ISO 8601)"
      }
    },
    "required": [
      "url",
      "method",
      "expiresIn",
      "expiresAt"
    ],
    "additionalProperties": {}
  }
}