
    VhX                        d Z dZdZddlZddlmZ ddlmZ ddlmZ ddlmZ dd	lm	Z	 dd
l
mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl m"Z" ddl#m$Z$ ddl%m&Z& d:dedee'   deee'ef      fdZ(d;d Z)d:ded!ee'   de*fd"Zded#ee'ef   de	ee'ef   e*f   fd$Z+ded%e'de	ee'ef   e*f   fd&Zded'ee'ef   d(ee'ef   d)e'de	ee'ef   e*f   f
d*Zded(ee'ef   d)e'de*fd+Z,d:d'ee'ef   d,ee'   deee'ef      fd-Z-ded'ee'ef   de	ee'ef   e*f   fd.Zd:d#ee'ef   d/eee'e'f      dee'ef   fd0Z.	 d<d(eee'ef      d)ee'   dee'   fd1Z/ded2e'd3e'd/ee'ef   d4e*de	ee'ef   e*f   fd5Z0ded#eee'ef      ddfd6Z1ded#eee'ef      ddfd7Z2d8 Z3e4d9k(  r e3        yy)=aO  
---
module: ec2_vol
version_added: 1.0.0
short_description: Create and attach a volume, return volume ID and device map
description:
  - Creates an EBS volume and optionally attaches it to an instance.
  - If both O(instance) and O(name) are given and the instance has a device at the device name, then no volume is created and no attachment is made.
options:
  instance:
    description:
      - Instance ID if you wish to attach the volume.
      - Set to V(None) to detach the volume.
    type: str
  name:
    description:
      - Volume Name tag if you wish to attach an existing volume (requires instance).
    type: str
  id:
    description:
      - Volume ID if you wish to attach an existing volume (requires instance) or remove an existing volume.
    type: str
  volume_size:
    description:
      - Size of volume (in GiB) to create.
    type: int
  volume_type:
    description:
      - Type of EBS volume; V(standard) (magnetic), V(gp2) (SSD), V(gp3) (SSD), V(io1) (Provisioned IOPS), V(io2) (Provisioned IOPS),
        V(st1) (Throughput Optimized HDD), V(sc1) (Cold HDD).
      - V(standard) is the old EBS default and continues to remain the Ansible default for backwards compatibility.
    default: standard
    choices: ['standard', 'gp2', 'io1', 'st1', 'sc1', 'gp3', 'io2']
    type: str
  iops:
    description:
      - The provisioned IOPs you want to associate with this volume (integer).
    type: int
  encrypted:
    description:
      - Enable encryption at rest for this volume.
    default: false
    type: bool
  kms_key_id:
    description:
      - Specify the ID of the KMS key to use.
    type: str
  device_name:
    description:
      - Device ID to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows.
    type: str
  delete_on_termination:
    description:
      - When set to C(true), the volume will be deleted upon instance termination.
    type: bool
    default: false
  zone:
    description:
      - Zone in which to create the volume, if unset uses the zone the instance is in (if set).
    aliases: ['availability_zone', 'aws_zone', 'ec2_zone']
    type: str
  snapshot:
    description:
      - Snapshot ID on which to base the volume.
    type: str
  state:
    description:
      - Whether to ensure the volume is present or absent.
      - O(state=list) was deprecated in release 1.1.0 and is no longer available
        with release 4.0.0.
      - The V(list) functionality has been moved to a dedicated module M(amazon.aws.ec2_vol_info).
    default: present
    choices: ['absent', 'present']
    type: str
  modify_volume:
    description:
      - The volume won't be modified unless this key is V(true).
    type: bool
    default: false
    version_added: 1.4.0
  throughput:
    description:
      - Volume throughput in MB/s.
      - This parameter is only valid for gp3 volumes.
      - Valid range is from 125 to 1000.
    type: int
    version_added: 1.4.0
  multi_attach:
    description:
      - If set to V(true), Multi-Attach will be enabled when creating the volume.
      - When you create a new volume, Multi-Attach is disabled by default.
      - This parameter is supported with io1 and io2 volumes only.
    type: bool
    version_added: 2.0.0
  outpost_arn:
    description:
      - The Amazon Resource Name (ARN) of the Outpost.
      - If set, allows to create volume in an Outpost.
    type: str
    version_added: 3.1.0
