%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z e j e � Z d � Z d � Z d d � Z d d d � Z d � Z d � Z d � Z d S( 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 ( t absolute_importt unicode_literalst print_functionNc C@ s t S( N( t True( ( ( sE /usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt __virtual__; s c C@ s t j j j t � d S( N( t saltt utilst compatt pack_dundert __name__( t opts( ( sE /usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt __init__? s c C@ s5 | d k r i } n i | d 6| d 6| d 6| d 6S( Nu resultu commentu nameu changes( t None( t resultt messaget namet changes( ( sE /usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt state_resultC s c K@ s� t d | � } g | D] } | d | k r | ^ q } t | � d k r[ t t d | � Sd } | d k r� g } x4 | D]) } | j i | d d 6| d d 6� qz Wn t d | | | | d | d | | �} t t d | | � Sd S( 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_balancersu namei u Balancer already existsu ipu portu% libcloud_loadbalancer.create_balancert algorithmt membersu Created new load balancerN( t __salt__t lenR R R t append( R t portt protocolt profileR R t libcloud_kwargst balancerst zt matcht starting_memberst mt balancer( ( sE /usr/lib/python2.7/site-packages/salt/states/libcloud_loadbalancer.pyt balancer_presentL s ) * c K@ s� t d | � } g | D] } | d | k r | ^ q } t | � d k r[ t t d | � St d | d d | | � } t | d | � Sd S( 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_balancersu namei u Balancer already absentu&