File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_cloudwatch_event.cpython-310.pyc
Back
o ;j�% � @ s d Z ddlZddlZddlZddlZe�e�Zzddl Z ddl Z ddlmZ e�d�� ej� dZW n eyF Z zdZW Y dZ[ndZ[ww dd� Zd d � Zddd�Z dd d�Zddd�Zddd�Zddd�Zddd�Zddd�Zddd�ZdS )a Connection module for Amazon CloudWatch Events .. versionadded:: 2016.11.0 :configuration: This module accepts explicit 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 cloudwatch_event.keyid: GKTADJGHEIQSXMKKRBJ08H cloudwatch_event.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml cloudwatch_event.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: boto3 � N)�ClientError�boto3TFc C s t jj�� S )z, Only load if boto libraries exist. )�salt�utilsZversionsZcheck_boto_reqs� r r �V/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cloudwatch_event.py�__virtual__H s r c C s t rtd td� d S d S )Nzboto3.assign_funcs�events)�HAS_BOTO� __utils__�__name__)�optsr r r �__init__O s �r c C s� t ||||d�}z*|j| d�}|sddiW S |�dg �D ]}|�dd�| kr-ddi W S qddiW S tyN } ztd |�} d | iW Y d}~S d}~ww )a Given a rule name, check to see if the given rule exists. Returns True if the given rule exists and returns False if the given rule does not exist. CLI Example: .. code-block:: bash salt myminion boto_cloudwatch_event.exists myevent region=us-east-1 ��region�key�keyid�profile)Z NamePrefix�existsF�Rules�NameNT�boto3.get_error�error�� _get_conn� list_rules�getr r ) r r r r r �connr �rule�e�errr r r r T s � ��r c C s� zEt |||| d�} i }dD ]}t� | durt� | ||<