author:
  - "Lester Wade (@lwade)"
notes:
  - Support for O(purge_tags) was added in release 1.5.0.
extends_documentation_fragment:
  - amazon.aws.common.modules
  - amazon.aws.region.modules
  - amazon.aws.tags
  - amazon.aws.boto3
a  
# Simple attachment action
- amazon.aws.ec2_vol:
    instance: XXXXXX
    volume_size: 5
    device_name: sdd
    region: us-west-2

# Example using custom iops params
- amazon.aws.ec2_vol:
    instance: XXXXXX
    volume_size: 5
    iops: 100
    device_name: sdd
    region: us-west-2

# Example using snapshot id
- amazon.aws.ec2_vol:
    instance: XXXXXX
    snapshot: "{{ snapshot }}"

# Playbook example combined with instance launch
- amazon.aws.ec2:
    keypair: "{{ keypair }}"
    image: "{{ image }}"
    wait: true
    count: 3
  register: ec2
- amazon.aws.ec2_vol:
    instance: "{{ item.id }}"
    volume_size: 5
  loop: "{{ ec2.instances }}"
  register: ec2_vol

# Example: Launch an instance and then add a volume if not already attached
#   * Volume will be created with the given name if not already created.
#   * Nothing will happen if the volume is already attached.

- amazon.aws.ec2:
    keypair: "{{ keypair }}"
    image: "{{ image }}"
    zone: YYYYYY
    id: my_instance
    wait: true
    count: 1
  register: ec2

- amazon.aws.ec2_vol:
    instance: "{{ item.id }}"
    name: my_existing_volume_Name_tag
    device_name: /dev/xvdf
  loop: "{{ ec2.instances }}"
  register: ec2_vol

# Remove a volume
- amazon.aws.ec2_vol:
    id: vol-XXXXXXXX
    state: absent

# Detach a volume (since 1.9)
- amazon.aws.ec2_vol:
    id: vol-XXXXXXXX
    instance: None
    region: us-west-2

# Create new volume using SSD storage
- amazon.aws.ec2_vol:
    instance: XXXXXX
    volume_size: 50
    volume_type: gp2
    device_name: /dev/xvdf

# Create new volume with multi-attach enabled
- amazon.aws.ec2_vol:
    zone: XXXXXX
    multi_attach: true
    volume_size: 4
    volume_type: io1
    iops: 102

# Attach an existing volume to instance. The volume will be deleted upon instance termination.
- amazon.aws.ec2_vol:
    instance: XXXXXX
    id: XXXXXX
    device_name: /dev/sdf
    delete_on_termination: true
a  
device:
    description: Device name of attached volume.
    returned: when success
    type: str
    sample: "/dev/sdf"
volume_id:
    description: The id of volume.
    returned: when success
    type: str
    sample: "vol-35b333d9"
volume_type:
    description: The volume type.
    returned: when success
    type: str
    sample: "standard"
