From 29dd9f834fde68f3143d3fdb979612eae58dd59c Mon Sep 17 00:00:00 2001 From: "Marcus Vinicius G. Cesario" Date: Tue, 19 May 2015 17:21:18 -0300 Subject: [PATCH] Adding alter vip persistence method --- networkapiclient/Vip.py | 39 ++++++++++++++++++++++++++++++++++++ networkapiclient/__init__.py | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/networkapiclient/Vip.py b/networkapiclient/Vip.py index c5ad008..b467c2f 100755 --- a/networkapiclient/Vip.py +++ b/networkapiclient/Vip.py @@ -1384,6 +1384,45 @@ def alter_healthcheck( return self.response(code, xml) + def alter_persistence( + self, + id_vip, + persistence): + """Change VIP's persistence config by the identifier. + + :param id_vip: Identifier of the request VIP. + :param persistence: persistence. + + :return: Dictionary with the following structure: + + :: + + {‘sucesso’: {‘codigo’: < codigo >, + ‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}} + + :raise VipNaoExisteError: Request VIP not registered. + :raise InvalidParameterError: Identifier of the request is invalid or null VIP. + :raise DataBaseError: Networkapi failed to access the database. + :raise XMLError: Networkapi failed to generate the XML response. + :raise EnvironmentVipError: The combination of finality, client and environment is invalid. + :raise InvalidPersistenceValueError: The value of persistence is invalid. + :raise IpEquipmentError: Association between equipment and ip of this Vip Request doesn't exist. + :raise IpError: IP not registered. + """ + + if not is_valid_int_param(id_vip): + raise InvalidParameterError( + u'The identifier of vip is invalid or was not informed.') + + url = 'vip/' + str(id_vip) + '/persistence/' + + vip_map = dict() + vip_map['persistencia'] = persistence + + code, xml = self.submit({'vip': vip_map}, 'PUT', url) + + return self.response(code, xml) + def alter_priority(self, id_vip, reals_prioritys): """Change list the reals_priority to VIP from by the identifier. diff --git a/networkapiclient/__init__.py b/networkapiclient/__init__.py index 1b31074..2a9a06a 100644 --- a/networkapiclient/__init__.py +++ b/networkapiclient/__init__.py @@ -16,6 +16,6 @@ MAJOR_VERSION = '0' MINOR_VERSION = '4' -PATCH_VERSION = '0' +PATCH_VERSION = '1' VERSION = '.'.join((MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION,))