get_resource_payload_generation_url

MetadataGenerationApi.get_resource_payload_generation_url(resource_type, filename, action, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Get S3 pre-signed URL to upload a file for payload generation

Returns an S3 pre-signed PUT URL and UploadPath for uploading a sample file used to generate Amorphic resource creation payloads. Only resource_type=datasets is supported (else GE-1106). Requires query params filename and action=getpresignupurl (else IPV-1001 / IPV-1041). Success Message is “Successfully generated PreSignedUrl”. Safe to retry (read-only URL mint).

Parameters:
  • resource_type (str) – Resource kind to generate payload for. Only datasets is supported today (else GE-1106). (required)

  • filename (str) – Name of the file that will be uploaded via the pre-signed URL. Validated against S3 naming rules. Missing filename returns IPV-1001. (required)

  • action (str) – Must be getpresignupurl. Any other value returns IPV-1041. (required)

  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the caller belongs to. (required)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

PreSignedResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: GET /generate-payload/{resource_type}

Parameter examples

Name

In

Example

resource_type

path

"datasets"

filename

query

"monthly_orders.csv"

action

query

"getpresignupurl"

Success (HTTP 200)

Pre-signed URL generated. Message is “Successfully generated PreSignedUrl”. Body also includes PreSignedUrl and UploadPath (generate_payload/{user}/{resource_type}/{epoch}_{filename}).

Request / response example

{
  "Message": "Successfully generated PreSignedUrl",
  "PreSignedUrl": "https://s3.amazonaws.com/example-bucket/generate_payload/alice@example.com/datasets/1723545600_monthly_orders.csv?X-Amz-Algorithm=...",
  "UploadPath": "generate_payload/alice@example.com/datasets/1723545600_monthly_orders.csv"
}

Errors

Documented error codes: IPV-1001, IPV-1041, GE-1106, RTE-1001.

HTTP 400

Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1001 (missing filename), IPV-1041 (action not getpresignupurl), GE-1106 (resource_type not datasets).

filename query param missing

{
  "Message": "IPV-1001 - Missing required key(s) 'filename' in the input"
}

action is not getpresignupurl

{
  "Message": "IPV-1041 - Invalid value for parameter action, Allowed values - ['getpresignupurl']"
}

resource_type is not datasets

{
  "Message": "GE-1106 - Invalid resource type!, Resource Payload creation is/are not supported for jobs"
}

HTTP 500

Backend/generic failure. Body is {“Message”: “<CODE> - <text>”}.

Request / response example

{
  "Message": "RTE-1001 - An error occurred."
}