Skip to content

batch_get_agent_enforced_policy async

batch_get_agent_enforced_policy(
    policy_ids: AgentEnforcedPolicyLookupIdList,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> BatchGetAgentEnforcedPolicyResult

Describes the specified agent-enforced policies.

Parameters:

  • policy_ids (AgentEnforcedPolicyLookupIdList) –

    The identifiers of the policies to describe. If you specify an identifier more than once, the response includes it only once.

Raises:

Examples:

Example – Getting an agent-enforced policy The following example gets an agent-enforced policy, including its policy document.

>>> await client.batch_get_agent_enforced_policy(policy_ids=['wsae-a1b2c3d4'])
Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def batch_get_agent_enforced_policy(
    self,
    policy_ids: "capo_workspaces.types.agent_enforced_policy_lookup_id_list.AgentEnforcedPolicyLookupIdList",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.batch_get_agent_enforced_policy_result.BatchGetAgentEnforcedPolicyResult":
    """<p>Describes the specified agent-enforced policies.</p>

    Args:
        policy_ids: <p>The identifiers of the policies to describe. If you specify an identifier more than once, the response includes it only once.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Retry the request with exponential backoff.</p>
        capo_workspaces.errors.validation_exception.ValidationException: <p>Your request failed validation. Check the error message for the parameter that isn't valid.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example – Getting an agent-enforced policy
        The following example gets an agent-enforced policy, including its policy document.

        >>> await client.batch_get_agent_enforced_policy(policy_ids=['wsae-a1b2c3d4'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.batch_get_agent_enforced_policy_request.BatchGetAgentEnforcedPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.batch_get_agent_enforced_policy_result.BatchGetAgentEnforcedPolicyResult"
    ]:
        if req.options.protocol == "awsJson1_1":
            import capo_workspaces._operations.workspaces_service.aws_json1_1.batch_get_agent_enforced_policy

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.aws_json1_1.batch_get_agent_enforced_policy.async_batch_get_agent_enforced_policy(
                req.options, req.input
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_workspaces._operations.workspaces_service.rpcv2_cbor.batch_get_agent_enforced_policy

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.rpcv2_cbor.batch_get_agent_enforced_policy.async_batch_get_agent_enforced_policy(
                req.options, req.input
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_workspaces.types.batch_get_agent_enforced_policy_result.BatchGetAgentEnforcedPolicyResult",
    ) -> dict[str, Any]:
        import capo_workspaces.types.batch_get_agent_enforced_policy_result

        return capo_workspaces.types.batch_get_agent_enforced_policy_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "BatchGetAgentEnforcedPolicy", redact_output=_redact_output
        ),
    )
    input_: capo_workspaces.types.batch_get_agent_enforced_policy_request.BatchGetAgentEnforcedPolicyRequest = {
        "policy_ids": policy_ids
    }

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