volume:
    description: A dictionary containing detailed attributes of the volume.
    returned: when success
    type: dict
    contains:
        attachment_set:
            description:
                - Information about the volume attachments.
                - This was changed in version 2.0.0 from a dictionary to a list of dictionaries.
            type: list
            elements: dict
            returned: when success
            sample: [{
                "attach_time": "2015-10-23T00:22:29.000Z",
                "deleteOnTermination": "false",
                "device": "/dev/sdf",
                "instance_id": "i-8356263c",
                "status": "attached"
            }]
        create_time:
            description: The time stamp when volume creation was initiated.
            type: str
            returned: when success
            sample: "2015-10-21T14:36:08.870Z"
        encrypted:
            description: Indicates whether the volume is encrypted.
            type: bool
            returned: when success
            sample: False
        id:
            description: The ID of the volume.
            type: str
            returned: when success
            sample: "vol-35b333d9"
        iops:
            description: The number of I/O operations per second (IOPS) that the volume supports.
            type: int
            returned: when success
            sample: null
        size:
            description: The size of the volume, in GiBs.
            type: int
            returned: when success
            sample: 1
        snapshot_id:
            description: The snapshot from which the volume was created, if applicable.
            type: str
            returned: when success
            sample: ""
        status:
            description: The volume state.
            type: str
            returned: when success
            sample: "in-use"
        tags:
            description: Any tags assigned to the volume.
            type: dict
            returned: when success
            sample: {
                env: "dev"
                }
        type:
            description: The volume type. This can be gp2, io1, st1, sc1, or standard.
            type: str
            returned: when success
            sample: "standard"
        zone:
            description: The Availability Zone of the volume.
            type: str
            returned: when success
            sample: "us-east-1b"
        throughput:
            description: The throughput that the volume supports, in MiB/s.
            type: int
            returned: when success
            sample: 131
    N)Any)Dict)List)Optional)Tuple)camel_dict_to_snake_dict)is_outpost_arn)AnsibleEC2Error)attach_volume)create_volume)delete_volume)describe_ec2_tags)describe_instances)describe_volumes)detach_volume)ensure_ec2_tags)modify_instance_attribute)modify_volume)AnsibleAWSModule)boto3_tag_list_to_ansible_dict)boto3_tag_specifications)!ansible_dict_to_boto3_filter_list)wait_for_resource_statemoduleinstance_idreturnc                     d }|s|S 	 t        ||g      }|rt        |d   d   d         }|S # t        $ r!}| j                  |d|        Y d }~|S d }~ww xY w)N)InstanceIdsr   	Instancesz(Error while getting instance_id with id msg)r   r   r
   fail_json_aws)r   ec2_connr   instancereservation_responsees         f/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/amazon/aws/plugins/modules/ec2_vol.pyget_instancer(   H  s    H^1(V/0DQ0G0TUV0WXH O  ^Q&N{m$\]]O^s   $. 	AAAc                    | j                   j                  d      }| j                   j                  d      }| j                   j                  d      }|s|}||y t               }g }|r|g|d<   n%|rt        d|i      |d<   n|rt        d|i      |d<   	 t	        |fi |}|s'|r$|r"d| }	|r|	d	| z  }	| j                  |	
       ny t        |      dkD  r'| j                  d| |D cg c]  }|d   	 c}       t        |d         }|S # t        $ r }
| j                  |
d| 
       Y d }
~
id }
~
ww xY wc c}w )Nnameidzone	VolumeIdsztag:NameFilterszavailability-zonezCould not find volume with id: z and name: r    z4Error while getting EBS volumes with the parameters    z=Found more than one volume in zone (if specified) with name: VolumeId)r!   foundr   )
paramsgetdictr   r   	fail_jsonr
   r"   lenr   )r   r#   vol_idfail_on_not_foundr*   param_idr,   find_paramsvolsr!   r&   vvols                r'   
get_volumer>   W  s{   ==V$D}}  &H==V$D ~$,&KD$*8K 	!BJPTCU!VI	!BDWY]C^!_Ij8K8 V7x@[//C  S ) 4y1}OPTvV*./Q1Z=/ 	 	
 #47
+CJ  jQ&Z[fZg$hiij 0s   4D ,D<
	D9D44D9	volume_idc                     d}|r	 t        ||      }t        || d|g       |S # t        $ r}| j                  |d       Y d }~3d }~ww xY w)NFzError while deleting volumer    volume_deletedr-   )delete_ec2_volumer
   r"   r   )r   r#   r?   changedr&   s        r'   r   r     s_    G	G')<G 	 &2BykZN  	G  (E FF	Gs   $ 	A
