Skip to content

Commit

Permalink
Delete v2 methods:
Browse files Browse the repository at this point in the history
ClientFactory.ApiVipRequest.get_by_pk
ClientFactory.ApiVipRequest.save
ClientFactory.ApiVipRequest.add_pools
ClientFactory.ApiVipRequest.delete_vip
  • Loading branch information
Marcus Vinicius G. Cesario committed Jan 30, 2018
1 parent cb19f7f commit 986e3cd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 175 deletions.
174 changes: 0 additions & 174 deletions networkapiclient/ApiVipRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,6 @@ def __init__(self, networkapi_url, user, password, user_ldap=None, log_level='IN
log_level
)

def add_pools(self, vip_request_id, pool_ids):
"""
"""

uri = 'api/vip/request/add/pools/'

data = dict()

data['vip_request_id'] = vip_request_id
data['pool_ids'] = pool_ids

return super(ApiVipRequest, self).post(uri, data=data)

def delete_vip(self, ids, delete_pools=True):
"""
"""

uri = 'api/vip/request/delete/%s/' % (delete_pools)

data = dict()

data['ids'] = ids

return super(ApiVipRequest, self).post(uri, data=data)

def list_environment_by_environmet_vip(self, environment_vip_id):
"""
"""
Expand All @@ -70,155 +45,6 @@ def list_environment_by_environmet_vip(self, environment_vip_id):

return super(ApiVipRequest, self).get(uri)

def save(self, id_ipv4, id_ipv6, finality, client, environment, cache, persistence, timeout,
host, areanegocio, nome_servico, l7_filter, vip_ports_to_pools=None, rule_id=None,
pk=None, trafficreturn=None):
"""
Save/Update Request Vip.
:param id_ipv4: int
:param id_ipv6: int
:param finality: str
:param client: str
:param environment: str
:param cache: str
:param persistence: str
:param timeout: str
:param host: str
:param areanegocio: str
:param nome_servico: str
:param l7_filter: str
:param vip_ports_to_pools: list of dict
:param rule_id: int
:param pk: int identifier Id Vip Request.
:return Following dictionary:
{
'id': <id>,
'ip': <id_ip>,
'ipv6': <id_ipv6>,
'l7_filter': <l7_filter>,
'filter_applied': <filter_applied>,
'filter_rollback': <filter_rollback>,
'filter_valid': <filter_valid>,
'applied_l7_datetime': <applied_l7_datetime>,
'healthcheck_expect': <healthcheck_expect>,
'rule': <rule>,
'rule_applied': <rule_applied>,
'rule_rollback': <rule_rollback>,
'areanegocio': '<areanegocio>',
'nome_servico': '<nome_servico>',
'host': <host>,
'vip_ports_to_pools': [{
'id': <id>,
'requisicao_vip': <requisicao_vip>,
'server_pool': <server_pool>,
'port_vip': <port_vip>
},...],
'finalidade': <finalidade>,
'cliente': <cliente>,
'ambiente': <ambiente>
}
:raise EnvironmentVipDoesNotExistException: Environment Vip Does Not Exists
:raise InvalidIdVipRequestException: Invalid Id For Vip Request.
:raise VipRequestDoesNotExistException: Vip Request Does Not Exists.
:raise NetworkAPIException: Fail to Access Data Base.
"""

data = dict()

data['ip'] = id_ipv4
data['ipv6'] = id_ipv6
data['finalidade'] = finality
data['cliente'] = client
data['ambiente'] = environment
data['cache'] = cache
data['timeout'] = timeout
data['persistencia'] = persistence
data['timeout'] = timeout
data['host'] = host
data['areanegocio'] = areanegocio
data['nome_servico'] = nome_servico
data['l7_filter'] = l7_filter
data['rule'] = rule_id
data['vip_ports_to_pools'] = vip_ports_to_pools
data['trafficreturn'] = trafficreturn

uri = 'api/vip/request/save/'

if pk:
uri += '%s/' % pk
return self.put(uri, data=data)

return super(ApiVipRequest, self).post(uri, data=data)

def get_by_pk(self, pk):
"""
Get Request Vip by Identifier.
:param pk: int identifier Vip Request.
:return: Following dictionary:
{
'persistencia': <persistencia>,
'id': <id>,
'cache': <cache>,
'ambiente':<ambiente>,
'cliente': <cliente>,
'areanegocio': '<areanegocio>'
'vip_criado': <vip_criado>,
'id_ip': <id_ip>,
'id_healthcheck_expect': <id_healthcheck_expect>,
'reals_weights':{'reals_weight': [<reals_weight>,...]},
'host': <host>,
'l7_filter': <l7_filter>,
'validado': <validado>,
'reals_prioritys':{'reals_priority':[<reals_priority>,...]},
'finalidade': <finalidade>,
'rule_id': <rule_id>,
'id_ipv6': <id_ipv6>,
'nome_servico': '<nome_servico>',
'timeout': <timeout>,
'pools':[{
'lb_method': <lb_method>,
'healthcheck': <healthcheck>,
'pool_created': <pool_created>,
'id': <id>,
'environment': <environment>,
'port_vip_id': <port_vip_id>,
'port_vip': <port_vip>,
'default_port': <default_port>,
'default_limit': <default_limit>,
'identifier': <identifier>,
'server_pool_members':[{
'status': <status>,
'port_real': <port_real>,
'weight': <weight>,
'ip':{'ip_formated': <ip_formated>},
'ipv6': {'ip_formated': <ip_formated>},
'equipment_name': <equipment_name>,
'id': <id>,
'priority': <priority>,
'limit': <limit>,
'healthcheck': {
'healthcheck_type': <healthcheck_type>
},
'identifier': '<identifier>',
'server_pool': <server_pool>
},...],
},...],
}
:raise InvalidIdVipRequestException: Invalid Id For Vip Request.
:raise VipRequestDoesNotExistException: Vip Request Does Not Exists.
:raise NetworkAPIException: Fail to Access Data Base.
"""
uri = 'api/vip/request/get/%s/' % pk

return super(ApiVipRequest, self).get(uri)

#######################
# API V3
#######################
Expand Down
2 changes: 1 addition & 1 deletion networkapiclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

MAJOR_VERSION = '0'
MINOR_VERSION = '8'
PATCH_VERSION = '0'
PATCH_VERSION = '1'
VERSION = '.'.join((MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION,))
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests==2.12.4
twine

0 comments on commit 986e3cd

Please sign in to comment.