Skip to content

create_credential_provider async

create_credential_provider(
    credential_provider_pool_identifier: CredentialProviderPoolIdentifier,
    name: ProviderName,
    provider_configuration_input: CredentialProviderConfigurationInput,
    *,
    config_overrides: Optional[AsyncCredentialBrokerControlClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateCredentialProviderResponse

Creates a CredentialProvider under a parent CredentialProviderPool. The provider type is determined by which member of providerConfigurationInput you set: oauthConfiguration creates an OAUTH provider, apiKeyConfiguration an API_KEY provider. Set exactly one. The operation always returns 202 Accepted.

Creation is asynchronous. The provider is returned with a transitional status and reaches READY or FAILED on its own; poll GetCredentialProvider to observe the transition.

Credentials this provider caches are encrypted under the parent pool's encryption configuration unless the provider overrides it. Within oauthConfiguration, set providerEncryptionConfiguration to a customer managed key to use that key in place of the pool's, or to inheritFromPool to follow the pool. A provider cannot select service-managed encryption on its own, the only way to use the service-owned key is to inherit it from a pool configured that way. An OAuth provider's response reports which applies in encryptionSource, as INHERITED or PROVIDER_OVERRIDE, alongside the resolved encryptionConfiguration.

Required permissions: in addition to permission for this operation, the service performs these actions on your behalf, each only when the request calls for it: secretsmanager:GetSecretValue and secretsmanager:DescribeSecret when the provider references a secret you own; secretsmanager:CreateSecret when you supply the credential value instead, so that the service stores it in a secret it creates; and kms:CreateGrant, kms:DescribeKey, kms:GenerateDataKeyWithoutPlaintext, kms:ReEncryptFrom, kms:ReEncryptTo, kms:Encrypt, and kms:Decrypt when a customer managed KMS key is in use.

Parameters:

  • credential_provider_pool_identifier (CredentialProviderPoolIdentifier) –

    Identifies a credential provider pool. Accepts either the pool's ARN or its service-generated ID; both refer to the same pool.

  • name (ProviderName) –

    The name for the credential provider. Must be unique among the providers that currently exist in the same pool. You can change it later with UpdateCredentialProvider.

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

    SDK-populated idempotency token for safe retries.

  • provider_configuration_input (CredentialProviderConfigurationInput) –

    Type-specific input configuration. Exactly one member must be set.

  • tags (Optional[TagMap], default: None ) –

    Tags attached to a resource, as key-value pairs. Keys are unique within a resource and are case-sensitive. Use tags to categorize resources and to control access with tag-based IAM policies.

Raises:

  • AccessDeniedException –

    The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

  • ConflictException –

    The request conflicts with the current state of the resource. Nothing was changed. Depending on reason, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).

  • InternalServerException –

    The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

  • ResourceNotFoundException –

    The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

  • ServiceQuotaExceededException –

    The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using serviceCode and quotaCode, then retry.

  • ThrottlingException –

    The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

  • ValidationException –

    The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

  • UnknownServiceError –

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

Source code in docs_src/capo_credentialbroker_control/_services/async_credential_broker_control.py
async def create_credential_provider(
    self,
    credential_provider_pool_identifier: "capo_credentialbroker_control.types.credential_provider_pool_identifier.CredentialProviderPoolIdentifier",
    name: "capo_credentialbroker_control.types.provider_name.ProviderName",
    provider_configuration_input: "capo_credentialbroker_control.types.credential_provider_configuration_input.CredentialProviderConfigurationInput",
    *,
    config_overrides: Optional[AsyncCredentialBrokerControlClientConfig] = None,
    client_token: Optional[
        "capo_credentialbroker_control.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_credentialbroker_control.types.tag_map.TagMap"] = None,
) -> "capo_credentialbroker_control.types.create_credential_provider_response.CreateCredentialProviderResponse":
    """<p>Creates a CredentialProvider under a parent CredentialProviderPool. The provider type is determined by which member of <code>providerConfigurationInput</code> you set: <code>oauthConfiguration</code> creates an <code>OAUTH</code> provider, <code>apiKeyConfiguration</code> an <code>API_KEY</code> provider. Set exactly one. The operation always returns 202 Accepted.</p> <p>Creation is asynchronous. The provider is returned with a transitional <code>status</code> and reaches <code>READY</code> or <code>FAILED</code> on its own; poll <code>GetCredentialProvider</code> to observe the transition.</p> <p>Credentials this provider caches are encrypted under the parent pool's encryption configuration unless the provider overrides it. Within <code>oauthConfiguration</code>, set <code>providerEncryptionConfiguration</code> to a customer managed key to use that key in place of the pool's, or to <code>inheritFromPool</code> to follow the pool. A provider cannot select service-managed encryption on its own, the only way to use the service-owned key is to inherit it from a pool configured that way. An OAuth provider's response reports which applies in <code>encryptionSource</code>, as <code>INHERITED</code> or <code>PROVIDER_OVERRIDE</code>, alongside the resolved <code>encryptionConfiguration</code>.</p> <p> <b>Required permissions:</b> in addition to permission for this operation, the service performs these actions on your behalf, each only when the request calls for it: <code>secretsmanager:GetSecretValue</code> and <code>secretsmanager:DescribeSecret</code> when the provider references a secret you own; <code>secretsmanager:CreateSecret</code> when you supply the credential value instead, so that the service stores it in a secret it creates; and <code>kms:CreateGrant</code>, <code>kms:DescribeKey</code>, <code>kms:GenerateDataKeyWithoutPlaintext</code>, <code>kms:ReEncryptFrom</code>, <code>kms:ReEncryptTo</code>, <code>kms:Encrypt</code>, and <code>kms:Decrypt</code> when a customer managed KMS key is in use.</p>

    Args:
        credential_provider_pool_identifier: <p>Identifies a credential provider pool. Accepts either the pool's ARN or its service-generated ID; both refer to the same pool.</p>
        name: <p>The name for the credential provider. Must be unique among the providers that currently exist in the same pool. You can change it later with UpdateCredentialProvider.</p>
        client_token: <p>SDK-populated idempotency token for safe retries.</p>
        provider_configuration_input: <p>Type-specific input configuration. Exactly one member must be set.</p>
        tags: <p>Tags attached to a resource, as key-value pairs. Keys are unique within a resource and are case-sensitive. Use tags to categorize resources and to control access with tag-based IAM policies.</p>

    Raises:
        capo_credentialbroker_control.errors.access_denied_exception.AccessDeniedException: <p>The caller is not authorized to perform the request, or a resource the request depends on refused access. <code>reason</code> distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.</p>
        capo_credentialbroker_control.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Nothing was changed. Depending on <code>reason</code>, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).</p>
        capo_credentialbroker_control.errors.internal_server_exception.InternalServerException: <p>The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.</p>
        capo_credentialbroker_control.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.</p>
        capo_credentialbroker_control.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using <code>serviceCode</code> and <code>quotaCode</code>, then retry.</p>
        capo_credentialbroker_control.errors.throttling_exception.ThrottlingException: <p>The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring <code>retryAfterSeconds</code> when it is present.</p>
        capo_credentialbroker_control.errors.validation_exception.ValidationException: <p>The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use <code>reason</code> to branch in code and <code>message</code> for the human-readable detail of which field or combination of fields was at fault.</p>
        capo_credentialbroker_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_credentialbroker_control.types.create_credential_provider_request.CreateCredentialProviderRequest]",
    ) -> AsyncOperationResponse[
        "capo_credentialbroker_control.types.create_credential_provider_response.CreateCredentialProviderResponse"
    ]:
        import capo_credentialbroker_control._operations.aws_tessera_control_plane.create_credential_provider

        (
            output,
            http_response,
        ) = await capo_credentialbroker_control._operations.aws_tessera_control_plane.create_credential_provider.async_create_credential_provider(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_credentialbroker_control.types.create_credential_provider_request.CreateCredentialProviderRequest",
    ) -> dict[str, Any]:
        import capo_credentialbroker_control.types.create_credential_provider_request

        return capo_credentialbroker_control.types.create_credential_provider_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCredentialProvider", redact_input=_redact_input),
    )
    input_: capo_credentialbroker_control.types.create_credential_provider_request.CreateCredentialProviderRequest = {
        "credential_provider_pool_identifier": credential_provider_pool_identifier,
        "name": name,
        "provider_configuration_input": provider_configuration_input,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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