AA
volumec                    d}d|d   i}| j                   j                  d      r| j                   j                  d      }d }d}|r|d   }||k7  rd}||d<   d}| j                   j                  d      }	|j                  d      }
|	r|	|
k7  rd}|	|d	<   n4|
|d	<   n.|r,|d
k(  r'|
rt        |
      dk  st        |
      dkD  s|
sd|d	<   d}| j                   j                  d      }d}|r|d   }||k7  rd}||d<   | j                   j                  d      }d }d}|r|d   }||k7  rd}||d<   | j                   j                  d      }d}|r|j                  d      }||k7  rd}||d<   | j                   j                  d      }d}||d   }||k7  rd}||d<   |xs |xs
 |xs |xs |}|r| j                  r| j	                  dd       	 t        |fi |}j                  d      |d<   |j                  d      |d<   |j                  d      |d<   |j                  d      |d<   |j                  d      |d<   ||fS # t        $ r}| j                  |d       Y d }~d }~ww xY w)NFr0   r?   r   volume_typeT
VolumeTypeiopsIopsgp3  >  volume_sizesizeSize
throughput
Throughputmulti_attachmulti_attach_enabledMultiAttachEnabledz/Would have updated volume if not in check mode.rD   r!   zError while modifying volumer    
TargetSizeTargetVolumeType
TargetIopsTargetMultiAttachEnabledTargetThroughput)r2   r3   int
check_mode	exit_jsonr   r
   r"   )r   r#   rE   rD   req_objtarget_typeoriginal_typetype_changediops_changedtarget_iopsoriginal_iopstarget_sizesize_changedoriginal_sizetarget_throughputthroughput_changedoriginal_throughputtarget_multi_attachmulti_attach_changedoriginal_multi_attachresponser&   s                         r'   update_volumerp     s   G6+./G}})mm''6"=1Mm+#(3%mm''/

6*m+#"-"/
 u 4!s='9D'@CDVY^D^hu&*GFO#'Lmm''6"6NMm+#"-mm''6"=1Mm+#(3%"MM--l;""(**\": $77%)"(9%$mm//?$*$*+A$B!"&;;'+$0C,-l,l,lBTlXl    3d eL(=W= &\\,7F6N$,LL1C$DF=!%\\,7F6N-5\\:T-UF)*#+<<0B#CF< 7? # L$$Q,J$KKLs   H? ?	I%I  I%r,   c                    d}| j                   j                  d      }| j                   j                  d      }| j                   j                  d      }| j                   j                  d      }| j                   j                  d      }| j                   j                  d      }	| j                   j                  d      }
| j                   j                  d	      }| j                   j                  d
      }| j                   j                  d      xs i }| j                   j                  d      }t        | |      }| j                  r| j	                  dd       |d}t               }|rt        |      |d<   |r||d<   |	r|	|d<   |rt        |      |d<   |dk(  r|sd|d<   |
rt        |
      |d<   |rd|d<   |r"t        |      r||d<   n| j                  d       |r||d<   |rt        |dg      |d<   	 t        |f|||d|}t        || d!d"   g#       t        | ||d"   $      }||fS # t        $ r}| j                  |d        Y d }~Id }~ww xY w)%NFrI   	encrypted
kms_key_idrN   rG   snapshotrQ   rS   outpost_arntagsr*   Tz1Would have created a volume if not in check mode.rV   rP   KmsKeyId
SnapshotIdrJ   rK   rL   rR   rU   
OutpostArnzFOutpostArn does not match the pattern specified in API specifications.NamerE   )typesTagSpecifications)AvailabilityZone	EncryptedrH   zError while creating EBS volumer    volume_availabler0   rB   r7   )r2   r3   r>   r]   r^   r4   r\   r	   r5   r   create_ec2_volumer
   r"   r   )r   r#   r,   rD   rI   rr   rs   rN   rG   rt   rQ   rS   ru   rv   r*   rE   additional_paramscreate_vol_responser&   s                      r'   r   r     st   G==V$D!!+.I""<0J--##M2K--##M2K}}  ,H""<0J==$$^4L--##M2K==V$*D==V$D)F+^_~ F(+K(8f%,6j).6l+(+D	f% %(,f%.1*ol+6:23k*2=!,/  !ijDL5Md[cZd5e12	K"3#+/9Q\#`q# 	 &2DQdeoQpPqrFH5H5TU7?  	K  (I JJ	Ks   9H1 1	I:IIvolume_dictinstance_dictdevice_namec                    d}t        |d      }|r| j                  rC|d   j                  d      dv r-|d   j                  dd      }| j                  dd	| d
