Skip to content

add_policy_grant async

add_policy_grant(
    domain_identifier: DomainId,
    entity_type: TargetEntityType,
    entity_identifier: str,
    policy_type: ManagedPolicyType,
    principal: PolicyGrantPrincipal,
    detail: PolicyGrantDetail,
    *,
    config_overrides: Optional[AsyncDataZoneClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> AddPolicyGrantOutput

Adds a policy grant (an authorization policy) to a specified entity, including domain units, environment blueprint configurations, or environment profiles.

Parameters:

  • domain_identifier (DomainId) –

    The ID of the domain where you want to add a policy grant.

  • entity_type (TargetEntityType) –

    The type of entity (resource) to which the grant is added.

  • entity_identifier (str) –

    The ID of the entity (resource) to which you want to add a policy grant.

  • policy_type (ManagedPolicyType) –

    The type of policy that you want to grant.

  • principal (PolicyGrantPrincipal) –

    The principal to whom the permissions are granted.

  • detail (PolicyGrantDetail) –

    The details of the policy grant.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_datazone/_services/async_data_zone.py
async def add_policy_grant(
    self,
    domain_identifier: "capo_datazone.types.domain_id.DomainId",
    entity_type: "capo_datazone.types.target_entity_type.TargetEntityType",
    entity_identifier: str,
    policy_type: "capo_datazone.types.managed_policy_type.ManagedPolicyType",
    principal: "capo_datazone.types.policy_grant_principal.PolicyGrantPrincipal",
    detail: "capo_datazone.types.policy_grant_detail.PolicyGrantDetail",
    *,
    config_overrides: Optional[AsyncDataZoneClientConfig] = None,
    client_token: Optional["capo_datazone.types.client_token.ClientToken"] = None,
) -> "capo_datazone.types.add_policy_grant_output.AddPolicyGrantOutput":
    """<p>Adds a policy grant (an authorization policy) to a specified entity, including domain units, environment blueprint configurations, or environment profiles.</p>

    Args:
        domain_identifier: <p>The ID of the domain where you want to add a policy grant.</p>
        entity_type: <p>The type of entity (resource) to which the grant is added.</p>
        entity_identifier: <p>The ID of the entity (resource) to which you want to add a policy grant.</p>
        policy_type: <p>The type of policy that you want to grant.</p>
        principal: <p>The principal to whom the permissions are granted.</p>
        detail: <p>The details of the policy grant.</p>
        client_token: <p>A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.</p>

    Raises:
        capo_datazone.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_datazone.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_datazone.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_datazone.errors.conflict_exception.ConflictException: <p>There is a conflict while performing this action.</p>
        capo_datazone.errors.internal_server_exception.InternalServerException: <p>The request has failed because of an unknown error, exception or failure.</p>
        capo_datazone.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request has exceeded the specified service quota.</p>
        capo_datazone.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the Amazon Web Services service.</p>
        capo_datazone.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_datazone.types.add_policy_grant_input.AddPolicyGrantInput]",
    ) -> AsyncOperationResponse[
        "capo_datazone.types.add_policy_grant_output.AddPolicyGrantOutput"
    ]:
        import capo_datazone._operations.data_zone.add_policy_grant

        (
            output,
            http_response,
        ) = await capo_datazone._operations.data_zone.add_policy_grant.async_add_policy_grant(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddPolicyGrant")
    )
    input_: capo_datazone.types.add_policy_grant_input.AddPolicyGrantInput = {
        "domain_identifier": domain_identifier,
        "entity_type": entity_type,
        "entity_identifier": entity_identifier,
        "policy_type": policy_type,
        "principal": principal,
        "detail": detail,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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