get_download_script_url¶
- EtlJobsApi.get_download_script_url(id, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Retrieve the job script download URL
Returns a SigV4 presigned GET URL in Message to download the job script. Caller must send a valid role_id (AUTH-1001 if missing) and have at least read-only access on the job (AUTH-1012 if the access level is too low). Unknown JobId returns IPV-1002. Object key is {jobId}/script/{JobName} in the Amorphic ETL bucket, unless ResourceOrigin is AWSConsole — then ScriptLocation is parsed as bucket plus key. If head_object returns 404, the handler returns HTTP 204 with an empty JSON object so the UI can show a default script. Other S3 ClientError values surface as HTTP 400. Read-only users are also checked against attached datasets, domains, parameters, and libraries via glueUtil.validate_attached_resources. Missing underlying grants return AUTH-1010 with the missing permission list. Safe to retry (read-only), aside from a ScriptUpdate notification sent to subscribers after a successful 200.
- 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:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: GET /jobs/{id}/script
Parameter examples¶
Name |
In |
Example |
|---|---|---|
|
path |
|
Success (HTTP 200)¶
Presigned GET URL returned in Message. Suggested download filename is {jobId}_script.py.
Presigned GET 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"
}
Success (HTTP 204)¶
No script object at the resolved S3 key. Body is an empty JSON object. The UI uses this to load a default script until the user uploads one.
Script object not in S3
{}
Errors¶
Documented error codes: AUTH-1001, IPV-1002, AUTH-1012, AUTH-1010, GE-1044, EMF-1001.
HTTP 400
Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: AUTH-1001 (missing role_id), IPV-1002 (unknown JobId), AUTH-1012 (access level too low), AUTH-1010 (read-only user missing grants on attached resources), plus S3 ClientError text without an Amorphic prefix.
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."
}
Access level below read-only
{
"Message": "AUTH-1012 - User: user1 requires at least readonly access on the resource to perform this action."
}
Read-only user missing grants on attached resources
{
"Message": "AUTH-1010 - User doesn't have the following permission on underlying resources for job: \n {'datasets': ['b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f']}"
}
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."
}