# salt.modules.libcloud_loadbalancer

## Apache Libcloud Load Balancer Management

Connection module for Apache Libcloud Storage 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

Added in version 2018.3.0.

configuration:

  This module uses a configuration profile for one or multiple Storage providers

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

depends:

  apache-libcloud

salt.modules.libcloud_loadbalancer.balancer_attach_member(balancer_id, ip, port, profile, extra=None, **libcloud_kwargs)

  Add a new member to the load balancer

  Parameters:

    - balancer_id (`str`) -- id of a load balancer you want to fetch

    - ip (`str`) -- IP address for the new member

    - port (`int`) -- Port for the new member

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's balancer_attach_member method

  CLI Example:

      salt myminion libcloud_storage.balancer_attach_member balancer123 1.2.3.4 80 profile1

salt.modules.libcloud_loadbalancer.balancer_detach_member(balancer_id, member_id, profile, **libcloud_kwargs)

  Add a new member to the load balancer

  Parameters:

    - balancer_id (`str`) -- id of a load balancer you want to fetch

    - ip (`str`) -- IP address for the new member

    - port (`int`) -- Port for the new member

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's balancer_detach_member method

  CLI Example:

      salt myminion libcloud_storage.balancer_detach_member balancer123 member123 profile1

salt.modules.libcloud_loadbalancer.create_balancer(name, port, protocol, profile, algorithm=None, members=None, **libcloud_kwargs)

  Create a new load balancer instance

  Parameters:

    - name (`str`) -- Name of the new load balancer (required)

    - port (`str`) -- Port the load balancer should listen on, defaults to 80

    - protocol (`str`) -- Loadbalancer protocol, defaults to http.

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

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's create_balancer method

  Returns:

    The details of the new balancer

  CLI Example:

      salt myminion libcloud_storage.create_balancer my_balancer 80 http profile1

salt.modules.libcloud_loadbalancer.destroy_balancer(balancer_id, profile, **libcloud_kwargs)

  Destroy a load balancer

  Parameters:

    - balancer_id (`str`) -- LoadBalancer ID which should be used

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's destroy_balancer method

  Returns:

    `True` if the destroy was successful, otherwise `False`.

  Return type:

    `bool`

  CLI Example:

      salt myminion libcloud_storage.destroy_balancer balancer_1 profile1

salt.modules.libcloud_loadbalancer.extra(method, profile, **libcloud_kwargs)

  Call an extended method on the driver

  Parameters:

    - method (`str`) -- Driver's method name

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's method

  CLI Example:

      salt myminion libcloud_loadbalancer.extra ex_get_permissions google container_name=my_container object_name=me.jpg --out=yaml

salt.modules.libcloud_loadbalancer.get_balancer(balancer_id, profile, **libcloud_kwargs)

  Get the details for a load balancer by ID

  Parameters:

    - balancer_id (`str`) -- id of a load balancer you want to fetch

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's get_balancer method

  Returns:

    the load balancer details

  CLI Example:

      salt myminion libcloud_storage.get_balancer balancer123 profile1

salt.modules.libcloud_loadbalancer.get_balancer_by_name(name, profile, **libcloud_kwargs)

  Get the details for a load balancer by name

  Parameters:

    - name (`str`) -- Name of a load balancer you want to fetch

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's list_balancers method

  Returns:

    the load balancer details

  CLI Example:

      salt myminion libcloud_storage.get_balancer_by_name my_balancer profile1

salt.modules.libcloud_loadbalancer.list_balancer_members(balancer_id, profile, **libcloud_kwargs)

  List the members of a load balancer

  Parameters:

    - balancer_id (`str`) -- id of a load balancer you want to fetch

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's list_balancer_members method

  CLI Example:

      salt myminion libcloud_storage.list_balancer_members balancer123 profile1

salt.modules.libcloud_loadbalancer.list_balancers(profile, **libcloud_kwargs)

  Return a list of load balancers.

  Parameters:

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's list_balancers method

  CLI Example:

      salt myminion libcloud_storage.list_balancers profile1

salt.modules.libcloud_loadbalancer.list_protocols(profile, **libcloud_kwargs)

  Return a list of supported protocols.

  Parameters:

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's list_protocols method

  Returns:

    a list of supported protocols

  Return type:

    `list` of `str`

  CLI Example:

      salt myminion libcloud_storage.list_protocols profile1

salt.modules.libcloud_loadbalancer.list_supported_algorithms(profile, **libcloud_kwargs)

  Get the supported algorithms for a profile

  Parameters:

    - profile (`str`) -- The profile key

    - libcloud_kwargs (`dict`) -- Extra arguments for the driver's list_supported_algorithms method

  Returns:

    The supported algorithms

  CLI Example:

      salt myminion libcloud_storage.list_supported_algorithms profile1