File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_cloudtrail.cpython-310.pyc
Back
o ;j�9 � @ s: d Z ddlZddlZddlZe�e�ZzddlZddl Z ddl mZ e�d��ej � dZW n ey9 dZY nw dd� Zd d � Zd%dd�Z d&d d�Zd%dd�Zd%dd�Zd%dd�Zd%dd�Z d&dd�Zd%dd�Zd%dd�Zd%dd�Zd%dd �Zd%d!d"�Zd%d#d$�ZdS )'aN Connection module for Amazon CloudTrail .. versionadded:: 2016.3.0 :depends: - boto - boto3 The dependencies listed above can be installed via package or pip. :configuration: This module accepts explicit Lambda 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 cloudtrail.keyid: GKTADJGHEIQSXMKKRBJ08H cloudtrail.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml cloudtrail.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 � N)�ClientError�boto3TFc C s t jjjdd�S )zg Only load if boto libraries exist and if boto libraries are greater than a given version. z1.2.5)Z boto3_ver)�salt�utilsZversionsZcheck_boto_reqs� r r �P/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cloudtrail.py�__virtual__M s r c C s t rtd td� d S d S )Nzboto3.assign_funcsZ cloudtrail)�HAS_BOTO� __utils__�__name__)�optsr r r �__init__X s �r c C s� zt ||||d�}|j| d� ddiW S tyE } z&td |�}|j�di ��d�dkr7dd iW Y d }~S d|iW Y d }~S d }~ww )a Given a trail name, check to see if the given trail exists. Returns True if the given trail exists and returns False if the given trail does not exist. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.exists mytrail ��region�key�keyid�profile��Name�existsT�boto3.get_error�Error�Code�TrailNotFoundExceptionFN�error�� _get_connZget_trail_statusr r �response�get)r r r r r �conn�e�errr r r r ] s ��r c C � zDt | ||| d�}i }dD ]}t� | durt� | ||<