Skip to content

modify_db_cluster_snapshot_attribute async

modify_db_cluster_snapshot_attribute(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_cluster_snapshot_identifier: Optional[String] = None,
    attribute_name: Optional[String] = None,
    values_to_add: Optional[AttributeValueList] = None,
    values_to_remove: Optional[AttributeValueList] = None,
) -> ModifyDBClusterSnapshotAttributeResult

Adds an attribute and values to, or removes an attribute and values from, a manual DB cluster snapshot.

To share a manual DB cluster snapshot with other Amazon Web Services accounts, specify restore as the AttributeName and use the ValuesToAdd parameter to add a list of IDs of the Amazon Web Services accounts that are authorized to restore the manual DB cluster snapshot. Use the value all to make the manual DB cluster snapshot public, which means that it can be copied or restored by all Amazon Web Services accounts.

Don't add the all value for any manual DB cluster snapshots that contain private information that you don't want available to all Amazon Web Services accounts.

If a manual DB cluster snapshot is encrypted, it can be shared, but only by specifying a list of authorized Amazon Web Services account IDs for the ValuesToAdd parameter. You can't use all as a value for that parameter in this case.

To view which Amazon Web Services accounts have access to copy or restore a manual DB cluster snapshot, or whether a manual DB cluster snapshot is public or private, use the DescribeDBClusterSnapshotAttributes API operation. The accounts are returned as values for the restore attribute.

Parameters:

  • db_cluster_snapshot_identifier (Optional[String], default: None ) –

    The identifier for the DB cluster snapshot to modify the attributes for.

  • attribute_name (Optional[String], default: None ) –

    The name of the DB cluster snapshot attribute to modify.

    To manage authorization for other Amazon Web Services accounts to copy or restore a manual DB cluster snapshot, set this value to restore.

    To view the list of attributes available to modify, use the DescribeDBClusterSnapshotAttributes API operation.

  • values_to_add (Optional[AttributeValueList], default: None ) –

    A list of DB cluster snapshot attributes to add to the attribute specified by AttributeName.

    To authorize other Amazon Web Services accounts to copy or restore a manual DB cluster snapshot, set this list to include one or more Amazon Web Services account IDs, or all to make the manual DB cluster snapshot restorable by any Amazon Web Services account. Do not add the all value for any manual DB cluster snapshots that contain private information that you don't want available to all Amazon Web Services accounts.

  • values_to_remove (Optional[AttributeValueList], default: None ) –

    A list of DB cluster snapshot attributes to remove from the attribute specified by AttributeName.

    To remove authorization for other Amazon Web Services accounts to copy or restore a manual DB cluster snapshot, set this list to include one or more Amazon Web Services account identifiers, or all to remove authorization for any Amazon Web Services account to copy or restore the DB cluster snapshot. If you specify all, an Amazon Web Services account whose account ID is explicitly added to the restore attribute can still copy or restore a manual DB cluster snapshot.

Raises:

Examples:

To modify a DB cluster snapshot attribute The following example makes changes to the specified DB cluster snapshot attribute.

