get_url_for_script_upload

EtlJobsApi.get_url_for_script_upload(id, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Get job script upload URL

Returns a SigV4 presigned PUT URL in Message to upload or replace the job script. Caller must send a valid role_id (AUTH-1001 if missing) and have at least editor access on the job. Read-only users are rejected with AUTH-1010 (“Read only users for the job cannot perform this action.”). Unknown JobId returns IPV-1002. Upload is allowed only when the resolved script bucket is the Amorphic ETL bucket (IPV-1002 otherwise). That includes AWSConsole jobs whose ScriptLocation is outside that bucket. Object key is {jobId}/script/{JobName}. On success the job LastModified and LastModifiedBy are updated (DB-1002 if DynamoDB update fails). No request body.

Parameters:
  • id (str) – Job UUID (Jobs table Id). Unknown id returns IPV-1002. (required)

  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to. Returns AUTH-1001 if missing. (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:

CreateJobScriptUploadResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /jobs/{id}/script

Parameter examples

Name

In

Example

id

path

"e4f5a6b7-c8d9-0123-4567-89abcdef0123"

Success (HTTP 200)

Presigned PUT URL returned in Message.

Presigned PUT URL in Message

{
  "Message": "https://s3.amazonaws.com/bucket/e4f5a6b7-c8d9-0123-4567-89abcdef0123/script/orders_etl?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=example"
}

Errors

Documented error codes: AUTH-1001, IPV-1002, AUTH-1010, AUTH-1012, DB-1002, GE-1044, EMF-1001.

HTTP 400

Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: AUTH-1001, IPV-1002 (unknown JobId or non-Amorphic script bucket), AUTH-1010 (read-only), AUTH-1012 (below editor), DB-1002 (metadata update failed).

Missing role_id header

{
  "Message": "AUTH-1001 - Missing role information in event header"
}

Unknown job id

{
  "Message": "IPV-1002 - Invalid JobId - e4f5a6b7-c8d9-0123-4567-89abcdef0123, resource not found."
}

Read-only user cannot upload

{
  "Message": "AUTH-1010 - Read only users for the job cannot perform this action."
}

ScriptLocation is not the Amorphic ETL bucket

{
  "Message": "IPV-1002 - Editing script from Amorphic is allowed only for jobs with Script Location in Amorphic created bucket: amorphic-etl-bucket"
}

Access level below editor

{
  "Message": "AUTH-1012 - User: user1 requires at least editor access on the resource to perform this action."
}

DynamoDB LastModified update failed

{
  "Message": "DB-1002 - Failed to update entry in the dynamoDB table, please check for errors"
}

HTTP 500

Unhandled backend failure. Body is {“Message”: “<CODE> - <text>”} (GE-1044 via EMF-1001).

Unexpected failure

{
  "Message": "GE-1044 - Unexpected error - An error occurred."
}