%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/libcloud_loadbalancer.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZeje	�Z
d�Zd�Zdd�Zddd�Zd�Zd	�Zd
�ZdS(u�
Apache Libcloud Load Balancer State
===================================

Manage load balancers using libcloud

    :codeauthor: ``Anthony Shaw <anthonyshaw@apache.org>``

Apache Libcloud load balancer management for a full list
of supported clouds, see http://libcloud.readthedocs.io/en/latest/loadbalancer/supported_providers.html

Clouds include Amazon ELB, ALB, Google, Aliyun, CloudStack, Softlayer

.. versionadded:: 2018.3.0

:configuration:
    This module uses a configuration profile for one or multiple Cloud providers

    .. code-block:: yaml

        libcloud_loadbalancer:
            profile_test1:
              driver: gce
              key: GOOG0123456789ABCXYZ
              secret: mysecret
            profile_test2:
              driver: alb
              key: 12345
              secret: mysecret

Example:

Using States to deploy a load balancer with extended arguments to specify region

.. code-block:: yaml

    lb_test:
        libcloud_loadbalancer.balancer_present:
            - name: example
            - port: 80
            - protocol: http
            - profile: google
            - ex_region: us-east1

:depends: apache-libcloud
i(tabsolute_importtunicode_literalstprint_functionNcC@stS(N(tTrue(((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt__virtual__;scC@stjjjt�dS(N(tsalttutilstcompattpack_dundert__name__(topts((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt__init__?scC@s5|dkri}ni|d6|d6|d6|d6S(Nuresultucommentunameuchanges(tNone(tresulttmessagetnametchanges((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pytstate_resultCs	
c

K@s�td|�}g|D]}|d|kr|^q}	t|	�dkr[ttd|�Sd}
|dk	r�g}
x4|D])}|
ji|dd6|dd6�qzWntd||||d|d	|
|�}ttd
||�SdS(u�
    Ensures a load balancer is present.

    :param name: Load Balancer name
    :type  name: ``str``

    :param port: Port the load balancer should listen on, defaults to 80
    :type  port: ``str``

    :param protocol: Loadbalancer protocol, defaults to http.
    :type  protocol: ``str``

    :param profile: The profile key
    :type  profile: ``str``

    :param algorithm: Load balancing algorithm, defaults to ROUND_ROBIN. See Algorithm type
        in Libcloud documentation for a full listing.
    :type algorithm: ``str``

    :param members: An optional list of members to create on deployment
    :type  members: ``list`` of ``dict`` (ip, port)
    u$libcloud_loadbalancer.list_balancersunameiuBalancer already existsuipuportu%libcloud_loadbalancer.create_balancert	algorithmtmembersuCreated new load balancerN(t__salt__tlenRRRtappend(
RtporttprotocoltprofileRRtlibcloud_kwargst	balancerstztmatchtstarting_memberstmtbalancer((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pytbalancer_presentLs)
*		cK@s�td|�}g|D]}|d|kr|^q}t|�dkr[ttd|�Std|dd||�}t|d|�SdS(	u�
    Ensures a load balancer is absent.

    :param name: Load Balancer name
    :type  name: ``str``

    :param profile: The profile key
    :type  profile: ``str``
    u$libcloud_loadbalancer.list_balancersunameiuBalancer already absentu&libcloud_loadbalancer.destroy_balanceruiduDeleted load balancerN(RRRR(RRRRRRR
((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pytbalancer_absentus
)cK@s�td||�}x>|D]6}|d|kr|d|krttd|�SqWtd|||||�}ttdj|d�||�S(uk
    Ensure a load balancer member is present

    :param ip: IP address for the new member
    :type  ip: ``str``

    :param port: Port for the new member
    :type  port: ``int``

    :param balancer_id: id of a load balancer you want to attach the member to
    :type  balancer_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``
    u+libcloud_loadbalancer.list_balancer_membersuipuportuMember already presentu,libcloud_loadbalancer.balancer_attach_memberu!Member added to balancer, id: {0}uid(RRRtformat(tipRtbalancer_idRRtexisting_memberstmember((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pytmember_present�s
 cK@s�td||�}x[|D]S}|d|kr|d|krtd||d||�}t|d|�SqWttd|�S(uz
    Ensure a load balancer member is absent, based on IP and Port

    :param ip: IP address for the member
    :type  ip: ``str``

    :param port: Port for the member
    :type  port: ``int``

    :param balancer_id: id of a load balancer you want to detach the member from
    :type  balancer_id: ``str``

    :param profile: The profile key
    :type  profile: ``str``
    u+libcloud_loadbalancer.list_balancer_membersuipuportu,libcloud_loadbalancer.balancer_detach_memberuiduMember removeduMember already absent(RRR(R$RR%RRR&R'R
((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt
member_absent�s
 (t__doc__t
__future__RRRtloggingtsalt.utils.compatRt	getLoggerR	tlogRRRRR!R"R(R)(((sE/usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt<module>/s			)		

Zerion Mini Shell 1.0