>>> await client.modify_db_cluster_snapshot_attribute(db_cluster_snapshot_identifier='myclustersnapshot', attribute_name='restore', values_to_add=['123456789012'])
Source code in docs_src/capo_rds/_services/async_rds.py
async def modify_db_cluster_snapshot_attribute(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_cluster_snapshot_identifier: Optional["capo_rds.types.string.String"] = None,
    attribute_name: Optional["capo_rds.types.string.String"] = None,
    values_to_add: Optional[
        "capo_rds.types.attribute_value_list.AttributeValueList"
    ] = None,
    values_to_remove: Optional[
        "capo_rds.types.attribute_value_list.AttributeValueList"
    ] = None,
) -> "capo_rds.types.modify_db_cluster_snapshot_attribute_result.ModifyDBClusterSnapshotAttributeResult":
    """<p>Adds an attribute and values to, or removes an attribute and values from, a manual DB cluster snapshot.</p> <p>To share a manual DB cluster snapshot with other Amazon Web Services accounts, specify <code>restore</code> as the <code>AttributeName</code> and use the <code>ValuesToAdd</code> parameter to add a list of IDs of the Amazon Web Services accounts that are authorized to restore the manual DB cluster snapshot. Use the value <code>all</code> to make the manual DB cluster snapshot public, which means that it can be copied or restored by all Amazon Web Services accounts.</p> <note> <p>Don't add the <code>all</code> value for any manual DB cluster snapshots that contain private information that you don't want available to all Amazon Web Services accounts.</p> </note> <p>If a manual DB cluster snapshot is encrypted, it can be shared, but only by specifying a list of authorized Amazon Web Services account IDs for the <code>ValuesToAdd</code> parameter. You can't use <code>all</code> as a value for that parameter in this case.</p> <p>To view which Amazon Web Services accounts have access to copy or restore a manual DB cluster snapshot, or whether a manual DB cluster snapshot is public or private, use the <a>DescribeDBClusterSnapshotAttributes</a> API operation. The accounts are returned as values for the <code>restore</code> attribute.</p>

    Args:
        db_cluster_snapshot_identifier: <p>The identifier for the DB cluster snapshot to modify the attributes for.</p>
        attribute_name: <p>The name of the DB cluster snapshot attribute to modify.</p> <p>To manage authorization for other Amazon Web Services accounts to copy or restore a manual DB cluster snapshot, set this value to <code>restore</code>.</p> <note> <p>To view the list of attributes available to modify, use the <a>DescribeDBClusterSnapshotAttributes</a> API operation.</p> </note>
        values_to_add: <p>A list of DB cluster snapshot attributes to add to the attribute specified by <code>AttributeName</code>.</p> <p>To authorize other Amazon Web Services accounts to copy or restore a manual DB cluster snapshot, set this list to include one or more Amazon Web Services account IDs, or <code>all</code> to make the manual DB cluster snapshot restorable by any Amazon Web Services account. Do not add the <code>all</code> value for any manual DB cluster snapshots that contain private information that you don't want available to all Amazon Web Services accounts.</p>
        values_to_remove: <p>A list of DB cluster snapshot attributes to remove from the attribute specified by <code>AttributeName</code>.</p> <p>To remove authorization for other Amazon Web Services accounts to copy or restore a manual DB cluster snapshot, set this list to include one or more Amazon Web Services account identifiers, or <code>all</code> to remove authorization for any Amazon Web Services account to copy or restore the DB cluster snapshot. If you specify <code>all</code>, an Amazon Web Services account whose account ID is explicitly added to the <code>restore</code> attribute can still copy or restore a manual DB cluster snapshot.</p>

    Raises:
        capo_rds.errors.db_cluster_snapshot_not_found_fault.DBClusterSnapshotNotFoundFault: <p> <code>DBClusterSnapshotIdentifier</code> doesn't refer to an existing DB cluster snapshot.</p>
        capo_rds.errors.invalid_db_cluster_snapshot_state_fault.InvalidDBClusterSnapshotStateFault: <p>The supplied value isn't a valid DB cluster snapshot state.</p>
        capo_rds.errors.shared_snapshot_quota_exceeded_fault.SharedSnapshotQuotaExceededFault: <p>You have exceeded the maximum number of accounts that you can share a manual DB snapshot with.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To modify a DB cluster snapshot attribute
        The following example makes changes to the specified DB cluster snapshot attribute.

        >>> await client.modify_db_cluster_snapshot_attribute(db_cluster_snapshot_identifier='myclustersnapshot', attribute_name='restore', values_to_add=['123456789012'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.modify_db_cluster_snapshot_attribute_message.ModifyDBClusterSnapshotAttributeMessage]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.modify_db_cluster_snapshot_attribute_result.ModifyDBClusterSnapshotAttributeResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.modify_db_cluster_snapshot_attribute

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.modify_db_cluster_snapshot_attribute.async_modify_db_cluster_snapshot_attribute(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyDBClusterSnapshotAttribute")
    )
    input_: capo_rds.types.modify_db_cluster_snapshot_attribute_message.ModifyDBClusterSnapshotAttributeMessage = {}
    if db_cluster_snapshot_identifier is not None:
        input_["db_cluster_snapshot_identifier"] = db_cluster_snapshot_identifier
    if attribute_name is not None:
        input_["attribute_name"] = attribute_name
    if values_to_add is not None:
        input_["values_to_add"] = values_to_add
    if values_to_remove is not None:
        input_["values_to_remove"] = values_to_remove

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