Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/a10/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/a10/a10_service_group.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZm
Z
mZmZmZdd
lmZddlmZdddgZdddgZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysP
---
module: a10_service_group
version_added: 1.8
short_description: Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' service groups.
description:
    - Manage SLB (Server Load Balancing) service-group objects on A10 Networks devices via aXAPIv2.
author:
  - Eric Chou (@ericchou1)
  - Mischa Peters (@mischapeters)
notes:
    - Requires A10 Networks aXAPI 2.1.
    - When a server doesn't exist and is added to the service-group the server will be created.
extends_documentation_fragment:
  - a10
  - url
options:
  state:
    description:
      - If the specified service group should exists.
    default: present
    choices: ['present', 'absent']
  partition:
    version_added: "2.3"
    description:
      - set active-partition
  service_group:
    description:
      - The SLB (Server Load Balancing) service-group name
    required: true
    aliases: ['service', 'pool', 'group']
  service_group_protocol:
    description:
      - The SLB service-group protocol of TCP or UDP.
    default: tcp
    aliases: ['proto', 'protocol']
    choices: ['tcp', 'udp']
  service_group_method:
    description:
      - The SLB service-group load balancing method, such as round-robin or weighted-rr.
    default: round-robin
    aliases: ['method']
    choices:
        - 'round-robin'
        - 'weighted-rr'
        - 'least-connection'
        - 'weighted-least-connection'
        - 'service-least-connection'
        - 'service-weighted-least-connection'
        - 'fastest-response'
        - 'least-request'
        - 'round-robin-strict'
        - 'src-ip-only-hash'
        - 'src-ip-hash'
  servers:
    description:
      - A list of servers to add to the service group. Each list item should be a
        dictionary which specifies the C(server:) and C(port:), but can also optionally
        specify the C(status:). See the examples below for details.
    aliases: ['server', 'member']
  validate_certs:
    description:
      - If C(no), SSL certificates will not be validated. This should only be used
        on personally controlled devices using self-signed certificates.
    type: bool
    default: 'yes'

s�
# Create a new service-group
- a10_service_group:
    host: a10.mydomain.com
    username: myadmin
    password: mypassword
    partition: mypartition
    service_group: sg-80-tcp
    servers:
      - server: foo1.mydomain.com
        port: 8080
      - server: foo2.mydomain.com
        port: 8080
      - server: foo3.mydomain.com
        port: 8080
      - server: foo4.mydomain.com
        port: 8080
        status: disabled

s�
content:
  description: the full info regarding the slb_service_group
  returned: success
  type: str
  sample: "mynewservicegroup"
N(t
axapi_callta10_argument_spectaxapi_authenticatet
axapi_failuretaxapi_enabled_disabled(t
AnsibleModule(turl_argument_spectnametprotocolt	lb_methodtservertportcC`s�x�|D]�}x@|D]8}|tkr|jdd|djt�f�qqWd|kro|jdd�nd|kr�yt|d�|d<Wq�tk
r�|jdd�q�Xn|jdd�d	|kr�t|d	�|d	<qd
|d	<qWdS(Ntmsgs-invalid server field (%s), must be one of: %st,Rs/server definitions must define the server fieldRs(server port definitions must be integerss-server definitions must define the port fieldRi(tVALID_SERVER_FIELDSt	fail_jsontjointintt	ExceptionR(tmoduletserverstitemtkey((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_service_group.pytvalidate_servers~s

*
c!C`st�}|jt��|jtdtdddddddg�dtddd	d
ddgd
t�dtddddd	ddgdddg�dtddddd	dgddddddddddddg�d tdd!d	d"d#gdg�d$tdddg���td%|d&t�}|jd'}|jd(}|jd)}|jd$}|jd}|jd*}|jd}|jd}	|jd}
|jd }|dkr�|j	d+d,�nd-|d.}id/d6d0d6d1d6d2d6d3d6d4d6d5d6d6d6d7d6d8d6d9d6}
|	sF|	j
�dkrOd1}nd2}t||�ii|d:6|d6|
|
d;6d6}t||||�}t
||d<tji|d:6��t
||d=tji|d:6��}t|�}t}|dkrFg}xp|D]h}t
||d>tji|d"d:6��}t|�rj|j	d+d?|d"�n|j|d"�qW|s�t
||d@tj|��}t|�r�|j	d+|dAdBd+�nt}n�t}x4tD],}|d||d|kr�t}Pq�q�W|rnt
||dCtj|��}t|�re|j	d+|dAdBd+�nt}n|jdi�jdDg�}x�|D]�}t}t}xj|D]b}|d"|d"kr�t}x,tD]$}||||kr�t}Pq�q�W|s|rPqq�q�Wi|d:6|d#6}|sTt
||dEtj|��}t}q�|r�t
||dFtj|��}t}q�q�Wx�|D]}}t}x,|D]$}|d"|d"kr�t}Pq�q�Wi|d:6|d#6}|s�t
||dGtj|��}t}q�q�W|r=t
||d=tji|d:6��}q�|}nS|dkr�|r�t
||dHtji|d:6��}t}q�td+dI�}n|r�|r�t
||dJ�} t| �r�|j	d+dK| dAdBd+�q�nt
||dL�|jdM|dN|�dS(ONtstatettypetstrtdefaulttpresenttchoicestabsentt
service_grouptaliasestservicetpooltgrouptrequiredtservice_group_protocolttcptprotoRtudptservice_group_methodsround-robintmethodsweighted-rrsleast-connectionsweighted-least-connectionsservice-least-connections!service-weighted-least-connectionsfastest-responses
least-requestsround-robin-strictssrc-ip-only-hashssrc-ip-hashRtlistRtmembert	partitiont
argument_spectsupports_check_modethosttusernametpasswordtwrite_configRsservice_group is requiredshttps://s /services/rest/V2.1/?format=jsoniiiiiiiiiiiRRs&method=system.partition.actives &method=slb.service_group.searchs&method=slb.server.searchs:the server %s specified in the servers list does not exists &method=slb.service_group.createtresponseterrs &method=slb.service_group.updatetmember_lists'&method=slb.service_group.member.creates'&method=slb.service_group.member.updates'&method=slb.service_group.member.deletes &method=slb.service_group.deletes!the service group was not presents"&method=system.action.write_memorys$failed to save the configuration: %ss&method=session.closetchangedtcontent(R	tupdateRtdicttTrueR
tFalsetparamstNoneRtlowerRR
RtjsontdumpsRtappendtVALID_SERVICE_GROUP_FIELDStgetRt	exit_json(!R6RR8R9R:R5R R;tslb_service_grouptslb_service_group_prototslb_service_group_methodtslb_serverstaxapi_base_urltload_balancing_methodsRt	json_posttsession_urlt
slb_resulttslb_service_group_existR?tchecked_serversRtresultt	do_updatetfieldtdefined_serverstfoundt	differentt
def_servertvalid_fieldtserver_datat
slb_servertwrite_result((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_service_group.pytmain�s
	!$-	!	











	
$&

*	
	



	




)	&	&t__main__(t
__future__RRRR!t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRHt$ansible.module_utils.network.a10.a10RR	R
RRtansible.module_utils.basicR
tansible.module_utils.urlsRRKRRRdt__name__(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_service_group.pyt<module>	s"


F(		�

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]