%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlmZej	e
�Zd�Zdddddddd	d
d
dd�Zddddd
�Zddddd�Zddddd�ZdS(u`
Manage AWS Application Load Balancer

.. versionadded:: 2017.7.0

Add and remove targets from an ALB target group.

This module uses ``boto3``, which can be installed via package, or pip.

This module accepts explicit alb 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 `here
<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 file or
in the minion's config file:

.. code-block:: yaml

    elbv2.keyid: GKTADJGHEIQSXMKKRBJ08H
    elbv2.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
    elbv2.region: us-west-2

It's also possible to specify ``key``, ``keyid`` and ``region`` via a profile, either
passed in as a dict, or as a string to pull from pillars or minion config:

.. code-block:: yaml

    myprofile:
        keyid: GKTADJGHEIQSXMKKRBJ08H
        key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
        region: us-east-1
i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@sdtkrdStdfS(u)
    Only load if boto is available.
    uboto_elbv2.target_group_existsu
boto_elbv2u?The boto_elbv2 module cannot be loaded: boto3 library not found(t__salt__tFalse(((s:/usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pyt__virtual__1suHTTPutraffic-portu/iiicK@s3i|d6dd6dd6id6}td|||||�r_t|d<dj|�|d<|Stdr�d	j|�|d<|Std
||||d|d|d
|d|d|d|	d|
d|d|d|
d||�}|r||dd<t|d<dj|�|d<nt|d<dj|�|d<|S(u�
    .. versionadded:: 2017.11.0

    Create target group if not present.

    name
        (string) - The name of the target group.
    protocol
        (string) - The protocol to use for routing traffic to the targets
    port
        (int) - The port on which the targets receive traffic. This port is used unless
        you specify a port override when registering the traffic.
    vpc_id
        (string) - The identifier of the virtual private cloud (VPC).
    health_check_protocol
        (string) - The protocol the load balancer uses when performing health check on
        targets. The default is the HTTP protocol.
    health_check_port
        (string) - The port the load balancer uses when performing health checks on
        targets. The default is 'traffic-port', which indicates the port on which each
        target receives traffic from the load balancer.
    health_check_path
        (string) - The ping path that is the destination on the targets for health
        checks. The default is /.
    health_check_interval_seconds
        (integer) - The approximate amount of time, in seconds, between health checks
        of an individual target. The default is 30 seconds.
    health_check_timeout_seconds
        (integer) - The amount of time, in seconds, during which no response from a
        target means a failed health check. The default is 5 seconds.
    healthy_threshold_count
        (integer) - The number of consecutive health checks successes required before
        considering an unhealthy target healthy. The default is 5.
    unhealthy_threshold_count
        (integer) - The number of consecutive health check failures required before
        considering a target unhealthy. The default is 2.

    returns
        (bool) - True on success, False on failure.

    CLI example:
    .. code-block:: yaml

        create-target:
          boto_elb2.create_targets_group:
            - name: myALB
            - protocol: https
            - port: 443
            - vpc_id: myVPC
    unameuresultuucommentuchangesuboto_elbv2.target_group_existsuTarget Group {0} already existsutestu Target Group {0} will be createduboto_elbv2.create_target_grouptregiontkeytkeyidtprofilethealth_check_protocolthealth_check_portthealth_check_paththealth_check_interval_secondsthealth_check_timeout_secondsthealthy_threshold_counttunhealthy_threshold_countutarget_groupuTarget Group {0} createdu Target Group {0} creation failedN(tNoneRtTruetformatt__opts__R(tnametprotocoltporttvpc_idRRR	R
RRR
RRRRtkwargstrettstate((s:/usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pytcreate_target_group:s>9"


	

c
C@s�i|d6dd6dd6id6}td|||||�s_t|d<dj|�|d<|Stdr�d	j|�|d<|Std
|d|d|d
|d|�}|r�t|d<||dd<dj|�|d<nt|d<dj|�|d<|S(u�
    Delete target group.

    name
        (string) - The Amazon Resource Name (ARN) of the resource.

    returns
        (bool) - True on success, False on failure.

    CLI example:

    .. code-block:: bash

        check-target:
          boto_elb2.delete_targets_group:
            - name: myALB
            - protocol: https
            - port: 443
            - vpc_id: myVPC
    unameuresultuucommentuchangesuboto_elbv2.target_group_existsu Target Group {0} does not existsutestu Target Group {0} will be deleteduboto_elbv2.delete_target_groupRRR	R
utarget_groupuTarget Group {0} deletedu Target Group {0} deletion failedN(RRRRRR(RRRR	R
RR((s:/usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pytdelete_target_group�s("


	

c
K@sJi|d6dd6dd6id6}td|||||�r3td|d|d	|d
|d|�}t}	t}
tj|�}t|tj�r�|g}nx�|D]�}||kr�|j|�dkr�|dd
j|||�|d<t	|d<q�t
dr#t	}
|jid|6�q�td||d|d	|d
|d|�}
|
rgt	}
t	|d<q�dj|�|d<t	}	q�W|	r�t|d<n|
r/||dd<t
dr�dj|�|d<d|d<||dd<q/dj|�|d<td|d|d	|d
|d|�}||dd<n|Sdj|�|d<|S(u7
    .. versionadded:: 2017.7.0

    Add targets to an Application Load Balancer target group. This state will not remove targets.

    name
        The ARN of the Application Load Balancer Target Group to add targets to.

    targets
        A list of target IDs or a string of a single target that this target group should
        distribute traffic to.

    .. code-block:: yaml

        add-targets:
          boto_elb.targets_registered:
            - name: arn:myloadbalancer
            - targets:
              - instance-id1
              - instance-id2
    unameuresultuucommentuchangesuboto_elbv2.target_group_existsu!boto_elbv2.describe_target_healthRRR	R
udrainingu,Target/s {0} already registered and is {1}.
utestuinitialuboto_elbv2.register_targetsu&Target Group {0} failed to add targetsuoldu!Target Group {0} would be changedunewu!Target Group {0} has been changeduCould not find target group {0}N(RRRtcopyt
isinstanceRtstring_typestgetRRRtupdate(RttargetsRRR	R
RRthealthtfailuretchangestnewhealth_mockttargetRt	newhealth((s:/usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pyttargets_registered�s`"
	
!"


	





	c
K@sCi|d6dd6dd6id6}td|||||�r,td|d|d	|d
|d|�}t}	t}
tj|�}t|tj�r�|g}nx�|D]�}||ks�|j|�dkr�|dd
j|�|d<t	|d<q�t
drt	}
|jid|6�q�td||d|d	|d
|d|�}
|
r`t	}
t	|d<q�dj|�|d<t	}	q�W|	r�t|d<n|
r(||dd<t
dr�dj|�|d<d|d<||dd<q(dj|�|d<td|d|d	|d
|d|�}||dd<n|Sdj|�|d<|S(u
    Remove targets to an Application Load Balancer target group.

    name
        The ARN of the Application Load Balancer Target Group to remove targets from.

    targets
        A list of target IDs or a string of a single target registered to the target group to be removed

    .. versionadded:: Unknown

    .. code-block:: yaml

        remove-targets:
          boto_elb.targets_deregistered:
            - name: arn:myloadbalancer
            - targets:
              - instance-id1
              - instance-id2
    unameuresultuucommentuchangesuboto_elbv2.target_group_existsu!boto_elbv2.describe_target_healthRRR	R
udrainingu"Target/s {0} already deregistered
utestuboto_elbv2.deregister_targetsu)Target Group {0} failed to remove targetsuoldu!Target Group {0} would be changedunewu!Target Group {0} has been changeduCould not find target group {0}N(RRRRR RR!R"RRRR#(RR$RRR	R
RRR%R&R'R(R)RR*((s:/usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pyttargets_deregistereds`"
	
!


	





	(t__doc__t
__future__RRRtloggingRtsalt.extRt	getLoggert__name__tlogRRRRR+R,(((s:/usr/lib/python2.7/site-packages/salt/states/boto_elbv2.pyt<module>#s 	
Z0	P	

Zerion Mini Shell 1.0