Skip to content

update_api_key_credential_provider

update_api_key_credential_provider(
    name: CredentialProviderName,
    *,
    config_overrides: Optional[BedrockAgentCoreControlClientConfig] = None,
    api_key: Optional[DefaultApiKeyType] = None,
    api_key_secret_config: Optional[SecretReference] = None,
    api_key_secret_source: Optional[SecretSourceType] = None,
) -> UpdateApiKeyCredentialProviderResponse

Updates an existing API key credential provider.

Parameters:

  • name (CredentialProviderName) –

    The name of the API key credential provider to update.

  • api_key (Optional[DefaultApiKeyType], default: None ) –

    The new API key to use for authentication. This value replaces the existing API key and is encrypted and stored securely.

  • api_key_secret_config (Optional[SecretReference], default: None ) –

    A reference to the Amazon Web Services Secrets Manager secret that stores the API key. This includes the secret ID and the JSON key used to extract the API key value from the secret. Required when apiKeySecretSource is set to EXTERNAL.

  • api_key_secret_source (Optional[SecretSourceType], default: None ) –

    The source type of the API key secret. Use MANAGED if the secret is managed by the service, or EXTERNAL if you manage the secret yourself in Amazon Web Services Secrets Manager.

Raises:

Source code in docs_src/capo_bedrock_agentcore_control/_services/bedrock_agent_core_control.py
def update_api_key_credential_provider(
    self,
    name: "capo_bedrock_agentcore_control.types.credential_provider_name.CredentialProviderName",
    *,
    config_overrides: Optional[BedrockAgentCoreControlClientConfig] = None,
    api_key: Optional[
        "capo_bedrock_agentcore_control.types.default_api_key_type.DefaultApiKeyType"
    ] = None,
    api_key_secret_config: Optional[
        "capo_bedrock_agentcore_control.types.secret_reference.SecretReference"
    ] = None,
    api_key_secret_source: Optional[
        "capo_bedrock_agentcore_control.types.secret_source_type.SecretSourceType"
    ] = None,
) -> "capo_bedrock_agentcore_control.types.update_api_key_credential_provider_response.UpdateApiKeyCredentialProviderResponse":
    """<p>Updates an existing API key credential provider.</p>

    Args:
        name: <p>The name of the API key credential provider to update.</p>
        api_key: <p>The new API key to use for authentication. This value replaces the existing API key and is encrypted and stored securely.</p>
        api_key_secret_config: <p>A reference to the Amazon Web Services Secrets Manager secret that stores the API key. This includes the secret ID and the JSON key used to extract the API key value from the secret. Required when <code>apiKeySecretSource</code> is set to <code>EXTERNAL</code>.</p>
        api_key_secret_source: <p>The source type of the API key secret. Use <code>MANAGED</code> if the secret is managed by the service, or <code>EXTERNAL</code> if you manage the secret yourself in Amazon Web Services Secrets Manager.</p>

    Raises:
        capo_bedrock_agentcore_control.errors.access_denied_exception.AccessDeniedException: <p>This exception is thrown when a request is denied per access permissions</p>
        capo_bedrock_agentcore_control.errors.conflict_exception.ConflictException: <p>This exception is thrown when there is a conflict performing an operation</p>
        capo_bedrock_agentcore_control.errors.decryption_failure.DecryptionFailure: <p>Exception thrown when decryption of a secret fails.</p>
        capo_bedrock_agentcore_control.errors.encryption_failure.EncryptionFailure: <p>Exception thrown when encryption of a secret fails.</p>
        capo_bedrock_agentcore_control.errors.internal_server_exception.InternalServerException: <p>This exception is thrown if there was an unexpected error during processing of request</p>
        capo_bedrock_agentcore_control.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when a resource referenced by the operation does not exist</p>
        capo_bedrock_agentcore_control.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This exception is thrown when a request is made beyond the service quota</p>
        capo_bedrock_agentcore_control.errors.throttling_exception.ThrottlingException: <p>This exception is thrown when the number of requests exceeds the limit</p>
        capo_bedrock_agentcore_control.errors.unauthorized_exception.UnauthorizedException: <p>This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access</p>
        capo_bedrock_agentcore_control.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_bedrock_agentcore_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock_agentcore_control.types.update_api_key_credential_provider_request.UpdateApiKeyCredentialProviderRequest]",
    ) -> OperationResponse[
        "capo_bedrock_agentcore_control.types.update_api_key_credential_provider_response.UpdateApiKeyCredentialProviderResponse"
    ]:
        import capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.update_api_key_credential_provider

        output, http_response = (
            capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.update_api_key_credential_provider.update_api_key_credential_provider(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agentcore_control.types.update_api_key_credential_provider_request.UpdateApiKeyCredentialProviderRequest",
    ) -> dict[str, Any]:
        import capo_bedrock_agentcore_control.types.update_api_key_credential_provider_request

        return capo_bedrock_agentcore_control.types.update_api_key_credential_provider_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateApiKeyCredentialProvider", redact_input=_redact_input
        ),
    )
    input_: capo_bedrock_agentcore_control.types.update_api_key_credential_provider_request.UpdateApiKeyCredentialProviderRequest = {
        "name": name
    }
    if api_key is not None:
        input_["api_key"] = api_key
    if api_key_secret_config is not None:
        input_["api_key_secret_config"] = api_key_secret_config
    if api_key_secret_source is not None:
        input_["api_key_secret_source"] = api_key_secret_source

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output