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_virtual_server.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZm
Z
mZmZmZmZmZdd
lmZddlmZddddgZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: a10_virtual_server
version_added: 1.8
short_description: Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' virtual servers.
description:
    - Manage SLB (Server Load Balancing) virtual server objects on A10 Networks devices via aXAPIv2.
author:
  - Eric Chou (@ericchou1)
  - Mischa Peters (@mischapeters)
notes:
    - Requires A10 Networks aXAPI 2.1.
extends_documentation_fragment:
  - a10
  - url
options:
  state:
    description:
      - If the specified virtual server should exist.
    choices: ['present', 'absent']
    default: present
  partition:
    version_added: "2.3"
    description:
      - set active-partition
  virtual_server:
    description:
      - The SLB (Server Load Balancing) virtual server name.
    required: true
    aliases: ['vip', 'virtual']
  virtual_server_ip:
    description:
      - The SLB virtual server IPv4 address.
    aliases: ['ip', 'address']
  virtual_server_status:
    description:
      - The SLB virtual server status, such as enabled or disabled.
    default: enable
    aliases: ['status']
    choices: ['enabled', 'disabled']
  virtual_server_ports:
    description:
      - A list of ports to create for the virtual server. Each list item should be a
        dictionary which specifies the C(port:) and C(type:), but can also optionally
        specify the C(service_group:) as well as the C(status:). See the examples
        below for details. This parameter is required when C(state) is C(present).
  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 virtual server
- a10_virtual_server:
    host: a10.mydomain.com
    username: myadmin
    password: mypassword
    partition: mypartition
    virtual_server: vserver1
    virtual_server_ip: 1.1.1.1
    virtual_server_ports:
      - port: 80
        protocol: TCP
        service_group: sg-80-tcp
      - port: 443
        protocol: HTTPS
        service_group: sg-443-https
      - port: 8080
        protocol: http
        status: disabled

s�
content:
  description: the full info regarding the slb_virtual
  returned: success
  type: str
  sample: "mynewvirtualserver"
N(t
axapi_callta10_argument_spectaxapi_authenticatet
axapi_failuretaxapi_enabled_disabledtaxapi_get_vport_protocoltAXAPI_VPORT_PROTOCOLS(t
AnsibleModule(turl_argument_spectporttprotocolt
service_groupcC`sex^|D]V}x@|D]8}|tkr|jdd|djt�f�qqWd|kr�yt|d�|d<Wq�tk
r�|jdd�q�Xn|jdd�d|kr�t|d�}|s�|jdddjt��q||d<n|jdd	djt��d
|kr:t|d
�|d
<n
d|d
<d|krd
|d<qqWdS(Ntmsgs+invalid port field (%s), must be one of: %st,Rs!port definitions must be integerss+port definitions must define the port fieldRs)invalid port protocol, must be one of: %ss3port definitions must define the port protocol (%s)RiRt(tVALID_PORT_FIELDSt	fail_jsontjointintt	ExceptionR
RR(tmoduletportstitemtkeyR((sR/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_virtual_server.pytvalidate_portsrs*

*
 

cC`st�}|jt��|jtdtdddddddg�dtddd	d
dgdt�d
tddd	ddgdt�dtddddd	dgdddg�dtdddt�dtdddg���td|dt�}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd
}	|jd}
|jd}|dkr�|j	dd�nt
||�d|}t||||�}
t||
d t
ji|d!6��t||
d"t
ji|d!6��}t|�}t}|dkr9ii|d!6|	d6t|
�d6|d#6d6}g}x�|D]�}d$|krg|d$|krg|d$d%kr�qgnt||
d&t
ji|d$d!6��}t|�r�|j	dd'|d$�n|j|d$�qgqgW|set||
d(t
j|��}t|�r\|j	dd)|d*d+d�nt}n�d,�}|jdi�jd#g�}|||�s�|||�rt||
d-t
j|��}t|�r�|j	dd)|d*d+d�nt}n|r0t||
d"t
ji|d!6��}q�|}nS|dkr�|rzt||
d.t
ji|d!6��}t}q�tdd/�}n|r�|r�t||
d0�}t|�r�|j	dd1|d*d+d�q�nt||
d2�|jd3|d4|�dS(5Ntstatettypetstrtdefaulttpresenttchoicestabsenttvirtual_servertaliasestviptvirtualtrequiredtvirtual_server_iptiptaddresstvirtual_server_statustenabledRtdisabledtvirtual_server_portstlistt	partitiont
argument_spectsupports_check_modethosttusernametpasswordtwrite_configRsvirtual_server is requireds*https://%s/services/rest/V2.1/?format=jsons&method=system.partition.activetnames!&method=slb.virtual_server.searcht
vport_listRRs &method=slb.service_group.searchs?the service group %s specified in the ports list does not exists!&method=slb.virtual_server.creates'failed to create the virtual server: %stresponseterrcS`s�x�|D]�}t}t}xj|D]b}|d|dkr t}x,tD]$}||||krGt}PqGqGW|s{|r�Pq�q q W|s�|rtSqWtS(s�
                Checks to determine if the port definitions of the src_ports
                array are in or different from those in dst_ports. If there is
                a difference, this function returns true, otherwise false.
                R(tFalsetTrueR(t	src_portst	dst_portstsrc_porttfoundt	differenttdst_porttvalid_field((sR/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_virtual_server.pytneeds_update�s



s!&method=slb.virtual_server.updates!&method=slb.virtual_server.deletes"the virtual server was not presents"&method=system.action.write_memorys$failed to save the configuration: %ss&method=session.closetchangedtcontent(R	tupdateRtdictRARR@tparamstNoneRR R
RtjsontdumpsRRtappendtgett	exit_json(R6RR8R9R:R5R!R;tslb_virtualtslb_virtual_iptslb_virtual_statustslb_virtual_portstaxapi_base_urltsession_urltslb_virtual_datatslb_virtual_existsRJt	json_posttchecked_service_groupsRtresultRIt
defined_portstwrite_result((sR/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_virtual_server.pytmain�s�	!!!*	











$&


*#		#	)	&	&t__main__(t
__future__RRRR"t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRPt$ansible.module_utils.network.a10.a10RR	R
RRR
Rtansible.module_utils.basicRtansible.module_utils.urlsRRR Rbt__name__(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_virtual_server.pyt<module>	s 


84	%	�

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