File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_elb.cpython-310.pyc
o
�N�g� � @ s d Z ddlZddlZddlZddlm mZ ddlZz'ddl Z ddl
Z ddlmZ ddl
mZmZmZmZ e�d��ej� dZW n eyM dZY nw e�e�Zdd � ZdKd
d�ZdKdd
�ZdKdd�ZdKdd�Zdd� Z dLdd�ZdKdd�Z dKdd�Z!dKdd�Z" dKdd�Z# dKdd �Z$ dKd!d"�Z%dKd#d$�Z&dKd%d&�Z'dKd'd(�Z(dKd)d*�Z)dKd+d,�Z* dKd-d.�Z+ dKd/d0�Z, dKd1d2�Z- dMd3d4�Z. dNd5d6�Z/ dKd7d8�Z0dKd9d:�Z1 dNd;d<�Z2 dNd=d>�Z3dKd?d@�Z4dKdAdB�Z5dCdD� Z6dOdEdF�Z7dGdH� Z8dIdJ� Z9dS )Pa�
Connection module for Amazon ELB
.. versionadded:: 2014.7.0
:configuration: This module accepts explicit elb 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
elb.keyid: GKTADJGHEIQSXMKKRBJ08H
elb.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
A region may also be specified in the configuration:
.. code-block:: yaml
elb.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 >= 2.33.0
� N)�HealthCheck)�AccessLogAttribute�ConnectionDrainingAttribute�ConnectionSettingAttribute�CrossZoneLoadBalancingAttribute�botoTFc C s2 t jjjddd�} | du rtd tddtd� | S ) z,
Only load if boto libraries exist.
z2.33.0F)Zboto_verZcheck_boto3Tzboto.assign_funcs�elbzec2.elb)�module�pack)�salt�utilsZversionsZcheck_boto_reqs� __utils__�__name__Z__salt__)Z
has_boto_reqs� r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_elb.py�__virtual__I s �r c
C sp t ||||d�}z|j| gd�}|rW dS t�d|� W dS tjjy7 } zt�|� W Y d}~dS d}~ww )z�
Check to see if an ELB exists.
CLI Example:
.. code-block:: bash
salt myminion boto_elb.exists myelb region=us-east-1
��region�key�keyid�profile��load_balancer_namesTz-The load balancer does not exist in region %sFN)� _get_conn�get_all_load_balancers�log�debugr � exception�BotoServerError�warning)�namer r r r �connr �errorr r r �existsV s
��r# c
C s\ t | |||d�}z
dd� |�� D �W S tjjy- } z
t�|� g W Y d}~S d}~ww )z�
Return all load balancers associated with an account
CLI Example:
.. code-block:: bash
salt myminion boto_elb.get_all_elbs region=us-east-1
r c S s g | ]}|�qS r r ��.0�er r r �
<listcomp>{ s z get_all_elbs.<locals>.<listcomp>N)r r r r r r r )r r r r r! r"