本文整理汇总了Python中networkapiclient.utils.is_valid_int_param函数的典型用法代码示例。如果您正苦于以下问题:Python is_valid_int_param函数的具体用法?Python is_valid_int_param怎么用?Python is_valid_int_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_valid_int_param函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: inserir
def inserir(self, id_user, id_group):
"""Create a relationship between User and Group.
:param id_user: Identifier of the User. Integer value and greater than zero.
:param id_group: Identifier of the Group. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'user_group': {'id': < id_user_group >}}
:raise InvalidParameterError: The identifier of User or Group is null and invalid.
:raise GrupoUsuarioNaoExisteError: UserGroup not registered.
:raise UsuarioNaoExisteError: User not registered.
:raise UsuarioGrupoError: User already registered in the group.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_user):
raise InvalidParameterError(
u'The identifier of User is invalid or was not informed.')
if not is_valid_int_param(id_group):
raise InvalidParameterError(
u'The identifier of Group is invalid or was not informed.')
url = 'usergroup/user/' + \
str(id_user) + '/ugroup/' + str(id_group) + '/associate/'
code, xml = self.submit(None, 'PUT', url)
示例2: remover
def remover(self, id_tipo_acesso, id_equipamento):
"""Removes relationship between equipment and access type.
:param id_equipamento: Equipment identifier.
:param id_tipo_acesso: Access type identifier.
:return: None
:raise EquipamentoNaoExisteError: Equipment doesn't exist.
:raise EquipamentoAcessoNaoExisteError: Relationship between equipment and access type doesn't exist.
:raise InvalidParameterError: Equipment and/or access type id is/are invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_tipo_acesso):
raise InvalidParameterError(u'Access type id is invalid.')
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(u'Equipment id is invalid.')
url = 'equipamentoacesso/' + \
str(id_equipamento) + '/' + str(id_tipo_acesso) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml)
示例3: disassociate
def disassociate(self, id_option_vip, id_environment_vip):
"""Remove a relationship of OptionVip with EnvironmentVip.
:param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero.
:param id_environment_vip: Identifier of the Environment VIP. Integer value and greater than zero.
:return: Nothing
:raise InvalidParameterError: Option VIP/Environment VIP identifier is null and/or invalid.
:raise OptionVipNotFoundError: Option VIP not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise OptionVipError: Option vip is not associated with the environment vip
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(u"The identifier of Option VIP is invalid or was not informed.")
if not is_valid_int_param(id_environment_vip):
raise InvalidParameterError(u"The identifier of Environment VIP is invalid or was not informed.")
url = "optionvip/" + str(id_option_vip) + "/environmentvip/" + str(id_environment_vip) + "/"
code, xml = self.submit(None, "DELETE", url)
return self.response(code, xml)
示例4: remover
def remover(self, id_equipment, id_script):
"""Remove Related Equipment with Script from by the identifier.
:param id_equipment: Identifier of the Equipment. Integer value and greater than zero.
:param id_script: Identifier of the Script. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Equipment or Script is null and invalid.
:raise RoteiroNaoExisteError: Script not registered.
:raise EquipamentoNaoExisteError: Equipment not registered.
:raise EquipamentoRoteiroNaoExisteError: Equipment is not associated with the script.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response
"""
if not is_valid_int_param(id_equipment):
raise InvalidParameterError(
u'The identifier of Equipment is invalid or was not informed.')
if not is_valid_int_param(id_script):
raise InvalidParameterError(
u'The identifier of Script is invalid or was not informed.')
url = 'equipmentscript/' + \
str(id_equipment) + '/' + str(id_script) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml)
示例5: associate
def associate(self, id_option_vip, id_environment_vip):
"""Create a relationship of OptionVip with EnvironmentVip.
:param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero.
:param id_environment_vip: Identifier of the Environment VIP. Integer value and greater than zero.
:return: Following dictionary
::
{'opcoesvip_ambiente_xref': {'id': < id_opcoesvip_ambiente_xref >} }
:raise InvalidParameterError: Option VIP/Environment VIP identifier is null and/or invalid.
:raise OptionVipNotFoundError: Option VIP not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise OptionVipError: Option vip is already associated with the environment vip.
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(
u'The identifier of Option VIP is invalid or was not informed.')
if not is_valid_int_param(id_environment_vip):
raise InvalidParameterError(
u'The identifier of Environment VIP is invalid or was not informed.')
url = 'optionvip/' + \
str(id_option_vip) + '/environmentvip/' + str(id_environment_vip) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml)
示例6: remove
def remove(self, id_equipamento, id_egrupo):
"""Remove a associacao de um grupo de equipamento com um equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param id_equipamento: Identificador do equipamento.
:return: None
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
url = 'egrupo/equipamento/' + \
str(id_equipamento) + '/egrupo/' + str(id_egrupo) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml)
示例7: dissociate
def dissociate(self, id_filter, id_eq_type):
"""Removes relationship between Filter and TipoEquipamento.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:param id_eq_type: Identifier of TipoEquipamento. Integer value, greater than zero.
:return: None
:raise FilterNotFoundError: Filter not registered.
:raise TipoEquipamentoNotFoundError: TipoEquipamento not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
if not is_valid_int_param(id_eq_type):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
url = 'filter/' + \
str(id_filter) + '/dissociate/' + str(id_eq_type) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml)
示例8: associate
def associate(self, et_id, id_filter):
"""Create a relationship between Filter and TipoEquipamento.
:param et_id: Identifier of TipoEquipamento. Integer value and greater than zero.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{'equiptype_filter_xref': {'id': < id_equiptype_filter_xref >} }
:raise InvalidParameterError: TipoEquipamento/Filter identifier is null and/or invalid.
:raise TipoEquipamentoNaoExisteError: TipoEquipamento not registered.
:raise FilterNotFoundError: Filter not registered.
:raise FilterEqTypeAssociationError: TipoEquipamento and Filter already associated.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(et_id):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
url = 'filter/' + str(id_filter) + '/equiptype/' + str(et_id) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml)
示例9: remover
def remover(self, id_user, id_group):
"""Removes relationship between User and Group.
:param id_user: Identifier of the User. Integer value and greater than zero.
:param id_group: Identifier of the Group. Integer value and greater than zero.
:return: None
:raise UsuarioGrupoNaoExisteError: Association between user and group not registered.
:raise GrupoUsuarioNaoExisteError: UserGroup not registered.
:raise UsuarioNaoExisteError: User not registered.
:raise UsuarioGrupoError: User already registered in the group.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_user):
raise InvalidParameterError(
u'The identifier of User is invalid or was not informed.')
if not is_valid_int_param(id_group):
raise InvalidParameterError(
u'The identifier of Group is invalid or was not informed.')
url = 'usergroup/user/' + \
str(id_user) + '/ugroup/' + str(id_group) + '/dissociate/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml)
示例10: associar_ip
def associar_ip(self, id_equipamento, id_ip):
"""Associa um IP a um equipamento.
:param id_equipamento: Identificador do equipamento.
:param id_ip: Identificador do IP.
:return: Dicionário com a seguinte estrutura:
{'ip_equipamento': {'id': < id_ip_do_equipamento >}}
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise IpNaoExisteError: IP não cadastrado.
:raise IpError: IP já está associado ao equipamento.
:raise InvalidParameterError: O identificador do equipamento e/ou do IP são nulos ou inválidos.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
if not is_valid_int_param(id_ip):
raise InvalidParameterError(
u'O identificador do ip é inválido ou não foi informado.')
url = 'ip/' + str(id_ip) + '/equipamento/' + str(id_equipamento) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml)
示例11: remover
def remover(self, id_equipment, id_environment):
"""Remove Related Equipment with Environment from by the identifier.
:param id_equipment: Identifier of the Equipment. Integer value and greater than zero.
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Environment, Equipament is null and invalid.
:raise EquipamentoNotFoundError: Equipment not registered.
:raise EquipamentoAmbienteNaoExisteError: Environment not registered.
:raise VipIpError: IP-related equipment is being used for a request VIP.
:raise XMLError: Networkapi failed to generate the XML response.
:raise DataBaseError: Networkapi failed to access the database.
"""
if not is_valid_int_param(id_equipment):
raise InvalidParameterError(u"The identifier of Equipment is invalid or was not informed.")
if not is_valid_int_param(id_environment):
raise InvalidParameterError(u"The identifier of Environment is invalid or was not informed.")
url = "equipment/" + str(id_equipment) + "/environment/" + str(id_environment) + "/"
code, xml = self.submit(None, "DELETE", url)
return self.response(code, xml)
示例12: associate_ipv6
def associate_ipv6(self, id_equip, id_ipv6):
"""Associates an IPv6 to a equipament.
:param id_equip: Identifier of the equipment. Integer value and greater than zero.
:param id_ipv6: Identifier of the ip. Integer value and greater than zero.
:return: Dictionary with the following structure:
{'ip_equipamento': {'id': < id_ip_do_equipamento >}}
:raise EquipamentoNaoExisteError: Equipment is not registered.
:raise IpNaoExisteError: IP not registered.
:raise IpError: IP is already associated with the equipment.
:raise InvalidParameterError: Identifier of the equipment and/or IP is null or invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_equip):
raise InvalidParameterError(
u'The identifier of equipment is invalid or was not informed.')
if not is_valid_int_param(id_ipv6):
raise InvalidParameterError(
u'The identifier of ip is invalid or was not informed.')
url = 'ipv6/' + str(id_ipv6) + '/equipment/' + str(id_equip) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml)
示例13: disassociate_environment_option_pool
def disassociate_environment_option_pool(self, environment_option_id):
"""Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: { 'id': < environment_option_id> }
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Environment Pool is invalid or was not informed.')
url = 'api/pools/environment_options/' + str(environment_option_id) + '/'
return self.delete(url)
示例14: remove_ipv6
def remove_ipv6(self, id_equip, id_ipv6):
"""Remove an IPv6 to a equipament.
:param id_equip: Identifier of the equipment. Integer value and greater than zero.
:param id_ipv6: Identifier of the ip. Integer value and greater than zero.
:return: None
:raise EquipamentoNaoExisteError: Equipment is not registered.
:raise IpNaoExisteError: IP not registered.
:raise IpError: Dont IP is already associated with the equipment.
:raise InvalidParameterError: Identifier of the equipment and/or IP is null or invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_equip):
raise InvalidParameterError(
u'The identifier of equipment is invalid or was not informed.')
if not is_valid_int_param(id_ipv6):
raise InvalidParameterError(
u'The identifier of ip is invalid or was not informed.')
url = 'ipv6/' + str(id_ipv6) + '/equipment/' + \
str(id_equip) + '/remove/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml)
示例15: update
def update(self, id_equipment, id_environment, is_router):
"""Remove Related Equipment with Environment from by the identifier.
:param id_equipment: Identifier of the Equipment. Integer value and greater than zero.
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:param is_router: Identifier of the Environment. Boolean value.
:return: None
:raise InvalidParameterError: The identifier of Environment, Equipament is null and invalid.
:raise EquipamentoNotFoundError: Equipment not registered.
:raise EquipamentoAmbienteNaoExisteError: Environment not registered.
:raise VipIpError: IP-related equipment is being used for a request VIP.
:raise XMLError: Networkapi failed to generate the XML response.
:raise DataBaseError: Networkapi failed to access the database.
"""
if not is_valid_int_param(id_equipment):
raise InvalidParameterError(u"The identifier of Equipment is invalid or was not informed.")
if not is_valid_int_param(id_environment):
raise InvalidParameterError(u"The identifier of Environment is invalid or was not informed.")
equipment_environment_map = dict()
equipment_environment_map["id_equipamento"] = id_equipment
equipment_environment_map["id_ambiente"] = id_environment
equipment_environment_map["is_router"] = is_router
code, xml = self.submit(
{"equipamento_ambiente": equipment_environment_map}, "PUT", "equipamentoambiente/update/"
)
return self.response(code, xml)