File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_secgroup.cpython-310.pyc
Back
o ;j�d � @ s� d Z ddlZddlmZ ddlZddlmZmZ e� e �ZzddlZddl Ze� d��ej� dZW n ey= dZY nw dd � Z d*d d�Z d+dd �Zdd� Z d,dd�Zdd� Z d-dd�Z d+dd�Z d+dd�Z d*dd�Z d+dd�Z d*dd�Z d.d d!�Z d.d"d#�Z d*d$d%�Z d*d&d'�Z! d*d(d)�Z"dS )/a� Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at: .. code-block:: text http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html If IAM roles are not used you need to specify them either in a pillar or in the minion's config file: .. code-block:: yaml secgroup.keyid: GKTADJGHEIQSXMKKRBJ08H secgroup.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml secgroup.region: us-east-1 If a region is not specified, the default is us-east-1. It's also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config: .. code-block:: yaml myprofile: keyid: GKTADJGHEIQSXMKKRBJ08H key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs region: us-east-1 :depends: boto � N)�OrderedDict)�CommandExecutionError�SaltInvocationError�botoTFc C s0 t jjjddd�} | du rtd tdtd� | S )zg Only load if boto libraries exist and if boto libraries are greater than a given version. z2.4.0F)Zboto_verZcheck_boto3Tzboto.assign_funcsZec2)�pack)�salt�utilsZversionsZcheck_boto_reqs� __utils__�__name__�__salt__)Z has_boto_reqs� r �N/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_secgroup.py�__virtual__E s �r c C s6 t ||||d�}t|| |||||||d� } | rdS dS )z� Check to see if a security group exists. CLI Example: .. code-block:: bash salt myminion boto_secgroup.exists mysecgroup ��region�key�keyid�profile��name�vpc_id�vpc_name�group_idr r r r TF)� _get_conn� _get_group) r r r r r r r r �conn�groupr r r �existsW s �r c C s t d |||||d�}|�d�S )Nzboto_vpc.get_id)r r r r r �id)r �get)r r r r r r �datar r r �_vpc_name_to_id} s � r! c C st g }| D ]3}|� d�}|� d�}|� d�}|� d�}|D ]}|||d�}|�� D ]\} } | || <