create_access_request¶
- ResourceAccessApi.create_access_request(role_id, request_access, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Request access to a resource
Creates an access request for a resource. The caller must provide role_id and have the required role authorization for the specified resource type. The resource must exist and be active. Requests are rejected if the caller already has equal or higher access or if a request is already pending. Dataset and domain requests may require domain or tenant access to be requested as part of the operation. On success, the response includes Message and RequestId.
- Parameters:
role_id (str) – Amorphic role ID used for authorization. Must allow the resource-type list action for the requested ResourceType. (required)
request_access (RequestAccess) – (required)
content_type (str) – Must be application/json.
_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: POST /access-requests
Request¶
Request / response example
{
"ResourceType": "datasets",
"ResourceId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"AccessType": "read-only",
"Comment": "Need read access for reporting",
"AdditionalParams": {
"IsDomainAccessRequested": false
}
}
Success (HTTP 200)¶
Access request created. Message is “Successfully raised the request for {resource_type}.” RequestId is the new or reused UUID.
Request raised
{
"Message": "Successfully raised the request for datasets.",
"RequestId": "a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a"
}
Errors¶
Documented error codes: IPV-1008, IPV-1041, IPV-1004, IPV-1002, GE-1034, ACR-1001, ACR-1002, AUTH-1003, GE-1085, EMF-1001.
HTTP 400
Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: IPV-1008 (missing required keys), IPV-1041 (invalid ResourceType), IPV-1004 (AdditionalParams for datasets/domains), IPV-1002 (resource not found), GE-1034 (inactive resource), ACR-1001 (already have access), ACR-1002 (pending request), AUTH-1003 (missing domain or tenant access).
Missing required body keys
{
"Message": "IPV-1008 - Invalid request body, missing key(s) - ResourceType,ResourceId,AccessType,Comment"
}
Unsupported ResourceType
{
"Message": "IPV-1041 - Invalid value for key ResourceType, supported values are ['domains', 'datasets', 'datasources', 'jobs', 'dashboards', 'datalabs', 'data-pipelines', 'glossaries', 'agents']"
}
Dataset AdditionalParams invalid
{
"Message": "IPV-1004 - Invalid request body: 'AdditionalParams' is either missing or not a dictionary"
}
User already has equal or higher access
{
"Message": "ACR-1001 - 'read-only' access request cannot be processed for datasets as the user already have 'editor' access"
}
Existing pending request
{
"Message": "ACR-1002 - 'read-only' access request cannot be processed for datasets as the existing 'read-only' access request is still in 'pending' state"
}
Dataset without domain access flag
{
"Message": "AUTH-1003 - User is not authorized to use domain - sales"
}
HTTP 500
Backend failure. Body is {“Message”: “<CODE> - <text>”} (typically GE-1085 via EMF-1001). Also possible if DynamoDB write fails and response is unbound.
Unexpected failure
{
"Message": "GE-1085 - <exception text>"
}