File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_elasticsearch_domain.cpython-310.pyc
Back
o ;jT? � @ s4 d Z ddlZddlZddlZddlZddlmZ e�e �Z z$ddlZddlZddl mZ e�d��ej� e�d��ej� dZW n eyL dZY nw d d � Zdd� Zdd d�Zddd�Zddd�Z d dd�Zddd�Z d!dd�Z d"dd�Z d"dd�Z d"dd�ZdS )#a� Connection module for Amazon Elasticsearch Service .. versionadded:: 2016.11.0 :configuration: This module accepts explicit AWS credentials but can also utilize IAM roles assigned to the instance trough 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 lambda.keyid: GKTADJGHEIQSXMKKRBJ08H lambda.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml lambda.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 Create and delete methods return: .. code-block:: yaml created: true or .. code-block:: yaml created: false error: message: error message Request methods (e.g., `describe_function`) return: .. code-block:: yaml domain: - {...} - {...} or .. code-block:: yaml error: message: error message :depends: boto3 � N)�SaltInvocationError)�ClientError�boto�boto3TFc C s t jjjddd�S )zg Only load if boto libraries exist and if boto libraries are greater than a given version. z2.8.0z1.4.0)Zboto_verZ boto3_ver)�salt�utilsZversionsZcheck_boto_reqs� r r �Z/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_elasticsearch_domain.py�__virtual__i s r c C s t rtd td� d S d S )Nzboto3.assign_funcs�es)�HAS_BOTO� __utils__�__name__)�optsr r r �__init__t s �r c C s� t ||||d�}z|j| d�}ddiW S tyC } z$|j�di ��d�dkr1ddiW Y d }~S d td |�iW Y d }~S d }~ww )a Given a domain name, check to see if the given domain exists. Returns True if the given domain exists and returns False if the given function does not exist. CLI Example: .. code-block:: bash salt myminion boto_elasticsearch_domain.exists mydomain ��region�key�keyid�profile�� DomainName�existsT�ErrorZCodeZResourceNotFoundExceptionFN�error�boto3.get_error)� _get_conn�describe_elasticsearch_domainr �response�getr )r r r r r �conn�domain�er r r r y s ��r c s� t ||||d�}z%|j| d�� � r)d� v r)� �di �� d}d� fdd�|D �iW S ddiW S tyG } zd td |�iW Y d}~S d}~ww )z� Given a domain name describe its status. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_elasticsearch_domain.status mydomain r r �DomainStatus)ZEndpoint�CreatedZDeletedr ZDomainId� EBSOptions�SnapshotOptions�AccessPolicies� Processing�AdvancedOptions�ARN�ElasticsearchVersionr! c s i | ]}|� v r|� � |��qS r �r ��.0�k�r! r r � <dictcomp>� s zstatus.<locals>.<dictcomp>Nr r )r r r r r �r r r r r r �keysr"