|       |d   sQ|d   j                  dd       |d   k7  r2|d   j                  dd      }| j	                  d|d    d| d
       n||fS 	 | j                  r| j                  dd       t        |||d   |d         }t        || dd   g       d}t        | |||       t        | ||d         }
|
|fS # t        $ r}	| j                  |	d       Y d }	~	Yd }	~	ww xY w)NFattachedwanted_stater   status)r   	attachingr   Nonez5IN CHECK MODE - volume already attached to instance: .)rD   r!   rE   rT   zVolume r?   z* is already attached to another instance: r    Tz0Would have attached volume if not in check mode.rV   )devicer   r?   z Error while attaching EBS volumevolume_in_user0   rB   r   )get_attachment_datar]   r3   r^   r5   attach_ec2_volumer
   r"   r   modify_dot_attributer>   )r   r#   r   r   r   rD   attachment_datar   attach_responser&   rE   s              r'   r   r   (  s    G *+JOOq!%%h/3LL-a044]FK  !OP[}\]^& ! 
 12q!%%mT:mM>ZZ-a044]FK  !+k":!;;efqerrst !  #G++HT/ab+[mM6R^iju^v
 Hfo/ZdJeIfgG=+F[1IJF7?  HQ$FGGHs   84D$ $	E
-EE
c                    | j                   j                  d      }d}d}d}|V|dz  }t        | ||d         }t        ||      }|.|d	kD  r| j	                  d
||       t        j                  d       |V||d   j                  d      k7  r	 t        ||d   |d|idg       d}|S |S # t        $ r$}| j                  |d|d           Y d}~|S d}~ww xY w)z&Modify delete_on_termination attributedelete_on_terminationFNr   r/   r   )r#   r   r   r      z!Unable to find device on instance)r!   r   r$   ebsDeleteOnTermination)
DeviceNameEbs)r   BlockDeviceMappingsTz7Error while modifying Block Device Mapping of instance r    )
r2   r3   r(   get_mapped_block_devicer5   timesleepr   r
   r"   )	r   r#   r   r   r   rD   mapped_block_device_attemptr&   s	            r'   r   r   Z  s5    #MM--.EFG H

%A$VhMZgLhi5M_jk&!|  %HQ\gt uJJqM 
%  3E : > >?V WW	%)-8#.8MOd7ef% G N7N  	  PQ^_lQmPno !   N	s   B/ /	C8CCr   c                 P   g }| s|S | j                  dg       }|r|D cg c]  }|d   |k(  s| }}|D ]i  }|j                  |j                  dd       |j                  dd       |j                  dd       |j                  dd       |j                  dd       d       k |S c c}w )Nattachmentsstateattach_timer   r   r   )r   r   r   r   r   )r3   append)r   r   r   resourcedatas        r'   r   r     s    O}b1H%-OTg,1NDOO 	
#xxt<((8T2#xxt<((7D1)-2I4)P	
	
  Ps
   B#B#c                 <   d}t        |d      }|D ]K  }| j                  r| j                  dd       	 t        ||d   |d   	       t        || d|d   g       d}M t        | ||d         }||fS # t        $ r}| j                  |d
       Y d }~Md }~ww xY w)NFr   r   Tz0Would have detached volume if not in check mode.rV   r?   r   )r?   
InstanceIdzError while detaching volumer    r   rB   r   )r   r]   r^   detach_ec2_volumer
   r"   r   r>   )r   r#   r   rD   r   
