modify_snapshot_attribute
async
¶
modify_snapshot_attribute(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
attribute: Optional[SnapshotAttributeName] = None,
create_volume_permission: Optional[CreateVolumePermissionModifications] = None,
group_names: Optional[GroupNameStringList] = None,
operation_type: Optional[OperationType] = None,
snapshot_id: Optional[SnapshotId] = None,
user_ids: Optional[UserIdStringList] = None,
dry_run: Optional[Boolean] = None,
) -> None
Adds or removes permission settings for the specified snapshot. You may add or remove specified Amazon Web Services account IDs from a snapshot's list of create volume permissions, but you cannot do both in a single operation. If you need to both add and remove account IDs for a snapshot, you must use multiple operations. You can make up to 500 modifications to a snapshot in a single operation.
Encrypted snapshots and snapshots with Amazon Web Services Marketplace product codes cannot be made public. Snapshots encrypted with your default KMS key cannot be shared with other accounts.
For more information about modifying snapshot permissions, see Share a snapshot in the Amazon EBS User Guide.
Parameters:
-
attribute(Optional[SnapshotAttributeName], default:None) –The snapshot attribute to modify. Only volume creation permissions can be modified.
-
create_volume_permission(Optional[CreateVolumePermissionModifications], default:None) –A JSON representation of the snapshot attribute modification.
-
group_names(Optional[GroupNameStringList], default:None) –The group to modify for the snapshot.
-
operation_type(Optional[OperationType], default:None) –The type of operation to perform to the attribute.
-
snapshot_id(Optional[SnapshotId], default:None) –The ID of the snapshot.
-
user_ids(Optional[UserIdStringList], default:None) –The account ID to modify for the snapshot.
-
dry_run(Optional[Boolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To make a snapshot public
This example makes the snapshot snap-1234567890abcdef0 public.
>>> await client.modify_snapshot_attribute(snapshot_id='snap-1234567890abcdef0', attribute='createVolumePermission', operation_type='add', group_names=['all'])
To modify a snapshot attribute
This example modifies snapshot ``snap-1234567890abcdef0`` to remove the create volume permission for a user with the account ID ``123456789012``. If the command succeeds, no output is returned.
>>> await client.modify_snapshot_attribute(snapshot_id='snap-1234567890abcdef0', attribute='createVolumePermission', operation_type='remove', user_ids=['123456789012'])
Source code in docs_src/capo_ec2/_services/async_ec2.py
53091 53092 53093 53094 53095 53096 53097 53098 53099 53100 53101 53102 53103 53104 53105 53106 53107 53108 53109 53110 53111 53112 53113 53114 53115 53116 53117 53118 53119 53120 53121 53122 53123 53124 53125 53126 53127 53128 53129 53130 53131 53132 53133 53134 53135 53136 53137 53138 53139 53140 53141 53142 53143 53144 53145 53146 53147 53148 53149 53150 53151 53152 53153 53154 53155 53156 53157 53158 53159 53160 53161 53162 53163 53164 53165 53166 53167 53168 53169 53170 53171 53172 53173 53174 | |