Skip to content

put_resource_policy async

put_resource_policy(
    policy_in_json: PolicyJsonString,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    resource_arn: Optional[GlueResourceArn] = None,
    policy_hash_condition: Optional[HashString] = None,
    policy_exists_condition: Optional[ExistCondition] = None,
    enable_hybrid: Optional[EnableHybridValues] = None,
) -> PutResourcePolicyResponse

Sets the Data Catalog resource policy for access control.

Parameters:

  • policy_in_json (PolicyJsonString) –

    Contains the policy document to set, in JSON format.

  • resource_arn (Optional[GlueResourceArn], default: None ) –

    Do not use. For internal use only.

  • policy_hash_condition (Optional[HashString], default: None ) –

    The hash value returned when the previous policy was set using PutResourcePolicy. Its purpose is to prevent concurrent modifications of a policy. Do not use this parameter if no previous policy has been set.

  • policy_exists_condition (Optional[ExistCondition], default: None ) –

    A value of MUST_EXIST is used to update a policy. A value of NOT_EXIST is used to create a new policy. If a value of NONE or a null value is used, the call does not depend on the existence of a policy.

  • enable_hybrid (Optional[EnableHybridValues], default: None ) –

    If 'TRUE', indicates that you are using both methods to grant cross-account access to Data Catalog resources:

    • By directly updating the resource policy with PutResourePolicy

    • By using the Grant permissions command on the Amazon Web Services Management Console.

    Must be set to 'TRUE' if you have already used the Management Console to grant cross-account access, otherwise the call fails. Default is 'FALSE'.

Raises:

Source code in docs_src/capo_glue/_services/async_glue.py
async def put_resource_policy(
    self,
    policy_in_json: "capo_glue.types.policy_json_string.PolicyJsonString",
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    resource_arn: Optional[
        "capo_glue.types.glue_resource_arn.GlueResourceArn"
    ] = None,
    policy_hash_condition: Optional[
        "capo_glue.types.hash_string.HashString"
    ] = None,
    policy_exists_condition: Optional[
        "capo_glue.types.exist_condition.ExistCondition"
    ] = None,
    enable_hybrid: Optional[
        "capo_glue.types.enable_hybrid_values.EnableHybridValues"
    ] = None,
) -> "capo_glue.types.put_resource_policy_response.PutResourcePolicyResponse":
    """<p>Sets the Data Catalog resource policy for access control.</p>

    Args:
        policy_in_json: <p>Contains the policy document to set, in JSON format.</p>
        resource_arn: <p>Do not use. For internal use only.</p>
        policy_hash_condition: <p>The hash value returned when the previous policy was set using <code>PutResourcePolicy</code>. Its purpose is to prevent concurrent modifications of a policy. Do not use this parameter if no previous policy has been set.</p>
        policy_exists_condition: <p>A value of <code>MUST_EXIST</code> is used to update a policy. A value of <code>NOT_EXIST</code> is used to create a new policy. If a value of <code>NONE</code> or a null value is used, the call does not depend on the existence of a policy.</p>
        enable_hybrid: <p>If <code>'TRUE'</code>, indicates that you are using both methods to grant cross-account access to Data Catalog resources:</p> <ul> <li> <p>By directly updating the resource policy with <code>PutResourePolicy</code> </p> </li> <li> <p>By using the <b>Grant permissions</b> command on the Amazon Web Services Management Console.</p> </li> </ul> <p>Must be set to <code>'TRUE'</code> if you have already used the Management Console to grant cross-account access, otherwise the call fails. Default is 'FALSE'.</p>

    Raises:
        capo_glue.errors.condition_check_failure_exception.ConditionCheckFailureException: <p>A specified condition was not satisfied.</p>
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_glue.types.put_resource_policy_request.PutResourcePolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.put_resource_policy_response.PutResourcePolicyResponse"
    ]:
        import capo_glue._operations.aws_glue.put_resource_policy

        (
            output,
            http_response,
        ) = await capo_glue._operations.aws_glue.put_resource_policy.async_put_resource_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutResourcePolicy")
    )
    input_: capo_glue.types.put_resource_policy_request.PutResourcePolicyRequest = {
        "policy_in_json": policy_in_json
    }
    if resource_arn is not None:
        input_["resource_arn"] = resource_arn
    if policy_hash_condition is not None:
        input_["policy_hash_condition"] = policy_hash_condition
    if policy_exists_condition is not None:
        input_["policy_exists_condition"] = policy_exists_condition
    if enable_hybrid is not None:
        input_["enable_hybrid"] = enable_hybrid

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output