attachmentr&   s          r'   r   r     s    G)+JOO% 	
T/ab	Hh+k2JWaboWpq 	 &2DQ\]hQiPjk	 VXk+6NOK  	H  (F GG	Hs   A55	B>BBrv   c                    |st        | j                  d            }t        |       }| j                  d      | j                  d      | j                  d      | j                  d      | j                  d      | j                  d      | j                  d      | j                  d	      | j                  d
      || j                  d      |d}| j                  d      |d<   |S )Nrv   create_timerr   r?   rI   rO   snapshot_idr   rG   availability_zonerT   )r   rr   r+   rI   rO   r   r   typer,   attachment_setrT   rv   rQ   )r   r3   r   )rE   rv   r   volume_infos       r'   get_volume_infor     s    -fjj.@A)&1Ozz-0ZZ,jj%

6"

6"zz-0**W%

=)

./) &

+A BK !'

< 8K    c                 b    d }| s|S |s|S | j                  dg       D ]  }|d   |k(  s|} |S  |S )Nblock_device_mappingsr   )r3   )r   r   r   r   s       r'   r   r     s]     """"##$;R@ - K/"(
 r   res_idres_type
purge_tagsc           	      j    | j                   ri dfS t        || ||||dg      }t        || ||      }||fS )NTzInvalidVolume.NotFound)r]   r   r   )r   
connectionr   r   rv   r   rD   
final_tagss           r'   ensure_tagsr     sK     4xj&&(D*WoVpqG":vvxHJwr   c           
      
   |j                   j                  d      }|j                   j                  d      }|j                   j                  d      }|j                   j                  d      }|j                   j                  d      }|||j                  d       |dk(  s|d	k(  rd }d
}nd}d }	|r|t        || |      }	|	d   d   }||	j                  dd	      dk(  rd}nd}t	        |	|      }
|
r;d}|r|d   |
d   d   k7  rd
}nd
}|r"|j                  d| d| |
d   d   ||d       d }d}|rct        || |      \  }}|r!|st        |j                  d            }||d<   t        || |d   d||j                   j                  d            \  }}nt        || |      \  }}|rt        || |      \  }}n|	t        || ||	|      \  }}nd}t        ||      }|s|rd
}|j                  ||||d    |d!   "       y )#Nr$   r*   r,   r   rv   z(You must specify either instance or zoner    r    TF)r   	placementr   platformWindowsz	/dev/xvdfz/dev/sdfr   r?   r   zVolume mapping for z already exists on instance )r!   r?   found_volumer   rD   rz   rE   r   )r,   r   )r   r   r   )rv   r+   r   )rD   rE   r   r?   rG   )r2   r3   r5   r(   r   r^   rp   r   r   r   r   r   r   )r#   r   rE   r$   r*   r,   r   rv   detach_vol_flaginstmapped_deviceother_volume_mappedr   tags_changedrD   attach_changedr   s                    r'   ensure_presentr     sy   }}  ,H==V$D==V$D--##M2K==V$D DLGH 6X^ DFH(CK !45 xx
B'94)( 0dP[\"'+&-*>{*KK*.' '+#"  -k]:VW_V`a+E2;?!'&! !  JL'&A5fjj6HIDL#.Hf[18T6==CTCTUaCb$
 
L (tD!.vxV!T		!.H&R]"
  "&z:K~
d#'  r   c                 h   |j                   j                  d      }|j                   j                  d      }d}|s|s|j                  d       |rQ|j                  d      dvr>|j                  r|j	                  dd	       t        || |
       t        || |d         }|j	                  |       y )Nr*   r+   Fz,A volume name or id is required for deletionr   )deletingdeletedTz/Would have deleted volume if not in check mode.rV   r   r?   )r?   )rD   )r2   r3   r5   r]   r^   r   r   )r#   r   rE   r*   r9   rD   s         r'   ensure_absentr   9  s    ==V$D}}  &HGGH&**W%-DDT/`afhF;F;<OP
