Skip to content

put_workload_identity_provider_resource_policy async

put_workload_identity_provider_resource_policy(
    workload_identity_provider_arn: arnType,
    policy_document: policyDocumentType,
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> PutWorkloadIdentityProviderResourcePolicyResponse

Attaches a resource policy to a workload identity provider, or replaces the one attached. A provider carries at most one resource policy, and the policy is a property of the provider rather than a resource of its own.

A member account binding to an organization-scoped provider needs a matching Allow here for iam:AssociateWorkloadIdentityTemplate or iam:DisassociateWorkloadIdentityTemplate, in addition to its own identity policy.

Parameters:

  • workload_identity_provider_arn (arnType) –

    The Amazon Resource Name (ARN) of the provider to attach the policy to.

  • policy_document (policyDocumentType) –

    The resource policy to attach, written whole.

    Application-level quotas can bind sooner than the length constraint shown here, in which case the request returns LimitExceededException.

Raises:

  • ConcurrentModificationException –

    The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.

  • InvalidInputException –

    The request was rejected because an invalid or out-of-range value was supplied for an input parameter.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.

  • MalformedPolicyDocumentException –

    The request was rejected because the policy document was malformed. The error message describes the specific error.

  • NoSuchEntityException –

    The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.

  • ServiceFailureException –

    The request processing has failed because of an unknown error, exception or failure.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_iam/_services/async_iam.py
async def put_workload_identity_provider_resource_policy(
    self,
    workload_identity_provider_arn: "capo_iam.types.arn_type.arnType",
    policy_document: "capo_iam.types.policy_document_type.policyDocumentType",
    *,
    config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> "capo_iam.types.put_workload_identity_provider_resource_policy_response.PutWorkloadIdentityProviderResourcePolicyResponse":
    """<p>Attaches a resource policy to a workload identity provider, or replaces the one attached. A provider carries at most one resource policy, and the policy is a property of the provider rather than a resource of its own.</p> <p>A member account binding to an organization-scoped provider needs a matching <code>Allow</code> here for <code>iam:AssociateWorkloadIdentityTemplate</code> or <code>iam:DisassociateWorkloadIdentityTemplate</code>, in addition to its own identity policy.</p>

    Args:
        workload_identity_provider_arn: <p>The Amazon Resource Name (ARN) of the provider to attach the policy to.</p>
        policy_document: <p>The resource policy to attach, written whole.</p> <p>Application-level quotas can bind sooner than the length constraint shown here, in which case the request returns <code>LimitExceededException</code>.</p>

    Raises:
        capo_iam.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.</p>
        capo_iam.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
        capo_iam.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.</p>
        capo_iam.errors.malformed_policy_document_exception.MalformedPolicyDocumentException: <p>The request was rejected because the policy document was malformed. The error message describes the specific error.</p>
        capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
        capo_iam.errors.service_failure_exception.ServiceFailureException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iam.types.put_workload_identity_provider_resource_policy_request.PutWorkloadIdentityProviderResourcePolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_iam.types.put_workload_identity_provider_resource_policy_response.PutWorkloadIdentityProviderResourcePolicyResponse"
    ]:
        import capo_iam._operations.aws_identity_management_v20100508.put_workload_identity_provider_resource_policy

        (
            output,
            http_response,
        ) = await capo_iam._operations.aws_identity_management_v20100508.put_workload_identity_provider_resource_policy.async_put_workload_identity_provider_resource_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("PutWorkloadIdentityProviderResourcePolicy"),
    )
    input_: capo_iam.types.put_workload_identity_provider_resource_policy_request.PutWorkloadIdentityProviderResourcePolicyRequest = {
        "workload_identity_provider_arn": workload_identity_provider_arn,
        "policy_document": policy_document,
    }

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