Skip to content

put_project_data_retention_storage

put_project_data_retention_storage(
    project_identifier: ProjectIdentifier,
    model_provider: DataRetentionStorageModelProvider,
    storage_destination: DataRetentionStorageDestination,
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    storage_configuration: Optional[DataRetentionStorageConfiguration] = None,
) -> PutProjectDataRetentionStorageResponse

Creates or replaces a project's retention storage record for a model provider. The project must be active in this AWS Region and owned by the calling account. A missing or unowned project returns ResourceNotFoundException; an archived project returns ValidationException.

Requires applicable project, account, or organization approval for a storage-capable trusted access program of the provider, with no applicable revocation. Otherwise, the operation returns ConflictException. Enrollment is not required to save the configuration.

The request replaces the complete stored configuration. The last successful write wins.

For customer_managed destinations, Amazon Bedrock validates the caller's and service's access to the bucket and key before saving the configuration. The bucket and key must be in the AWS Region where you register the configuration. Validation failures reject the write.

Parameters:

  • project_identifier (ProjectIdentifier) –

    The ID or ARN of a named project owned by the calling account in this AWS Region. The default project is not supported; use the account-level retention storage operations instead.

  • model_provider (DataRetentionStorageModelProvider) –

    The model provider whose retention storage configuration is addressed by this request.

  • storage_destination (DataRetentionStorageDestination) –

    Where retained data is delivered for this scope. customer_managed requires storageConfiguration; amazon_managed forbids it.

  • storage_configuration (Optional[DataRetentionStorageConfiguration], default: None ) –

    Destination bucket and key. Required when storageDestination is customer_managed; rejected with ValidationException when amazon_managed.

Raises:

Source code in docs_src/capo_bedrock/_services/bedrock.py
def put_project_data_retention_storage(
    self,
    project_identifier: "capo_bedrock.types.project_identifier.ProjectIdentifier",
    model_provider: "capo_bedrock.types.data_retention_storage_model_provider.DataRetentionStorageModelProvider",
    storage_destination: "capo_bedrock.types.data_retention_storage_destination.DataRetentionStorageDestination",
    *,
    config_overrides: Optional[BedrockClientConfig] = None,
    storage_configuration: Optional[
        "capo_bedrock.types.data_retention_storage_configuration.DataRetentionStorageConfiguration"
    ] = None,
) -> "capo_bedrock.types.put_project_data_retention_storage_response.PutProjectDataRetentionStorageResponse":
    """<p>Creates or replaces a project's retention storage record for a model provider. The project must be active in this AWS Region and owned by the calling account. A missing or unowned project returns <code>ResourceNotFoundException</code>; an archived project returns <code>ValidationException</code>.</p> <p>Requires applicable project, account, or organization approval for a storage-capable trusted access program of the provider, with no applicable revocation. Otherwise, the operation returns <code>ConflictException</code>. Enrollment is not required to save the configuration.</p> <p>The request replaces the complete stored configuration. The last successful write wins.</p> <p>For <code>customer_managed</code> destinations, Amazon Bedrock validates the caller's and service's access to the bucket and key before saving the configuration. The bucket and key must be in the AWS Region where you register the configuration. Validation failures reject the write.</p>

    Args:
        project_identifier: <p>The ID or ARN of a named project owned by the calling account in this AWS Region. The default project is not supported; use the account-level retention storage operations instead.</p>
        model_provider: <p>The model provider whose retention storage configuration is addressed by this request.</p>
        storage_destination: <p>Where retained data is delivered for this scope. customer_managed requires storageConfiguration; amazon_managed forbids it.</p>
        storage_configuration: <p>Destination bucket and key. Required when storageDestination is customer_managed; rejected with ValidationException when amazon_managed.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.conflict_exception.ConflictException: <p>Error occurred because of a conflict while performing an operation.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock.types.put_project_data_retention_storage_request.PutProjectDataRetentionStorageRequest]",
    ) -> OperationResponse[
        "capo_bedrock.types.put_project_data_retention_storage_response.PutProjectDataRetentionStorageResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.put_project_data_retention_storage

        output, http_response = (
            capo_bedrock._operations.amazon_bedrock_control_plane_service.put_project_data_retention_storage.put_project_data_retention_storage(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutProjectDataRetentionStorage")
    )
    input_: capo_bedrock.types.put_project_data_retention_storage_request.PutProjectDataRetentionStorageRequest = {
        "project_identifier": project_identifier,
        "model_provider": model_provider,
        "storage_destination": storage_destination,
    }
    if storage_configuration is not None:
        input_["storage_configuration"] = storage_configuration

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