W%r   c            
      t   t        d<i dt               dt               dt               dt        d      dt        dg d	
      dt        d      dt        dd      dt               dt               dt        dd      dt        g d      dt               dt        dddg
      dt        ddg      dt        dd      dt        d      d t        d!      d"t        dd#$      d%t        d      } t        | dd&dggdd'dgggd#(      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }	|j                  j                  d%      }
|r{|d)v r|j	                  d*+       |d,k(  r.t        |      d-k  st        |      d.kD  r|j	                  d/+       |d0v r.t        |      d1k  st        |      d2kD  r|j	                  d3+       |	r3|d,k7  r|j	                  d4+       |	d5k  s|	d6kD  r|j	                  d7+       |
d#u r|d0vr|j	                  d8+       |j                  d9      }|s|s|s|s|j	                  d:+       t        ||d;      }|dk(  rt        |||       y |dk(  rt        |||       y y )=Nr$   r+   r*   rN   r\   )r   rG   standard)r   gp2io1st1sc1rK   io2)defaultchoicesrI   rr   Fbool)r   r   rs   r   r   r,   )r   aws_zoneec2_zone)aliasesrt   r   presentabsentrv   r4   resource_tags)r   r   r   rQ   ru   strr   T)r   r   rS   r   r   )argument_specrequired_ifsupports_check_mode)r   r   r   r   z=IOPS is not supported for gp2, st1, sc1, or standard volumes.r    rK   rL   rM   zBFor a gp3 volume type, IOPS values must be between 3000 and 16000.)r   r   d   i   zHFor io1 and io2 volume types, IOPS values must be between 100 and 64000.z,Throughput is only supported for gp3 volume.}   i  z/Throughput values must be between 125 and 1000.z7multi_attach is only supported for io1 and io2 volumes.ec2zTYou must specify volume_size or identify an existing volume by id, name, or snapshot)r8    )
r4   r   r2   r3   r5   r\   clientr>   r   r   )r   r   r9   r*   rN   rt   r   rI   rG   rQ   rS   r#   rE   s                r'   mainr   G  sV    6 V e$	
 5kl u u62 6 F #5v> GH  9x.CD v'89 5v6  U#!" e$#$ VT2%& v&'M, #EF8,EF8,
 !F }}  &H==V$D--##M2K}}  ,HMMg&E==V$D--##M2K""<0J==$$^4L;;!`a%SY%5TU9J!ef.(c$i#oTUAR!kl%!OPzD0!RSt> AVW}}U#H DHst EBF	x0	(	h/ 
r   __main__)N)NT)NN)5DOCUMENTATIONEXAMPLESRETURNr   typingr   r   r   r   r   0ansible.module_utils.common.dict_transformationsr   7ansible_collections.amazon.aws.plugins.module_utils.arnr	   7ansible_collections.amazon.aws.plugins.module_utils.ec2r
   r   r   r   r   r   rC   r   r   r   r   r   r   r   r   ;ansible_collections.amazon.aws.plugins.module_utils.modulesr   ;ansible_collections.amazon.aws.plugins.module_utils.taggingr   r   Bansible_collections.amazon.aws.plugins.module_utils.transformationr   ;ansible_collections.amazon.aws.plugins.module_utils.waitersr   r   r(   r>   r   rp   r   r   r   r   r   r   r   r   __name__r   r   r'   <module>r      sk  m^Vp\
|       U R S f f f U V T f S ] Q X f ` p _) (3- [cdhilnqiqdr[s )X* # Z^ Q* Qd38n QQVW[\_ad\dWegkWkQl QhC* CC CE$sTWx.Z^J^D_ CL//59#s(^/TXY\^aYaTb/qt/
4S>4 /d"!1 "DQTVYQYN "il "qu "JT#s(^ 8C= \`aefiknfnao\p . *  4S>  V[\`adfiai\jlp\pVq  (DcN (4S>2J VZ[^`c[cVd 2 RVDcN+AI#c]"25ADLPQTVYQYNhl
4S>4 X%5 XxSRUX?W X\` Xv&$4 &htCQTH~>V &[_ &I0X zF r   