From c71fa356c0d3c45dfa588a6840de7887614558dd Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Thu, 20 Apr 2023 20:39:07 -0700 Subject: [PATCH] update documentation to reflect module changes --- plugins/modules/ec2_snapshot.py | 56 ++++++++++++++++++++++++++++ plugins/modules/ec2_snapshot_info.py | 9 ++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/plugins/modules/ec2_snapshot.py b/plugins/modules/ec2_snapshot.py index b862f05403f..297ecebeba1 100644 --- a/plugins/modules/ec2_snapshot.py +++ b/plugins/modules/ec2_snapshot.py @@ -70,6 +70,40 @@ required: false default: 0 type: int + reset_create_volume_permission: + description: + - If set to I(true), ec2 snapshot's createVolumePermissions is set to 'private'. + - Mutually exclusive with I(modify_create_volume_permission). + required: false + default: false + type: bool + modify_create_volume_permission: + description: + - If set to I(true), ec2 snapshot's createVolumePermissions is can be modified. + - Mutually exclusive with I(reset_create_volume_permission). + - Must specify I(permission_operation_type) to add or remove createVolumePermissions. + required: false + default: false + type: bool + permission_operation_type: + description: + - Whether to add or remove createVolumePermission. + - Set to I(add) to add permissions and set to I(remove) to remove permissions. + - Must specify either I(user_ids) or I(group_names) to add or remove permissions. + required: false + type: str + group_names: + description: + - The group to be added or removed. The possible value is all. + - Mutually exclusive with I(user_ids). + required: false + type: str + user_ids: + description: + - The account user IDs to be added or removed. The possible value is all. + - Mutually exclusive with I(group_names). + required: false + type: str author: "Will Thames (@willthames)" extends_documentation_fragment: - amazon.aws.common.modules @@ -106,6 +140,28 @@ - amazon.aws.ec2_snapshot: volume_id: vol-abcdef12 last_snapshot_min_age: 60 + +- name: Reset snapshot createVolumePermission + amazon.aws.ec2_snapshot: + snapshot_id: snap-06a6f641234567890 + reset_create_volume_permission: true + +- name: Modify snapshot createVolmePermission to add user IDs + amazon.aws.ec2_snapshot: + snapshot_id: snap-06a6f641234567890 + modify_create_volume_permission: true + permission_operation_type: add + user_ids: + - '123456789012' + - '098765432109' + +- name: Modify snapshot createVolmePermission to remove user ID + amazon.aws.ec2_snapshot: + snapshot_id: snap-06a6f641234567890 + modify_create_volume_permission: true + permission_operation_type: remove + user_ids: + - '123456789012' """ RETURN = r""" diff --git a/plugins/modules/ec2_snapshot_info.py b/plugins/modules/ec2_snapshot_info.py index 8f5da758d22..b6734e5b3ad 100644 --- a/plugins/modules/ec2_snapshot_info.py +++ b/plugins/modules/ec2_snapshot_info.py @@ -194,6 +194,13 @@ type: str returned: always sample: "arn:aws:kms:ap-southeast-2:123456789012:key/74c9742a-a1b2-45cb-b3fe-abcdef123456" + create_volume_permissions: + description: + - The users and groups that have the permissions for creating volumes from the snapshot. + - The module will return empty list if the create volume permissions on snapshot are 'private'. + type: list + elements: dict + sample: [{"group": "all"}] next_token_id: description: - Contains the value returned from a previous paginated request where C(max_results) was used and the results exceeded the value of that parameter. @@ -233,7 +240,7 @@ def build_request_args(snapshot_ids, owner_ids, restorable_by_user_ids, filters, def get_snapshots(connection, module, request_args): - snapshot_ids = request_args.get("snapshot_ids") + snapshot_ids = request_args.get("SnapshotIds") try: snapshots = connection.describe_snapshots(aws_retry=True, **request_args) except is_boto3_error_code('InvalidSnapshot.NotFound') as e: