repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
sequencelengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
sequencelengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
globocom/GloboNetworkAPI-client-python
networkapiclient/GenericClient.py
GenericClient.response
def response(self, code, xml, force_list=None): """Cria um dicionário com os dados de retorno da requisição HTTP ou lança uma exceção correspondente ao erro ocorrido. Se a requisição HTTP retornar o código 200 então este método retorna o dicionário com os dados da resposta. Se a requisição HTTP retornar um código diferente de 200 então este método lança uma exceção correspondente ao erro. Todas as exceções lançadas por este método deverão herdar de NetworkAPIClientError. :param code: Código de retorno da requisição HTTP. :param xml: XML ou descrição (corpo) da resposta HTTP. :param force_list: Lista com as tags do XML de resposta que deverão ser transformadas obrigatoriamente em uma lista no dicionário de resposta. :return: Dicionário com os dados da resposta HTTP retornada pela networkAPI. """ if int(code) == 200: # Retorna o map return loads(xml, force_list)['networkapi'] elif int(code) == 500: code, description = self.get_error(xml) return ErrorHandler.handle(code, description) else: return ErrorHandler.handle(code, xml)
python
def response(self, code, xml, force_list=None): """Cria um dicionário com os dados de retorno da requisição HTTP ou lança uma exceção correspondente ao erro ocorrido. Se a requisição HTTP retornar o código 200 então este método retorna o dicionário com os dados da resposta. Se a requisição HTTP retornar um código diferente de 200 então este método lança uma exceção correspondente ao erro. Todas as exceções lançadas por este método deverão herdar de NetworkAPIClientError. :param code: Código de retorno da requisição HTTP. :param xml: XML ou descrição (corpo) da resposta HTTP. :param force_list: Lista com as tags do XML de resposta que deverão ser transformadas obrigatoriamente em uma lista no dicionário de resposta. :return: Dicionário com os dados da resposta HTTP retornada pela networkAPI. """ if int(code) == 200: # Retorna o map return loads(xml, force_list)['networkapi'] elif int(code) == 500: code, description = self.get_error(xml) return ErrorHandler.handle(code, description) else: return ErrorHandler.handle(code, xml)
[ "def", "response", "(", "self", ",", "code", ",", "xml", ",", "force_list", "=", "None", ")", ":", "if", "int", "(", "code", ")", "==", "200", ":", "# Retorna o map", "return", "loads", "(", "xml", ",", "force_list", ")", "[", "'networkapi'", "]", "elif", "int", "(", "code", ")", "==", "500", ":", "code", ",", "description", "=", "self", ".", "get_error", "(", "xml", ")", "return", "ErrorHandler", ".", "handle", "(", "code", ",", "description", ")", "else", ":", "return", "ErrorHandler", ".", "handle", "(", "code", ",", "xml", ")" ]
Cria um dicionário com os dados de retorno da requisição HTTP ou lança uma exceção correspondente ao erro ocorrido. Se a requisição HTTP retornar o código 200 então este método retorna o dicionário com os dados da resposta. Se a requisição HTTP retornar um código diferente de 200 então este método lança uma exceção correspondente ao erro. Todas as exceções lançadas por este método deverão herdar de NetworkAPIClientError. :param code: Código de retorno da requisição HTTP. :param xml: XML ou descrição (corpo) da resposta HTTP. :param force_list: Lista com as tags do XML de resposta que deverão ser transformadas obrigatoriamente em uma lista no dicionário de resposta. :return: Dicionário com os dados da resposta HTTP retornada pela networkAPI.
[ "Cria", "um", "dicionário", "com", "os", "dados", "de", "retorno", "da", "requisição", "HTTP", "ou", "lança", "uma", "exceção", "correspondente", "ao", "erro", "ocorrido", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GenericClient.py#L85-L110
globocom/GloboNetworkAPI-client-python
networkapiclient/Roteiro.py
Roteiro.inserir
def inserir(self, id_script_type, script, model, description): """Inserts a new Script and returns its identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param script: Script name. String with a minimum 3 and maximum of 40 characters :param description: Script description. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'script': {'id': < id_script >}} :raise InvalidParameterError: The identifier of Script Type, script or description is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeRoteiroDuplicadoError: Script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ script_map = dict() script_map['id_script_type'] = id_script_type script_map['script'] = script script_map['model'] = model script_map['description'] = description code, xml = self.submit({'script': script_map}, 'POST', 'script/') return self.response(code, xml)
python
def inserir(self, id_script_type, script, model, description): """Inserts a new Script and returns its identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param script: Script name. String with a minimum 3 and maximum of 40 characters :param description: Script description. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'script': {'id': < id_script >}} :raise InvalidParameterError: The identifier of Script Type, script or description is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeRoteiroDuplicadoError: Script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ script_map = dict() script_map['id_script_type'] = id_script_type script_map['script'] = script script_map['model'] = model script_map['description'] = description code, xml = self.submit({'script': script_map}, 'POST', 'script/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "id_script_type", ",", "script", ",", "model", ",", "description", ")", ":", "script_map", "=", "dict", "(", ")", "script_map", "[", "'id_script_type'", "]", "=", "id_script_type", "script_map", "[", "'script'", "]", "=", "script", "script_map", "[", "'model'", "]", "=", "model", "script_map", "[", "'description'", "]", "=", "description", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'script'", ":", "script_map", "}", ",", "'POST'", ",", "'script/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Inserts a new Script and returns its identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param script: Script name. String with a minimum 3 and maximum of 40 characters :param description: Script description. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'script': {'id': < id_script >}} :raise InvalidParameterError: The identifier of Script Type, script or description is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeRoteiroDuplicadoError: Script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Inserts", "a", "new", "Script", "and", "returns", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Roteiro.py#L58-L85
globocom/GloboNetworkAPI-client-python
networkapiclient/Roteiro.py
Roteiro.alterar
def alterar(self, id_script, id_script_type, script, description, model=None): """Change Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param script: Script name. String with a minimum 3 and maximum of 40 characters :param description: Script description. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Script, script Type, script or description is null and invalid. :raise RoteiroNaoExisteError: Script not registered. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeRoteiroDuplicadoError: Script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_script): raise InvalidParameterError(u'The identifier of Script is invalid or was not informed.') script_map = dict() script_map['id_script_type'] = id_script_type script_map['script'] = script script_map['model'] = model script_map['description'] = description url = 'script/edit/' + str(id_script) + '/' code, xml = self.submit({'script': script_map}, 'PUT', url) return self.response(code, xml)
python
def alterar(self, id_script, id_script_type, script, description, model=None): """Change Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param script: Script name. String with a minimum 3 and maximum of 40 characters :param description: Script description. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Script, script Type, script or description is null and invalid. :raise RoteiroNaoExisteError: Script not registered. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeRoteiroDuplicadoError: Script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_script): raise InvalidParameterError(u'The identifier of Script is invalid or was not informed.') script_map = dict() script_map['id_script_type'] = id_script_type script_map['script'] = script script_map['model'] = model script_map['description'] = description url = 'script/edit/' + str(id_script) + '/' code, xml = self.submit({'script': script_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alterar", "(", "self", ",", "id_script", ",", "id_script_type", ",", "script", ",", "description", ",", "model", "=", "None", ")", ":", "if", "not", "is_valid_int_param", "(", "id_script", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Script is invalid or was not informed.'", ")", "script_map", "=", "dict", "(", ")", "script_map", "[", "'id_script_type'", "]", "=", "id_script_type", "script_map", "[", "'script'", "]", "=", "script", "script_map", "[", "'model'", "]", "=", "model", "script_map", "[", "'description'", "]", "=", "description", "url", "=", "'script/edit/'", "+", "str", "(", "id_script", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'script'", ":", "script_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param script: Script name. String with a minimum 3 and maximum of 40 characters :param description: Script description. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Script, script Type, script or description is null and invalid. :raise RoteiroNaoExisteError: Script not registered. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeRoteiroDuplicadoError: Script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Change", "Script", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Roteiro.py#L87-L117
globocom/GloboNetworkAPI-client-python
networkapiclient/Roteiro.py
Roteiro.remover
def remover(self, id_script): """Remove Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Script is null and invalid. :raise RoteiroNaoExisteError: Script 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_script): raise InvalidParameterError( u'The identifier of Script is invalid or was not informed.') url = 'script/' + str(id_script) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remover(self, id_script): """Remove Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Script is null and invalid. :raise RoteiroNaoExisteError: Script 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_script): raise InvalidParameterError( u'The identifier of Script is invalid or was not informed.') url = 'script/' + str(id_script) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remover", "(", "self", ",", "id_script", ")", ":", "if", "not", "is_valid_int_param", "(", "id_script", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Script is invalid or was not informed.'", ")", "url", "=", "'script/'", "+", "str", "(", "id_script", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Script is null and invalid. :raise RoteiroNaoExisteError: Script not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Remove", "Script", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Roteiro.py#L119-L139
globocom/GloboNetworkAPI-client-python
networkapiclient/Roteiro.py
Roteiro.listar_por_tipo
def listar_por_tipo(self, id_script_type): """List all Script by Script Type. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :return: Dictionary with the following structure: :: {‘script’: [{‘id’: < id >, ‘tipo_roteiro': < id_tipo_roteiro >, ‘nome': < nome >, ‘descricao’: < descricao >}, ...more Script...]} :raise InvalidParameterError: The identifier of Script Type is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type 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_script_type): raise InvalidParameterError( u'The identifier of Script Type is invalid or was not informed.') url = 'script/scripttype/' + str(id_script_type) + '/' code, map = self.submit(None, 'GET', url) key = 'script' return get_list_map(self.response(code, map, [key]), key)
python
def listar_por_tipo(self, id_script_type): """List all Script by Script Type. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :return: Dictionary with the following structure: :: {‘script’: [{‘id’: < id >, ‘tipo_roteiro': < id_tipo_roteiro >, ‘nome': < nome >, ‘descricao’: < descricao >}, ...more Script...]} :raise InvalidParameterError: The identifier of Script Type is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type 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_script_type): raise InvalidParameterError( u'The identifier of Script Type is invalid or was not informed.') url = 'script/scripttype/' + str(id_script_type) + '/' code, map = self.submit(None, 'GET', url) key = 'script' return get_list_map(self.response(code, map, [key]), key)
[ "def", "listar_por_tipo", "(", "self", ",", "id_script_type", ")", ":", "if", "not", "is_valid_int_param", "(", "id_script_type", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Script Type is invalid or was not informed.'", ")", "url", "=", "'script/scripttype/'", "+", "str", "(", "id_script_type", ")", "+", "'/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "key", "=", "'script'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List all Script by Script Type. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :return: Dictionary with the following structure: :: {‘script’: [{‘id’: < id >, ‘tipo_roteiro': < id_tipo_roteiro >, ‘nome': < nome >, ‘descricao’: < descricao >}, ...more Script...]} :raise InvalidParameterError: The identifier of Script Type is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "all", "Script", "by", "Script", "Type", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Roteiro.py#L141-L169
globocom/GloboNetworkAPI-client-python
networkapiclient/Roteiro.py
Roteiro.listar_por_equipamento
def listar_por_equipamento(self, id_equipment): """List all Script related Equipment. :param id_equipment: Identifier of the Equipment. Integer value and greater than zero. :return: Dictionary with the following structure: :: {script': [{‘id’: < id >, ‘nome’: < nome >, ‘descricao’: < descricao >, ‘id_tipo_roteiro’: < id_tipo_roteiro >, ‘nome_tipo_roteiro’: < nome_tipo_roteiro >, ‘descricao_tipo_roteiro’: < descricao_tipo_roteiro >}, ...more Script...]} :raise InvalidParameterError: The identifier of Equipment is null and invalid. :raise EquipamentoNaoExisteError: Equipment 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_equipment): raise InvalidParameterError( u'The identifier of Equipment is invalid or was not informed.') url = 'script/equipment/' + str(id_equipment) + '/' code, map = self.submit(None, 'GET', url) key = 'script' return get_list_map(self.response(code, map, [key]), key)
python
def listar_por_equipamento(self, id_equipment): """List all Script related Equipment. :param id_equipment: Identifier of the Equipment. Integer value and greater than zero. :return: Dictionary with the following structure: :: {script': [{‘id’: < id >, ‘nome’: < nome >, ‘descricao’: < descricao >, ‘id_tipo_roteiro’: < id_tipo_roteiro >, ‘nome_tipo_roteiro’: < nome_tipo_roteiro >, ‘descricao_tipo_roteiro’: < descricao_tipo_roteiro >}, ...more Script...]} :raise InvalidParameterError: The identifier of Equipment is null and invalid. :raise EquipamentoNaoExisteError: Equipment 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_equipment): raise InvalidParameterError( u'The identifier of Equipment is invalid or was not informed.') url = 'script/equipment/' + str(id_equipment) + '/' code, map = self.submit(None, 'GET', url) key = 'script' return get_list_map(self.response(code, map, [key]), key)
[ "def", "listar_por_equipamento", "(", "self", ",", "id_equipment", ")", ":", "if", "not", "is_valid_int_param", "(", "id_equipment", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Equipment is invalid or was not informed.'", ")", "url", "=", "'script/equipment/'", "+", "str", "(", "id_equipment", ")", "+", "'/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "key", "=", "'script'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List all Script related Equipment. :param id_equipment: Identifier of the Equipment. Integer value and greater than zero. :return: Dictionary with the following structure: :: {script': [{‘id’: < id >, ‘nome’: < nome >, ‘descricao’: < descricao >, ‘id_tipo_roteiro’: < id_tipo_roteiro >, ‘nome_tipo_roteiro’: < nome_tipo_roteiro >, ‘descricao_tipo_roteiro’: < descricao_tipo_roteiro >}, ...more Script...]} :raise InvalidParameterError: The identifier of Equipment is null and invalid. :raise EquipamentoNaoExisteError: Equipment not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "all", "Script", "related", "Equipment", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Roteiro.py#L171-L201
globocom/GloboNetworkAPI-client-python
networkapiclient/BlockRule.py
BlockRule.get_rule_by_id
def get_rule_by_id(self, rule_id): """Get rule by indentifier. :param rule_id: Rule identifier :return: Dictionary with the following structure: :: {'rule': {'environment': < environment_id >, 'content': < content >, 'custom': < custom >, 'id': < id >, 'name': < name >}} :raise UserNotAuthorizedError: User dont have permition. :raise InvalidParameterError: RULE identifier is null or invalid. :raise DataBaseError: Can't connect to networkapi database. """ url = "rule/get_by_id/" + str(rule_id) code, xml = self.submit(None, 'GET', url) return self.response(code, xml, ['rule_contents', 'rule_blocks'])
python
def get_rule_by_id(self, rule_id): """Get rule by indentifier. :param rule_id: Rule identifier :return: Dictionary with the following structure: :: {'rule': {'environment': < environment_id >, 'content': < content >, 'custom': < custom >, 'id': < id >, 'name': < name >}} :raise UserNotAuthorizedError: User dont have permition. :raise InvalidParameterError: RULE identifier is null or invalid. :raise DataBaseError: Can't connect to networkapi database. """ url = "rule/get_by_id/" + str(rule_id) code, xml = self.submit(None, 'GET', url) return self.response(code, xml, ['rule_contents', 'rule_blocks'])
[ "def", "get_rule_by_id", "(", "self", ",", "rule_id", ")", ":", "url", "=", "\"rule/get_by_id/\"", "+", "str", "(", "rule_id", ")", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ",", "[", "'rule_contents'", ",", "'rule_blocks'", "]", ")" ]
Get rule by indentifier. :param rule_id: Rule identifier :return: Dictionary with the following structure: :: {'rule': {'environment': < environment_id >, 'content': < content >, 'custom': < custom >, 'id': < id >, 'name': < name >}} :raise UserNotAuthorizedError: User dont have permition. :raise InvalidParameterError: RULE identifier is null or invalid. :raise DataBaseError: Can't connect to networkapi database.
[ "Get", "rule", "by", "indentifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/BlockRule.py#L36-L60
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.create_networks
def create_networks(self, ids, id_vlan): """Set column 'active = 1' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing """ network_map = dict() network_map['ids'] = ids network_map['id_vlan'] = id_vlan code, xml = self.submit( {'network': network_map}, 'PUT', 'network/create/') return self.response(code, xml)
python
def create_networks(self, ids, id_vlan): """Set column 'active = 1' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing """ network_map = dict() network_map['ids'] = ids network_map['id_vlan'] = id_vlan code, xml = self.submit( {'network': network_map}, 'PUT', 'network/create/') return self.response(code, xml)
[ "def", "create_networks", "(", "self", ",", "ids", ",", "id_vlan", ")", ":", "network_map", "=", "dict", "(", ")", "network_map", "[", "'ids'", "]", "=", "ids", "network_map", "[", "'id_vlan'", "]", "=", "id_vlan", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'network'", ":", "network_map", "}", ",", "'PUT'", ",", "'network/create/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Set column 'active = 1' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing
[ "Set", "column", "active", "=", "1", "in", "tables", "redeipv4", "and", "redeipv6", "]" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L38-L53
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.add_network
def add_network(self, network, id_vlan, id_network_type, id_environment_vip=None, cluster_unit=None): """ Add new network :param network: IPV4 or IPV6 (ex.: "10.0.0.3/24") :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_network_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_environment_vip: Identifier of the Environment Vip. Integer value and greater than zero. :return: Following dictionary: :: {'network':{'id': <id_network>, 'rede': <network>, 'broadcast': <broadcast> (if is IPv4), 'mask': <net_mask>, 'id_vlan': <id_vlan>, 'id_tipo_rede': <id_network_type>, 'id_ambiente_vip': <id_ambiente_vip>, 'active': <active>} } :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv4. :raise NetworkIPRangeEnvError: Other environment already have this ip range. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ network_map = dict() network_map['network'] = network network_map['id_vlan'] = id_vlan network_map['id_network_type'] = id_network_type network_map['id_environment_vip'] = id_environment_vip network_map['cluster_unit'] = cluster_unit code, xml = self.submit( {'network': network_map}, 'POST', 'network/add/') return self.response(code, xml)
python
def add_network(self, network, id_vlan, id_network_type, id_environment_vip=None, cluster_unit=None): """ Add new network :param network: IPV4 or IPV6 (ex.: "10.0.0.3/24") :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_network_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_environment_vip: Identifier of the Environment Vip. Integer value and greater than zero. :return: Following dictionary: :: {'network':{'id': <id_network>, 'rede': <network>, 'broadcast': <broadcast> (if is IPv4), 'mask': <net_mask>, 'id_vlan': <id_vlan>, 'id_tipo_rede': <id_network_type>, 'id_ambiente_vip': <id_ambiente_vip>, 'active': <active>} } :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv4. :raise NetworkIPRangeEnvError: Other environment already have this ip range. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ network_map = dict() network_map['network'] = network network_map['id_vlan'] = id_vlan network_map['id_network_type'] = id_network_type network_map['id_environment_vip'] = id_environment_vip network_map['cluster_unit'] = cluster_unit code, xml = self.submit( {'network': network_map}, 'POST', 'network/add/') return self.response(code, xml)
[ "def", "add_network", "(", "self", ",", "network", ",", "id_vlan", ",", "id_network_type", ",", "id_environment_vip", "=", "None", ",", "cluster_unit", "=", "None", ")", ":", "network_map", "=", "dict", "(", ")", "network_map", "[", "'network'", "]", "=", "network", "network_map", "[", "'id_vlan'", "]", "=", "id_vlan", "network_map", "[", "'id_network_type'", "]", "=", "id_network_type", "network_map", "[", "'id_environment_vip'", "]", "=", "id_environment_vip", "network_map", "[", "'cluster_unit'", "]", "=", "cluster_unit", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'network'", ":", "network_map", "}", ",", "'POST'", ",", "'network/add/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Add new network :param network: IPV4 or IPV6 (ex.: "10.0.0.3/24") :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_network_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_environment_vip: Identifier of the Environment Vip. Integer value and greater than zero. :return: Following dictionary: :: {'network':{'id': <id_network>, 'rede': <network>, 'broadcast': <broadcast> (if is IPv4), 'mask': <net_mask>, 'id_vlan': <id_vlan>, 'id_tipo_rede': <id_network_type>, 'id_ambiente_vip': <id_ambiente_vip>, 'active': <active>} } :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv4. :raise NetworkIPRangeEnvError: Other environment already have this ip range. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Add", "new", "network" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L55-L96
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.edit_network
def edit_network(self, id_network, ip_type, id_net_type, id_env_vip=None, cluster_unit=None): """ Edit a network 4 or 6 :param id_network: Identifier of the Network. Integer value and greater than zero. :param id_net_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_env_vip: Identifier of the Environment Vip. Integer value and greater than zero. :param ip_type: Identifier of the Network IP Type: 0 = IP4 Network; 1 = IP6 Network; :return: None :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv4. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ net_map = dict() net_map['id_network'] = id_network net_map['ip_type'] = ip_type net_map['id_net_type'] = id_net_type net_map['id_env_vip'] = id_env_vip net_map['cluster_unit'] = cluster_unit code, xml = self.submit({'net': net_map}, 'POST', 'network/edit/') return self.response(code, xml)
python
def edit_network(self, id_network, ip_type, id_net_type, id_env_vip=None, cluster_unit=None): """ Edit a network 4 or 6 :param id_network: Identifier of the Network. Integer value and greater than zero. :param id_net_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_env_vip: Identifier of the Environment Vip. Integer value and greater than zero. :param ip_type: Identifier of the Network IP Type: 0 = IP4 Network; 1 = IP6 Network; :return: None :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv4. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ net_map = dict() net_map['id_network'] = id_network net_map['ip_type'] = ip_type net_map['id_net_type'] = id_net_type net_map['id_env_vip'] = id_env_vip net_map['cluster_unit'] = cluster_unit code, xml = self.submit({'net': net_map}, 'POST', 'network/edit/') return self.response(code, xml)
[ "def", "edit_network", "(", "self", ",", "id_network", ",", "ip_type", ",", "id_net_type", ",", "id_env_vip", "=", "None", ",", "cluster_unit", "=", "None", ")", ":", "net_map", "=", "dict", "(", ")", "net_map", "[", "'id_network'", "]", "=", "id_network", "net_map", "[", "'ip_type'", "]", "=", "ip_type", "net_map", "[", "'id_net_type'", "]", "=", "id_net_type", "net_map", "[", "'id_env_vip'", "]", "=", "id_env_vip", "net_map", "[", "'cluster_unit'", "]", "=", "cluster_unit", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'net'", ":", "net_map", "}", ",", "'POST'", ",", "'network/edit/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Edit a network 4 or 6 :param id_network: Identifier of the Network. Integer value and greater than zero. :param id_net_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_env_vip: Identifier of the Environment Vip. Integer value and greater than zero. :param ip_type: Identifier of the Network IP Type: 0 = IP4 Network; 1 = IP6 Network; :return: None :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv4. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Edit", "a", "network", "4", "or", "6" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L210-L237
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.get_network_ipv4
def get_network_ipv4(self, id_network): """ Get networkipv4 :param id_network: Identifier of the Network. Integer value and greater than zero. :return: Following dictionary: :: {'network': {'id': < id_networkIpv6 >, 'network_type': < id_tipo_rede >, 'ambiente_vip': < id_ambiente_vip >, 'vlan': <id_vlan> 'oct1': < rede_oct1 >, 'oct2': < rede_oct2 >, 'oct3': < rede_oct3 >, 'oct4': < rede_oct4 > 'blocK': < bloco >, 'mask_oct1': < mascara_oct1 >, 'mask_oct2': < mascara_oct2 >, 'mask_oct3': < mascara_oct3 >, 'mask_oct4': < mascara_oct4 >, 'active': < ativada >, 'broadcast':<'broadcast>, }} :raise NetworkIPv4NotFoundError: NetworkIPV4 not found. :raise InvalidValueError: Invalid ID for NetworkIpv4 :raise NetworkIPv4Error: Error in NetworkIpv4 :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network): raise InvalidParameterError( u'O id do rede ip4 foi informado incorretamente.') url = 'network/ipv4/id/' + str(id_network) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def get_network_ipv4(self, id_network): """ Get networkipv4 :param id_network: Identifier of the Network. Integer value and greater than zero. :return: Following dictionary: :: {'network': {'id': < id_networkIpv6 >, 'network_type': < id_tipo_rede >, 'ambiente_vip': < id_ambiente_vip >, 'vlan': <id_vlan> 'oct1': < rede_oct1 >, 'oct2': < rede_oct2 >, 'oct3': < rede_oct3 >, 'oct4': < rede_oct4 > 'blocK': < bloco >, 'mask_oct1': < mascara_oct1 >, 'mask_oct2': < mascara_oct2 >, 'mask_oct3': < mascara_oct3 >, 'mask_oct4': < mascara_oct4 >, 'active': < ativada >, 'broadcast':<'broadcast>, }} :raise NetworkIPv4NotFoundError: NetworkIPV4 not found. :raise InvalidValueError: Invalid ID for NetworkIpv4 :raise NetworkIPv4Error: Error in NetworkIpv4 :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network): raise InvalidParameterError( u'O id do rede ip4 foi informado incorretamente.') url = 'network/ipv4/id/' + str(id_network) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "get_network_ipv4", "(", "self", ",", "id_network", ")", ":", "if", "not", "is_valid_int_param", "(", "id_network", ")", ":", "raise", "InvalidParameterError", "(", "u'O id do rede ip4 foi informado incorretamente.'", ")", "url", "=", "'network/ipv4/id/'", "+", "str", "(", "id_network", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Get networkipv4 :param id_network: Identifier of the Network. Integer value and greater than zero. :return: Following dictionary: :: {'network': {'id': < id_networkIpv6 >, 'network_type': < id_tipo_rede >, 'ambiente_vip': < id_ambiente_vip >, 'vlan': <id_vlan> 'oct1': < rede_oct1 >, 'oct2': < rede_oct2 >, 'oct3': < rede_oct3 >, 'oct4': < rede_oct4 > 'blocK': < bloco >, 'mask_oct1': < mascara_oct1 >, 'mask_oct2': < mascara_oct2 >, 'mask_oct3': < mascara_oct3 >, 'mask_oct4': < mascara_oct4 >, 'active': < ativada >, 'broadcast':<'broadcast>, }} :raise NetworkIPv4NotFoundError: NetworkIPV4 not found. :raise InvalidValueError: Invalid ID for NetworkIpv4 :raise NetworkIPv4Error: Error in NetworkIpv4 :raise XMLError: Networkapi failed to generate the XML response.
[ "Get", "networkipv4" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L239-L278
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.get_network_ipv6
def get_network_ipv6(self, id_network): """ Get networkipv6 :param id_network: Identifier of the Network. Integer value and greater than zero. :return: Following dictionary: :: {'network': {'id': < id_networkIpv6 >, 'network_type': < id_tipo_rede >, 'ambiente_vip': < id_ambiente_viṕ >, 'vlan': <id_vlan> 'block1': < rede_oct1 >, 'block2': < rede_oct2 >, 'block3': < rede_oct3 >, 'block4': < rede_oct4 >, 'block5': < rede_oct4 >, 'block6': < rede_oct4 >, 'block7': < rede_oct4 >, 'block8': < rede_oct4 >, 'blocK': < bloco >, 'mask1': < mascara_oct1 >, 'mask2': < mascara_oct2 >, 'mask3': < mascara_oct3 >, 'mask4': < mascara_oct4 >, 'mask5': < mascara_oct4 >, 'mask6': < mascara_oct4 >, 'mask7': < mascara_oct4 >, 'mask8': < mascara_oct4 >, 'active': < ativada >, }} :raise NetworkIPv6NotFoundError: NetworkIPV6 not found. :raise InvalidValueError: Invalid ID for NetworkIpv6 :raise NetworkIPv6Error: Error in NetworkIpv6 :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network): raise InvalidParameterError( u'O id do rede ip6 foi informado incorretamente.') url = 'network/ipv6/id/' + str(id_network) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def get_network_ipv6(self, id_network): """ Get networkipv6 :param id_network: Identifier of the Network. Integer value and greater than zero. :return: Following dictionary: :: {'network': {'id': < id_networkIpv6 >, 'network_type': < id_tipo_rede >, 'ambiente_vip': < id_ambiente_viṕ >, 'vlan': <id_vlan> 'block1': < rede_oct1 >, 'block2': < rede_oct2 >, 'block3': < rede_oct3 >, 'block4': < rede_oct4 >, 'block5': < rede_oct4 >, 'block6': < rede_oct4 >, 'block7': < rede_oct4 >, 'block8': < rede_oct4 >, 'blocK': < bloco >, 'mask1': < mascara_oct1 >, 'mask2': < mascara_oct2 >, 'mask3': < mascara_oct3 >, 'mask4': < mascara_oct4 >, 'mask5': < mascara_oct4 >, 'mask6': < mascara_oct4 >, 'mask7': < mascara_oct4 >, 'mask8': < mascara_oct4 >, 'active': < ativada >, }} :raise NetworkIPv6NotFoundError: NetworkIPV6 not found. :raise InvalidValueError: Invalid ID for NetworkIpv6 :raise NetworkIPv6Error: Error in NetworkIpv6 :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network): raise InvalidParameterError( u'O id do rede ip6 foi informado incorretamente.') url = 'network/ipv6/id/' + str(id_network) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "get_network_ipv6", "(", "self", ",", "id_network", ")", ":", "if", "not", "is_valid_int_param", "(", "id_network", ")", ":", "raise", "InvalidParameterError", "(", "u'O id do rede ip6 foi informado incorretamente.'", ")", "url", "=", "'network/ipv6/id/'", "+", "str", "(", "id_network", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Get networkipv6 :param id_network: Identifier of the Network. Integer value and greater than zero. :return: Following dictionary: :: {'network': {'id': < id_networkIpv6 >, 'network_type': < id_tipo_rede >, 'ambiente_vip': < id_ambiente_viṕ >, 'vlan': <id_vlan> 'block1': < rede_oct1 >, 'block2': < rede_oct2 >, 'block3': < rede_oct3 >, 'block4': < rede_oct4 >, 'block5': < rede_oct4 >, 'block6': < rede_oct4 >, 'block7': < rede_oct4 >, 'block8': < rede_oct4 >, 'blocK': < bloco >, 'mask1': < mascara_oct1 >, 'mask2': < mascara_oct2 >, 'mask3': < mascara_oct3 >, 'mask4': < mascara_oct4 >, 'mask5': < mascara_oct4 >, 'mask6': < mascara_oct4 >, 'mask7': < mascara_oct4 >, 'mask8': < mascara_oct4 >, 'active': < ativada >, }} :raise NetworkIPv6NotFoundError: NetworkIPV6 not found. :raise InvalidValueError: Invalid ID for NetworkIpv6 :raise NetworkIPv6Error: Error in NetworkIpv6 :raise XMLError: Networkapi failed to generate the XML response.
[ "Get", "networkipv6" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L280-L326
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.deallocate_network_ipv4
def deallocate_network_ipv4(self, id_network_ipv4): """ Deallocate all relationships between NetworkIPv4. :param id_network_ipv4: ID for NetworkIPv4 :return: Nothing :raise InvalidParameterError: Invalid ID for NetworkIPv4. :raise NetworkIPv4NotFoundError: NetworkIPv4 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network_ipv4): raise InvalidParameterError( u'The identifier of NetworkIPv4 is invalid or was not informed.') url = 'network/ipv4/' + str(id_network_ipv4) + '/deallocate/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def deallocate_network_ipv4(self, id_network_ipv4): """ Deallocate all relationships between NetworkIPv4. :param id_network_ipv4: ID for NetworkIPv4 :return: Nothing :raise InvalidParameterError: Invalid ID for NetworkIPv4. :raise NetworkIPv4NotFoundError: NetworkIPv4 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network_ipv4): raise InvalidParameterError( u'The identifier of NetworkIPv4 is invalid or was not informed.') url = 'network/ipv4/' + str(id_network_ipv4) + '/deallocate/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "deallocate_network_ipv4", "(", "self", ",", "id_network_ipv4", ")", ":", "if", "not", "is_valid_int_param", "(", "id_network_ipv4", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of NetworkIPv4 is invalid or was not informed.'", ")", "url", "=", "'network/ipv4/'", "+", "str", "(", "id_network_ipv4", ")", "+", "'/deallocate/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Deallocate all relationships between NetworkIPv4. :param id_network_ipv4: ID for NetworkIPv4 :return: Nothing :raise InvalidParameterError: Invalid ID for NetworkIPv4. :raise NetworkIPv4NotFoundError: NetworkIPv4 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Deallocate", "all", "relationships", "between", "NetworkIPv4", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L328-L350
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.add_network_ipv6
def add_network_ipv6( self, id_vlan, id_tipo_rede, id_ambiente_vip=None, prefix=None): """ Add new networkipv6 :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_tipo_rede: Identifier of the NetworkType. Integer value and greater than zero. :param id_ambiente_vip: Identifier of the Environment Vip. Integer value and greater than zero. :param prefix: Prefix. :return: Following dictionary: :: {'vlan': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_tipo_rede': < id_tipo_rede >, 'id_ambiente': < id_ambiente >, 'rede_oct1': < rede_oct1 >, 'rede_oct2': < rede_oct2 >, 'rede_oct3': < rede_oct3 >, 'rede_oct4': < rede_oct4 >, 'rede_oct5': < rede_oct4 >, 'rede_oct6': < rede_oct4 >, 'rede_oct7': < rede_oct4 >, 'rede_oct8': < rede_oct4 >, 'bloco': < bloco >, 'mascara_oct1': < mascara_oct1 >, 'mascara_oct2': < mascara_oct2 >, 'mascara_oct3': < mascara_oct3 >, 'mascara_oct4': < mascara_oct4 >, 'mascara_oct5': < mascara_oct4 >, 'mascara_oct6': < mascara_oct4 >, 'mascara_oct7': < mascara_oct4 >, 'mascara_oct8': < mascara_oct4 >, 'broadcast': < broadcast >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >}} :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv6. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ vlan_map = dict() vlan_map['id_vlan'] = id_vlan vlan_map['id_tipo_rede'] = id_tipo_rede vlan_map['id_ambiente_vip'] = id_ambiente_vip vlan_map['prefix'] = prefix code, xml = self.submit( {'vlan': vlan_map}, 'POST', 'network/ipv6/add/') return self.response(code, xml)
python
def add_network_ipv6( self, id_vlan, id_tipo_rede, id_ambiente_vip=None, prefix=None): """ Add new networkipv6 :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_tipo_rede: Identifier of the NetworkType. Integer value and greater than zero. :param id_ambiente_vip: Identifier of the Environment Vip. Integer value and greater than zero. :param prefix: Prefix. :return: Following dictionary: :: {'vlan': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_tipo_rede': < id_tipo_rede >, 'id_ambiente': < id_ambiente >, 'rede_oct1': < rede_oct1 >, 'rede_oct2': < rede_oct2 >, 'rede_oct3': < rede_oct3 >, 'rede_oct4': < rede_oct4 >, 'rede_oct5': < rede_oct4 >, 'rede_oct6': < rede_oct4 >, 'rede_oct7': < rede_oct4 >, 'rede_oct8': < rede_oct4 >, 'bloco': < bloco >, 'mascara_oct1': < mascara_oct1 >, 'mascara_oct2': < mascara_oct2 >, 'mascara_oct3': < mascara_oct3 >, 'mascara_oct4': < mascara_oct4 >, 'mascara_oct5': < mascara_oct4 >, 'mascara_oct6': < mascara_oct4 >, 'mascara_oct7': < mascara_oct4 >, 'mascara_oct8': < mascara_oct4 >, 'broadcast': < broadcast >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >}} :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv6. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ vlan_map = dict() vlan_map['id_vlan'] = id_vlan vlan_map['id_tipo_rede'] = id_tipo_rede vlan_map['id_ambiente_vip'] = id_ambiente_vip vlan_map['prefix'] = prefix code, xml = self.submit( {'vlan': vlan_map}, 'POST', 'network/ipv6/add/') return self.response(code, xml)
[ "def", "add_network_ipv6", "(", "self", ",", "id_vlan", ",", "id_tipo_rede", ",", "id_ambiente_vip", "=", "None", ",", "prefix", "=", "None", ")", ":", "vlan_map", "=", "dict", "(", ")", "vlan_map", "[", "'id_vlan'", "]", "=", "id_vlan", "vlan_map", "[", "'id_tipo_rede'", "]", "=", "id_tipo_rede", "vlan_map", "[", "'id_ambiente_vip'", "]", "=", "id_ambiente_vip", "vlan_map", "[", "'prefix'", "]", "=", "prefix", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'vlan'", ":", "vlan_map", "}", ",", "'POST'", ",", "'network/ipv6/add/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Add new networkipv6 :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_tipo_rede: Identifier of the NetworkType. Integer value and greater than zero. :param id_ambiente_vip: Identifier of the Environment Vip. Integer value and greater than zero. :param prefix: Prefix. :return: Following dictionary: :: {'vlan': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_tipo_rede': < id_tipo_rede >, 'id_ambiente': < id_ambiente >, 'rede_oct1': < rede_oct1 >, 'rede_oct2': < rede_oct2 >, 'rede_oct3': < rede_oct3 >, 'rede_oct4': < rede_oct4 >, 'rede_oct5': < rede_oct4 >, 'rede_oct6': < rede_oct4 >, 'rede_oct7': < rede_oct4 >, 'rede_oct8': < rede_oct4 >, 'bloco': < bloco >, 'mascara_oct1': < mascara_oct1 >, 'mascara_oct2': < mascara_oct2 >, 'mascara_oct3': < mascara_oct3 >, 'mascara_oct4': < mascara_oct4 >, 'mascara_oct5': < mascara_oct4 >, 'mascara_oct6': < mascara_oct4 >, 'mascara_oct7': < mascara_oct4 >, 'mascara_oct8': < mascara_oct4 >, 'broadcast': < broadcast >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >}} :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv6. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Add", "new", "networkipv6" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L352-L415
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.add_network_ipv6_hosts
def add_network_ipv6_hosts( self, id_vlan, id_tipo_rede, num_hosts, id_ambiente_vip=None): """ Add new networkipv6 :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_tipo_rede: Identifier of the NetworkType. Integer value and greater than zero. :param num_hosts: Number of hosts expected. Integer value and greater than zero. :param id_ambiente_vip: Identifier of the Environment Vip. Integer value and greater than zero. :return: Following dictionary: :: {'vlan': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_tipo_rede': < id_tipo_rede >, 'id_ambiente': < id_ambiente >, 'rede_oct1': < rede_oct1 >, 'rede_oct2': < rede_oct2 >, 'rede_oct3': < rede_oct3 >, 'rede_oct4': < rede_oct4 >, 'rede_oct5': < rede_oct4 >, 'rede_oct6': < rede_oct4 >, 'rede_oct7': < rede_oct4 >, 'rede_oct8': < rede_oct4 >, 'bloco': < bloco >, 'mascara_oct1': < mascara_oct1 >, 'mascara_oct2': < mascara_oct2 >, 'mascara_oct3': < mascara_oct3 >, 'mascara_oct4': < mascara_oct4 >, 'mascara_oct5': < mascara_oct4 >, 'mascara_oct6': < mascara_oct4 >, 'mascara_oct7': < mascara_oct4 >, 'mascara_oct8': < mascara_oct4 >, 'broadcast': < broadcast >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >}} :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv6. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ vlan_map = dict() vlan_map['id_vlan'] = id_vlan vlan_map['id_tipo_rede'] = id_tipo_rede vlan_map['num_hosts'] = num_hosts vlan_map['id_ambiente_vip'] = id_ambiente_vip code, xml = self.submit({'vlan': vlan_map}, 'PUT', 'network/ipv6/add/') return self.response(code, xml)
python
def add_network_ipv6_hosts( self, id_vlan, id_tipo_rede, num_hosts, id_ambiente_vip=None): """ Add new networkipv6 :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_tipo_rede: Identifier of the NetworkType. Integer value and greater than zero. :param num_hosts: Number of hosts expected. Integer value and greater than zero. :param id_ambiente_vip: Identifier of the Environment Vip. Integer value and greater than zero. :return: Following dictionary: :: {'vlan': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_tipo_rede': < id_tipo_rede >, 'id_ambiente': < id_ambiente >, 'rede_oct1': < rede_oct1 >, 'rede_oct2': < rede_oct2 >, 'rede_oct3': < rede_oct3 >, 'rede_oct4': < rede_oct4 >, 'rede_oct5': < rede_oct4 >, 'rede_oct6': < rede_oct4 >, 'rede_oct7': < rede_oct4 >, 'rede_oct8': < rede_oct4 >, 'bloco': < bloco >, 'mascara_oct1': < mascara_oct1 >, 'mascara_oct2': < mascara_oct2 >, 'mascara_oct3': < mascara_oct3 >, 'mascara_oct4': < mascara_oct4 >, 'mascara_oct5': < mascara_oct4 >, 'mascara_oct6': < mascara_oct4 >, 'mascara_oct7': < mascara_oct4 >, 'mascara_oct8': < mascara_oct4 >, 'broadcast': < broadcast >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >}} :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv6. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ vlan_map = dict() vlan_map['id_vlan'] = id_vlan vlan_map['id_tipo_rede'] = id_tipo_rede vlan_map['num_hosts'] = num_hosts vlan_map['id_ambiente_vip'] = id_ambiente_vip code, xml = self.submit({'vlan': vlan_map}, 'PUT', 'network/ipv6/add/') return self.response(code, xml)
[ "def", "add_network_ipv6_hosts", "(", "self", ",", "id_vlan", ",", "id_tipo_rede", ",", "num_hosts", ",", "id_ambiente_vip", "=", "None", ")", ":", "vlan_map", "=", "dict", "(", ")", "vlan_map", "[", "'id_vlan'", "]", "=", "id_vlan", "vlan_map", "[", "'id_tipo_rede'", "]", "=", "id_tipo_rede", "vlan_map", "[", "'num_hosts'", "]", "=", "num_hosts", "vlan_map", "[", "'id_ambiente_vip'", "]", "=", "id_ambiente_vip", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'vlan'", ":", "vlan_map", "}", ",", "'PUT'", ",", "'network/ipv6/add/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Add new networkipv6 :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_tipo_rede: Identifier of the NetworkType. Integer value and greater than zero. :param num_hosts: Number of hosts expected. Integer value and greater than zero. :param id_ambiente_vip: Identifier of the Environment Vip. Integer value and greater than zero. :return: Following dictionary: :: {'vlan': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_tipo_rede': < id_tipo_rede >, 'id_ambiente': < id_ambiente >, 'rede_oct1': < rede_oct1 >, 'rede_oct2': < rede_oct2 >, 'rede_oct3': < rede_oct3 >, 'rede_oct4': < rede_oct4 >, 'rede_oct5': < rede_oct4 >, 'rede_oct6': < rede_oct4 >, 'rede_oct7': < rede_oct4 >, 'rede_oct8': < rede_oct4 >, 'bloco': < bloco >, 'mascara_oct1': < mascara_oct1 >, 'mascara_oct2': < mascara_oct2 >, 'mascara_oct3': < mascara_oct3 >, 'mascara_oct4': < mascara_oct4 >, 'mascara_oct5': < mascara_oct4 >, 'mascara_oct6': < mascara_oct4 >, 'mascara_oct7': < mascara_oct4 >, 'mascara_oct8': < mascara_oct4 >, 'broadcast': < broadcast >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >}} :raise TipoRedeNaoExisteError: NetworkType not found. :raise InvalidParameterError: Invalid ID for Vlan or NetworkType. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise IPNaoDisponivelError: Network address unavailable to create a NetworkIPv6. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Add", "new", "networkipv6" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L417-L479
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.deallocate_network_ipv6
def deallocate_network_ipv6(self, id_network_ipv6): """ Deallocate all relationships between NetworkIPv6. :param id_network_ipv6: ID for NetworkIPv6 :return: Nothing :raise InvalidParameterError: Invalid ID for NetworkIPv6. :raise NetworkIPv6NotFoundError: NetworkIPv6 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network_ipv6): raise InvalidParameterError( u'The identifier of NetworkIPv6 is invalid or was not informed.') url = 'network/ipv6/' + str(id_network_ipv6) + '/deallocate/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def deallocate_network_ipv6(self, id_network_ipv6): """ Deallocate all relationships between NetworkIPv6. :param id_network_ipv6: ID for NetworkIPv6 :return: Nothing :raise InvalidParameterError: Invalid ID for NetworkIPv6. :raise NetworkIPv6NotFoundError: NetworkIPv6 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_network_ipv6): raise InvalidParameterError( u'The identifier of NetworkIPv6 is invalid or was not informed.') url = 'network/ipv6/' + str(id_network_ipv6) + '/deallocate/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "deallocate_network_ipv6", "(", "self", ",", "id_network_ipv6", ")", ":", "if", "not", "is_valid_int_param", "(", "id_network_ipv6", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of NetworkIPv6 is invalid or was not informed.'", ")", "url", "=", "'network/ipv6/'", "+", "str", "(", "id_network_ipv6", ")", "+", "'/deallocate/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Deallocate all relationships between NetworkIPv6. :param id_network_ipv6: ID for NetworkIPv6 :return: Nothing :raise InvalidParameterError: Invalid ID for NetworkIPv6. :raise NetworkIPv6NotFoundError: NetworkIPv6 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Deallocate", "all", "relationships", "between", "NetworkIPv6", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L481-L503
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
Network.remove_networks
def remove_networks(self, ids): """ Set column 'active = 0' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing :raise NetworkInactiveError: Unable to remove the network because it is inactive. :raise InvalidParameterError: Invalid ID for Network or NetworkType. :raise NetworkIPv4NotFoundError: NetworkIPv4 not found. :raise NetworkIPv6NotFoundError: NetworkIPv6 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ network_map = dict() network_map['ids'] = ids code, xml = self.submit( {'network': network_map}, 'PUT', 'network/remove/') return self.response(code, xml)
python
def remove_networks(self, ids): """ Set column 'active = 0' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing :raise NetworkInactiveError: Unable to remove the network because it is inactive. :raise InvalidParameterError: Invalid ID for Network or NetworkType. :raise NetworkIPv4NotFoundError: NetworkIPv4 not found. :raise NetworkIPv6NotFoundError: NetworkIPv6 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ network_map = dict() network_map['ids'] = ids code, xml = self.submit( {'network': network_map}, 'PUT', 'network/remove/') return self.response(code, xml)
[ "def", "remove_networks", "(", "self", ",", "ids", ")", ":", "network_map", "=", "dict", "(", ")", "network_map", "[", "'ids'", "]", "=", "ids", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'network'", ":", "network_map", "}", ",", "'PUT'", ",", "'network/remove/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Set column 'active = 0' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing :raise NetworkInactiveError: Unable to remove the network because it is inactive. :raise InvalidParameterError: Invalid ID for Network or NetworkType. :raise NetworkIPv4NotFoundError: NetworkIPv4 not found. :raise NetworkIPv6NotFoundError: NetworkIPv6 not found. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Set", "column", "active", "=", "0", "in", "tables", "redeipv4", "and", "redeipv6", "]" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L505-L527
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
DHCPRelayIPv4.add
def add(self, networkipv4_id, ipv4_id): """List all DHCPRelayIPv4. :param: networkipv4_id, ipv4_id :return: Following dictionary: { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "oct2": <oct2>, "oct3": <oct3>, "oct1": <oct1>, "ip_formated": "<string IPv4>", "networkipv4": <networkipv4_id>, "id": <ipv4_id>, "descricao": "<string description>" } :raise NetworkAPIException: Falha ao acessar fonte de dados """ data = dict() data['networkipv4'] = networkipv4_id data['ipv4'] = dict() data['ipv4']['id'] = ipv4_id uri = 'api/dhcprelayv4/' return self.post(uri, data=data)
python
def add(self, networkipv4_id, ipv4_id): """List all DHCPRelayIPv4. :param: networkipv4_id, ipv4_id :return: Following dictionary: { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "oct2": <oct2>, "oct3": <oct3>, "oct1": <oct1>, "ip_formated": "<string IPv4>", "networkipv4": <networkipv4_id>, "id": <ipv4_id>, "descricao": "<string description>" } :raise NetworkAPIException: Falha ao acessar fonte de dados """ data = dict() data['networkipv4'] = networkipv4_id data['ipv4'] = dict() data['ipv4']['id'] = ipv4_id uri = 'api/dhcprelayv4/' return self.post(uri, data=data)
[ "def", "add", "(", "self", ",", "networkipv4_id", ",", "ipv4_id", ")", ":", "data", "=", "dict", "(", ")", "data", "[", "'networkipv4'", "]", "=", "networkipv4_id", "data", "[", "'ipv4'", "]", "=", "dict", "(", ")", "data", "[", "'ipv4'", "]", "[", "'id'", "]", "=", "ipv4_id", "uri", "=", "'api/dhcprelayv4/'", "return", "self", ".", "post", "(", "uri", ",", "data", "=", "data", ")" ]
List all DHCPRelayIPv4. :param: networkipv4_id, ipv4_id :return: Following dictionary: { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "oct2": <oct2>, "oct3": <oct3>, "oct1": <oct1>, "ip_formated": "<string IPv4>", "networkipv4": <networkipv4_id>, "id": <ipv4_id>, "descricao": "<string description>" } :raise NetworkAPIException: Falha ao acessar fonte de dados
[ "List", "all", "DHCPRelayIPv4", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L541-L570
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
DHCPRelayIPv4.list
def list(self, networkipv4=None, ipv4=None): """List all DHCPRelayIPv4. :param: networkipv4: networkipv4 id - list all dhcprelay filtering by networkipv4 id ipv4: ipv4 id - list all dhcprelay filtering by ipv4 id :return: Following dictionary: [ { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "oct2": <oct2>, "oct3": <oct3>, "oct1": <oct1>, "ip_formated": "<string IPv4>", "networkipv4": <networkipv4_id>, "id": <ipv4_id>, "descricao": "<string description>" }, {...} ] :raise NetworkAPIException: Falha ao acessar fonte de dados """ uri = 'api/dhcprelayv4/?' if networkipv4: uri += 'networkipv4=%s&' % networkipv4 if ipv4: uri += 'ipv4=%s' % ipv4 return self.get(uri)
python
def list(self, networkipv4=None, ipv4=None): """List all DHCPRelayIPv4. :param: networkipv4: networkipv4 id - list all dhcprelay filtering by networkipv4 id ipv4: ipv4 id - list all dhcprelay filtering by ipv4 id :return: Following dictionary: [ { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "oct2": <oct2>, "oct3": <oct3>, "oct1": <oct1>, "ip_formated": "<string IPv4>", "networkipv4": <networkipv4_id>, "id": <ipv4_id>, "descricao": "<string description>" }, {...} ] :raise NetworkAPIException: Falha ao acessar fonte de dados """ uri = 'api/dhcprelayv4/?' if networkipv4: uri += 'networkipv4=%s&' % networkipv4 if ipv4: uri += 'ipv4=%s' % ipv4 return self.get(uri)
[ "def", "list", "(", "self", ",", "networkipv4", "=", "None", ",", "ipv4", "=", "None", ")", ":", "uri", "=", "'api/dhcprelayv4/?'", "if", "networkipv4", ":", "uri", "+=", "'networkipv4=%s&'", "%", "networkipv4", "if", "ipv4", ":", "uri", "+=", "'ipv4=%s'", "%", "ipv4", "return", "self", ".", "get", "(", "uri", ")" ]
List all DHCPRelayIPv4. :param: networkipv4: networkipv4 id - list all dhcprelay filtering by networkipv4 id ipv4: ipv4 id - list all dhcprelay filtering by ipv4 id :return: Following dictionary: [ { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "oct2": <oct2>, "oct3": <oct3>, "oct1": <oct1>, "ip_formated": "<string IPv4>", "networkipv4": <networkipv4_id>, "id": <ipv4_id>, "descricao": "<string description>" }, {...} ] :raise NetworkAPIException: Falha ao acessar fonte de dados
[ "List", "all", "DHCPRelayIPv4", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L598-L631
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
DHCPRelayIPv6.add
def add(self, networkipv6_id, ipv6_id): """List all DHCPRelayIPv4. :param: Object DHCPRelayIPv4 :return: Following dictionary: { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8": <block8>, "ip_formated": "<string IPv6>", "networkipv6": <networkipv6_id>, "id": <ipv6_id>, "description": "<string description>" } :raise NetworkAPIException: Falha ao acessar fonte de dados """ data = dict() data['networkipv6'] = networkipv6_id data['ipv6'] = dict() data['ipv6']['id'] = ipv6_id uri = 'api/dhcprelayv6/' return self.post(uri, data=data)
python
def add(self, networkipv6_id, ipv6_id): """List all DHCPRelayIPv4. :param: Object DHCPRelayIPv4 :return: Following dictionary: { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8": <block8>, "ip_formated": "<string IPv6>", "networkipv6": <networkipv6_id>, "id": <ipv6_id>, "description": "<string description>" } :raise NetworkAPIException: Falha ao acessar fonte de dados """ data = dict() data['networkipv6'] = networkipv6_id data['ipv6'] = dict() data['ipv6']['id'] = ipv6_id uri = 'api/dhcprelayv6/' return self.post(uri, data=data)
[ "def", "add", "(", "self", ",", "networkipv6_id", ",", "ipv6_id", ")", ":", "data", "=", "dict", "(", ")", "data", "[", "'networkipv6'", "]", "=", "networkipv6_id", "data", "[", "'ipv6'", "]", "=", "dict", "(", ")", "data", "[", "'ipv6'", "]", "[", "'id'", "]", "=", "ipv6_id", "uri", "=", "'api/dhcprelayv6/'", "return", "self", ".", "post", "(", "uri", ",", "data", "=", "data", ")" ]
List all DHCPRelayIPv4. :param: Object DHCPRelayIPv4 :return: Following dictionary: { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8": <block8>, "ip_formated": "<string IPv6>", "networkipv6": <networkipv6_id>, "id": <ipv6_id>, "description": "<string description>" } :raise NetworkAPIException: Falha ao acessar fonte de dados
[ "List", "all", "DHCPRelayIPv4", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L657-L690
globocom/GloboNetworkAPI-client-python
networkapiclient/Network.py
DHCPRelayIPv6.list
def list(self, networkipv6=None, ipv6=None): """List all DHCPRelayIPv6. :param: networkipv6: networkipv6 id - list all dhcprelay filtering by networkipv6 id ipv6: ipv6 id - list all dhcprelay filtering by ipv6 id :return: Following dictionary: [ { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8": <block8>, "ip_formated": "<string IPv6>", "networkipv6": <networkipv6_id>, "id": <ipv6_id>, "description": "<string description>" }, {...} ] :raise NetworkAPIException: Falha ao acessar fonte de dados """ uri = 'api/dhcprelayv6/?' if networkipv6: uri += 'networkipv6=%s&' % networkipv6 if ipv6: uri += 'ipv6=%s' % ipv6 return self.get(uri)
python
def list(self, networkipv6=None, ipv6=None): """List all DHCPRelayIPv6. :param: networkipv6: networkipv6 id - list all dhcprelay filtering by networkipv6 id ipv6: ipv6 id - list all dhcprelay filtering by ipv6 id :return: Following dictionary: [ { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8": <block8>, "ip_formated": "<string IPv6>", "networkipv6": <networkipv6_id>, "id": <ipv6_id>, "description": "<string description>" }, {...} ] :raise NetworkAPIException: Falha ao acessar fonte de dados """ uri = 'api/dhcprelayv6/?' if networkipv6: uri += 'networkipv6=%s&' % networkipv6 if ipv6: uri += 'ipv6=%s' % ipv6 return self.get(uri)
[ "def", "list", "(", "self", ",", "networkipv6", "=", "None", ",", "ipv6", "=", "None", ")", ":", "uri", "=", "'api/dhcprelayv6/?'", "if", "networkipv6", ":", "uri", "+=", "'networkipv6=%s&'", "%", "networkipv6", "if", "ipv6", ":", "uri", "+=", "'ipv6=%s'", "%", "ipv6", "return", "self", ".", "get", "(", "uri", ")" ]
List all DHCPRelayIPv6. :param: networkipv6: networkipv6 id - list all dhcprelay filtering by networkipv6 id ipv6: ipv6 id - list all dhcprelay filtering by ipv6 id :return: Following dictionary: [ { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8": <block8>, "ip_formated": "<string IPv6>", "networkipv6": <networkipv6_id>, "id": <ipv6_id>, "description": "<string description>" }, {...} ] :raise NetworkAPIException: Falha ao acessar fonte de dados
[ "List", "all", "DHCPRelayIPv6", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Network.py#L722-L759
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv6.py
ApiIPv6.search
def search(self, **kwargs): """ Method to search ipv6's based on extends search. :param search: Dict containing QuerySets to find ipv6's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv6's """ return super(ApiIPv6, self).get(self.prepare_url('api/v3/ipv6/', kwargs))
python
def search(self, **kwargs): """ Method to search ipv6's based on extends search. :param search: Dict containing QuerySets to find ipv6's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv6's """ return super(ApiIPv6, self).get(self.prepare_url('api/v3/ipv6/', kwargs))
[ "def", "search", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ApiIPv6", ",", "self", ")", ".", "get", "(", "self", ".", "prepare_url", "(", "'api/v3/ipv6/'", ",", "kwargs", ")", ")" ]
Method to search ipv6's based on extends search. :param search: Dict containing QuerySets to find ipv6's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv6's
[ "Method", "to", "search", "ipv6", "s", "based", "on", "extends", "search", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv6.py#L36-L49
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv6.py
ApiIPv6.delete
def delete(self, ids): """ Method to delete ipv6's by their ids :param ids: Identifiers of ipv6's :return: None """ url = build_uri_with_ids('api/v3/ipv6/%s/', ids) return super(ApiIPv6, self).delete(url)
python
def delete(self, ids): """ Method to delete ipv6's by their ids :param ids: Identifiers of ipv6's :return: None """ url = build_uri_with_ids('api/v3/ipv6/%s/', ids) return super(ApiIPv6, self).delete(url)
[ "def", "delete", "(", "self", ",", "ids", ")", ":", "url", "=", "build_uri_with_ids", "(", "'api/v3/ipv6/%s/'", ",", "ids", ")", "return", "super", "(", "ApiIPv6", ",", "self", ")", ".", "delete", "(", "url", ")" ]
Method to delete ipv6's by their ids :param ids: Identifiers of ipv6's :return: None
[ "Method", "to", "delete", "ipv6", "s", "by", "their", "ids" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv6.py#L65-L73
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv6.py
ApiIPv6.update
def update(self, ipv6s): """ Method to update ipv6's :param ipv6s: List containing ipv6's desired to updated :return: None """ data = {'ips': ipv6s} ipv6s_ids = [str(ipv6.get('id')) for ipv6 in ipv6s] return super(ApiIPv6, self).put('api/v3/ipv6/%s/' % ';'.join(ipv6s_ids), data)
python
def update(self, ipv6s): """ Method to update ipv6's :param ipv6s: List containing ipv6's desired to updated :return: None """ data = {'ips': ipv6s} ipv6s_ids = [str(ipv6.get('id')) for ipv6 in ipv6s] return super(ApiIPv6, self).put('api/v3/ipv6/%s/' % ';'.join(ipv6s_ids), data)
[ "def", "update", "(", "self", ",", "ipv6s", ")", ":", "data", "=", "{", "'ips'", ":", "ipv6s", "}", "ipv6s_ids", "=", "[", "str", "(", "ipv6", ".", "get", "(", "'id'", ")", ")", "for", "ipv6", "in", "ipv6s", "]", "return", "super", "(", "ApiIPv6", ",", "self", ")", ".", "put", "(", "'api/v3/ipv6/%s/'", "%", "';'", ".", "join", "(", "ipv6s_ids", ")", ",", "data", ")" ]
Method to update ipv6's :param ipv6s: List containing ipv6's desired to updated :return: None
[ "Method", "to", "update", "ipv6", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv6.py#L75-L87
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv6.py
ApiIPv6.create
def create(self, ipv6s): """ Method to create ipv6's :param ipv6s: List containing vrf desired to be created on database :return: None """ data = {'ips': ipv6s} return super(ApiIPv6, self).post('api/v3/ipv6/', data)
python
def create(self, ipv6s): """ Method to create ipv6's :param ipv6s: List containing vrf desired to be created on database :return: None """ data = {'ips': ipv6s} return super(ApiIPv6, self).post('api/v3/ipv6/', data)
[ "def", "create", "(", "self", ",", "ipv6s", ")", ":", "data", "=", "{", "'ips'", ":", "ipv6s", "}", "return", "super", "(", "ApiIPv6", ",", "self", ")", ".", "post", "(", "'api/v3/ipv6/'", ",", "data", ")" ]
Method to create ipv6's :param ipv6s: List containing vrf desired to be created on database :return: None
[ "Method", "to", "create", "ipv6", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv6.py#L89-L98
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv4.py
ApiIPv4.search
def search(self, **kwargs): """ Method to search ipv4's based on extends search. :param search: Dict containing QuerySets to find ipv4's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv4's """ return super(ApiIPv4, self).get(self.prepare_url('api/v3/ipv4/', kwargs))
python
def search(self, **kwargs): """ Method to search ipv4's based on extends search. :param search: Dict containing QuerySets to find ipv4's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv4's """ return super(ApiIPv4, self).get(self.prepare_url('api/v3/ipv4/', kwargs))
[ "def", "search", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ApiIPv4", ",", "self", ")", ".", "get", "(", "self", ".", "prepare_url", "(", "'api/v3/ipv4/'", ",", "kwargs", ")", ")" ]
Method to search ipv4's based on extends search. :param search: Dict containing QuerySets to find ipv4's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv4's
[ "Method", "to", "search", "ipv4", "s", "based", "on", "extends", "search", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv4.py#L36-L49
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv4.py
ApiIPv4.delete
def delete(self, ids): """ Method to delete ipv4's by their ids :param ids: Identifiers of ipv4's :return: None """ url = build_uri_with_ids('api/v3/ipv4/%s/', ids) return super(ApiIPv4, self).delete(url)
python
def delete(self, ids): """ Method to delete ipv4's by their ids :param ids: Identifiers of ipv4's :return: None """ url = build_uri_with_ids('api/v3/ipv4/%s/', ids) return super(ApiIPv4, self).delete(url)
[ "def", "delete", "(", "self", ",", "ids", ")", ":", "url", "=", "build_uri_with_ids", "(", "'api/v3/ipv4/%s/'", ",", "ids", ")", "return", "super", "(", "ApiIPv4", ",", "self", ")", ".", "delete", "(", "url", ")" ]
Method to delete ipv4's by their ids :param ids: Identifiers of ipv4's :return: None
[ "Method", "to", "delete", "ipv4", "s", "by", "their", "ids" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv4.py#L66-L75
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv4.py
ApiIPv4.update
def update(self, ipv4s): """ Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None """ data = {'ips': ipv4s} ipv4s_ids = [str(ipv4.get('id')) for ipv4 in ipv4s] return super(ApiIPv4, self).put('api/v3/ipv4/%s/' % ';'.join(ipv4s_ids), data)
python
def update(self, ipv4s): """ Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None """ data = {'ips': ipv4s} ipv4s_ids = [str(ipv4.get('id')) for ipv4 in ipv4s] return super(ApiIPv4, self).put('api/v3/ipv4/%s/' % ';'.join(ipv4s_ids), data)
[ "def", "update", "(", "self", ",", "ipv4s", ")", ":", "data", "=", "{", "'ips'", ":", "ipv4s", "}", "ipv4s_ids", "=", "[", "str", "(", "ipv4", ".", "get", "(", "'id'", ")", ")", "for", "ipv4", "in", "ipv4s", "]", "return", "super", "(", "ApiIPv4", ",", "self", ")", ".", "put", "(", "'api/v3/ipv4/%s/'", "%", "';'", ".", "join", "(", "ipv4s_ids", ")", ",", "data", ")" ]
Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None
[ "Method", "to", "update", "ipv4", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv4.py#L77-L89
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiIPv4.py
ApiIPv4.create
def create(self, ipv4s): """ Method to create ipv4's :param ipv4s: List containing ipv4's desired to be created on database :return: None """ data = {'ips': ipv4s} return super(ApiIPv4, self).post('api/v3/ipv4/', data)
python
def create(self, ipv4s): """ Method to create ipv4's :param ipv4s: List containing ipv4's desired to be created on database :return: None """ data = {'ips': ipv4s} return super(ApiIPv4, self).post('api/v3/ipv4/', data)
[ "def", "create", "(", "self", ",", "ipv4s", ")", ":", "data", "=", "{", "'ips'", ":", "ipv4s", "}", "return", "super", "(", "ApiIPv4", ",", "self", ")", ".", "post", "(", "'api/v3/ipv4/'", ",", "data", ")" ]
Method to create ipv4's :param ipv4s: List containing ipv4's desired to be created on database :return: None
[ "Method", "to", "create", "ipv4", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiIPv4.py#L91-L100
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiObjectGroupPermissionGeneral.py
ApiObjectGroupPermissionGeneral.search
def search(self, **kwargs): """ Method to search object group permissions general based on extends search. :param search: Dict containing QuerySets to find object group permissions general. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing object group permissions general """ return super(ApiObjectGroupPermissionGeneral, self).get(self.prepare_url('api/v3/object-group-perm-general/', kwargs))
python
def search(self, **kwargs): """ Method to search object group permissions general based on extends search. :param search: Dict containing QuerySets to find object group permissions general. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing object group permissions general """ return super(ApiObjectGroupPermissionGeneral, self).get(self.prepare_url('api/v3/object-group-perm-general/', kwargs))
[ "def", "search", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ApiObjectGroupPermissionGeneral", ",", "self", ")", ".", "get", "(", "self", ".", "prepare_url", "(", "'api/v3/object-group-perm-general/'", ",", "kwargs", ")", ")" ]
Method to search object group permissions general based on extends search. :param search: Dict containing QuerySets to find object group permissions general. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing object group permissions general
[ "Method", "to", "search", "object", "group", "permissions", "general", "based", "on", "extends", "search", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiObjectGroupPermissionGeneral.py#L36-L49
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiObjectGroupPermissionGeneral.py
ApiObjectGroupPermissionGeneral.delete
def delete(self, ids): """ Method to delete object group permissions general by their ids :param ids: Identifiers of object group permissions general :return: None """ url = build_uri_with_ids('api/v3/object-group-perm-general/%s/', ids) return super(ApiObjectGroupPermissionGeneral, self).delete(url)
python
def delete(self, ids): """ Method to delete object group permissions general by their ids :param ids: Identifiers of object group permissions general :return: None """ url = build_uri_with_ids('api/v3/object-group-perm-general/%s/', ids) return super(ApiObjectGroupPermissionGeneral, self).delete(url)
[ "def", "delete", "(", "self", ",", "ids", ")", ":", "url", "=", "build_uri_with_ids", "(", "'api/v3/object-group-perm-general/%s/'", ",", "ids", ")", "return", "super", "(", "ApiObjectGroupPermissionGeneral", ",", "self", ")", ".", "delete", "(", "url", ")" ]
Method to delete object group permissions general by their ids :param ids: Identifiers of object group permissions general :return: None
[ "Method", "to", "delete", "object", "group", "permissions", "general", "by", "their", "ids" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiObjectGroupPermissionGeneral.py#L65-L73
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiObjectGroupPermissionGeneral.py
ApiObjectGroupPermissionGeneral.update
def update(self, ogpgs): """ Method to update object group permissions general :param ogpgs: List containing object group permissions general desired to updated :return: None """ data = {'ogpgs': ogpgs} ogpgs_ids = [str(ogpg.get('id')) for ogpg in ogpgs] return super(ApiObjectGroupPermissionGeneral, self).put('api/v3/object-group-perm-general/%s/' % ';'.join(ogpgs_ids), data)
python
def update(self, ogpgs): """ Method to update object group permissions general :param ogpgs: List containing object group permissions general desired to updated :return: None """ data = {'ogpgs': ogpgs} ogpgs_ids = [str(ogpg.get('id')) for ogpg in ogpgs] return super(ApiObjectGroupPermissionGeneral, self).put('api/v3/object-group-perm-general/%s/' % ';'.join(ogpgs_ids), data)
[ "def", "update", "(", "self", ",", "ogpgs", ")", ":", "data", "=", "{", "'ogpgs'", ":", "ogpgs", "}", "ogpgs_ids", "=", "[", "str", "(", "ogpg", ".", "get", "(", "'id'", ")", ")", "for", "ogpg", "in", "ogpgs", "]", "return", "super", "(", "ApiObjectGroupPermissionGeneral", ",", "self", ")", ".", "put", "(", "'api/v3/object-group-perm-general/%s/'", "%", "';'", ".", "join", "(", "ogpgs_ids", ")", ",", "data", ")" ]
Method to update object group permissions general :param ogpgs: List containing object group permissions general desired to updated :return: None
[ "Method", "to", "update", "object", "group", "permissions", "general" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiObjectGroupPermissionGeneral.py#L75-L87
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiObjectGroupPermissionGeneral.py
ApiObjectGroupPermissionGeneral.create
def create(self, ogpgs): """ Method to create object group permissions general :param ogpgs: List containing vrf desired to be created on database :return: None """ data = {'ogpgs': ogpgs} return super(ApiObjectGroupPermissionGeneral, self).post('api/v3/object-group-perm-general/', data)
python
def create(self, ogpgs): """ Method to create object group permissions general :param ogpgs: List containing vrf desired to be created on database :return: None """ data = {'ogpgs': ogpgs} return super(ApiObjectGroupPermissionGeneral, self).post('api/v3/object-group-perm-general/', data)
[ "def", "create", "(", "self", ",", "ogpgs", ")", ":", "data", "=", "{", "'ogpgs'", ":", "ogpgs", "}", "return", "super", "(", "ApiObjectGroupPermissionGeneral", ",", "self", ")", ".", "post", "(", "'api/v3/object-group-perm-general/'", ",", "data", ")" ]
Method to create object group permissions general :param ogpgs: List containing vrf desired to be created on database :return: None
[ "Method", "to", "create", "object", "group", "permissions", "general" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiObjectGroupPermissionGeneral.py#L89-L98
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4IPv6.py
ApiV4IPv6.search
def search(self, **kwargs): """ Method to search ipv6's based on extends search. :param search: Dict containing QuerySets to find ipv6's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv6's """ return super(ApiV4IPv6, self).get(self.prepare_url('api/v4/ipv6/', kwargs))
python
def search(self, **kwargs): """ Method to search ipv6's based on extends search. :param search: Dict containing QuerySets to find ipv6's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv6's """ return super(ApiV4IPv6, self).get(self.prepare_url('api/v4/ipv6/', kwargs))
[ "def", "search", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ApiV4IPv6", ",", "self", ")", ".", "get", "(", "self", ".", "prepare_url", "(", "'api/v4/ipv6/'", ",", "kwargs", ")", ")" ]
Method to search ipv6's based on extends search. :param search: Dict containing QuerySets to find ipv6's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv6's
[ "Method", "to", "search", "ipv6", "s", "based", "on", "extends", "search", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4IPv6.py#L36-L49
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4IPv6.py
ApiV4IPv6.delete
def delete(self, ids): """ Method to delete ipv6's by their ids :param ids: Identifiers of ipv6's :return: None """ url = build_uri_with_ids('api/v4/ipv6/%s/', ids) return super(ApiV4IPv6, self).delete(url)
python
def delete(self, ids): """ Method to delete ipv6's by their ids :param ids: Identifiers of ipv6's :return: None """ url = build_uri_with_ids('api/v4/ipv6/%s/', ids) return super(ApiV4IPv6, self).delete(url)
[ "def", "delete", "(", "self", ",", "ids", ")", ":", "url", "=", "build_uri_with_ids", "(", "'api/v4/ipv6/%s/'", ",", "ids", ")", "return", "super", "(", "ApiV4IPv6", ",", "self", ")", ".", "delete", "(", "url", ")" ]
Method to delete ipv6's by their ids :param ids: Identifiers of ipv6's :return: None
[ "Method", "to", "delete", "ipv6", "s", "by", "their", "ids" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4IPv6.py#L65-L73
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4IPv6.py
ApiV4IPv6.create
def create(self, ipv6s): """ Method to create ipv6's :param ipv6s: List containing vrf desired to be created on database :return: None """ data = {'ips': ipv6s} return super(ApiV4IPv6, self).post('api/v4/ipv6/', data)
python
def create(self, ipv6s): """ Method to create ipv6's :param ipv6s: List containing vrf desired to be created on database :return: None """ data = {'ips': ipv6s} return super(ApiV4IPv6, self).post('api/v4/ipv6/', data)
[ "def", "create", "(", "self", ",", "ipv6s", ")", ":", "data", "=", "{", "'ips'", ":", "ipv6s", "}", "return", "super", "(", "ApiV4IPv6", ",", "self", ")", ".", "post", "(", "'api/v4/ipv6/'", ",", "data", ")" ]
Method to create ipv6's :param ipv6s: List containing vrf desired to be created on database :return: None
[ "Method", "to", "create", "ipv6", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4IPv6.py#L89-L98
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.add
def add(self, tipo_opcao, nome_opcao_txt): """Inserts a new Option VIP and returns its identifier. :param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param nome_opcao_txt: Name Option. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: Following dictionary: :: {'option_vip': {'id': < id >}} :raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ optionvip_map = dict() optionvip_map['tipo_opcao'] = tipo_opcao optionvip_map['nome_opcao_txt'] = nome_opcao_txt code, xml = self.submit( {'option_vip': optionvip_map}, 'POST', 'optionvip/') return self.response(code, xml)
python
def add(self, tipo_opcao, nome_opcao_txt): """Inserts a new Option VIP and returns its identifier. :param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param nome_opcao_txt: Name Option. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: Following dictionary: :: {'option_vip': {'id': < id >}} :raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ optionvip_map = dict() optionvip_map['tipo_opcao'] = tipo_opcao optionvip_map['nome_opcao_txt'] = nome_opcao_txt code, xml = self.submit( {'option_vip': optionvip_map}, 'POST', 'optionvip/') return self.response(code, xml)
[ "def", "add", "(", "self", ",", "tipo_opcao", ",", "nome_opcao_txt", ")", ":", "optionvip_map", "=", "dict", "(", ")", "optionvip_map", "[", "'tipo_opcao'", "]", "=", "tipo_opcao", "optionvip_map", "[", "'nome_opcao_txt'", "]", "=", "nome_opcao_txt", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'option_vip'", ":", "optionvip_map", "}", ",", "'POST'", ",", "'optionvip/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Inserts a new Option VIP and returns its identifier. :param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param nome_opcao_txt: Name Option. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: Following dictionary: :: {'option_vip': {'id': < id >}} :raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Inserts", "a", "new", "Option", "VIP", "and", "returns", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L38-L61
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.alter
def alter(self, id_option_vip, tipo_opcao, nome_opcao_txt): """Change Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param nome_opcao_txt: Name Option. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: None :raise InvalidParameterError: Option VIP identifier is null and invalid. :raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid. :raise OptionVipNotFoundError: Option VIP 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_option_vip): raise InvalidParameterError( u'The identifier of Option VIP is invalid or was not informed.') optionvip_map = dict() optionvip_map['tipo_opcao'] = tipo_opcao optionvip_map['nome_opcao_txt'] = nome_opcao_txt url = 'optionvip/' + str(id_option_vip) + '/' code, xml = self.submit({'option_vip': optionvip_map}, 'PUT', url) return self.response(code, xml)
python
def alter(self, id_option_vip, tipo_opcao, nome_opcao_txt): """Change Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param nome_opcao_txt: Name Option. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: None :raise InvalidParameterError: Option VIP identifier is null and invalid. :raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid. :raise OptionVipNotFoundError: Option VIP 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_option_vip): raise InvalidParameterError( u'The identifier of Option VIP is invalid or was not informed.') optionvip_map = dict() optionvip_map['tipo_opcao'] = tipo_opcao optionvip_map['nome_opcao_txt'] = nome_opcao_txt url = 'optionvip/' + str(id_option_vip) + '/' code, xml = self.submit({'option_vip': optionvip_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alter", "(", "self", ",", "id_option_vip", ",", "tipo_opcao", ",", "nome_opcao_txt", ")", ":", "if", "not", "is_valid_int_param", "(", "id_option_vip", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Option VIP is invalid or was not informed.'", ")", "optionvip_map", "=", "dict", "(", ")", "optionvip_map", "[", "'tipo_opcao'", "]", "=", "tipo_opcao", "optionvip_map", "[", "'nome_opcao_txt'", "]", "=", "nome_opcao_txt", "url", "=", "'optionvip/'", "+", "str", "(", "id_option_vip", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'option_vip'", ":", "optionvip_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param nome_opcao_txt: Name Option. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: None :raise InvalidParameterError: Option VIP identifier is null and invalid. :raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid. :raise OptionVipNotFoundError: Option VIP not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Change", "Option", "VIP", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L63-L91
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.remove
def remove(self, id_option_vip): """Remove Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :return: None :raise InvalidParameterError: Option VIP identifier is null and invalid. :raise OptionVipNotFoundError: Option VIP not registered. :raise OptionVipError: Option VIP associated with environment vip. :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.') url = 'optionvip/' + str(id_option_vip) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remove(self, id_option_vip): """Remove Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :return: None :raise InvalidParameterError: Option VIP identifier is null and invalid. :raise OptionVipNotFoundError: Option VIP not registered. :raise OptionVipError: Option VIP associated with environment vip. :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.') url = 'optionvip/' + str(id_option_vip) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remove", "(", "self", ",", "id_option_vip", ")", ":", "if", "not", "is_valid_int_param", "(", "id_option_vip", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Option VIP is invalid or was not informed.'", ")", "url", "=", "'optionvip/'", "+", "str", "(", "id_option_vip", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :return: None :raise InvalidParameterError: Option VIP identifier is null and invalid. :raise OptionVipNotFoundError: Option VIP not registered. :raise OptionVipError: Option VIP associated with environment vip. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Remove", "Option", "VIP", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L93-L115
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.get_option_vip
def get_option_vip(self, id_environment_vip): """Get all Option VIP by Environment Vip. :return: Dictionary with the following structure: :: {‘option_vip’: [{‘id’: < id >, ‘tipo_opcao’: < tipo_opcao >, ‘nome_opcao_txt’: < nome_opcao_txt >}, ... too option vips ...] } :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise DataBaseError: Can't connect to networkapi database. :raise XMLError: Failed to generate the XML response. """ url = 'optionvip/environmentvip/' + str(id_environment_vip) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml, ['option_vip'])
python
def get_option_vip(self, id_environment_vip): """Get all Option VIP by Environment Vip. :return: Dictionary with the following structure: :: {‘option_vip’: [{‘id’: < id >, ‘tipo_opcao’: < tipo_opcao >, ‘nome_opcao_txt’: < nome_opcao_txt >}, ... too option vips ...] } :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise DataBaseError: Can't connect to networkapi database. :raise XMLError: Failed to generate the XML response. """ url = 'optionvip/environmentvip/' + str(id_environment_vip) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml, ['option_vip'])
[ "def", "get_option_vip", "(", "self", ",", "id_environment_vip", ")", ":", "url", "=", "'optionvip/environmentvip/'", "+", "str", "(", "id_environment_vip", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ",", "[", "'option_vip'", "]", ")" ]
Get all Option VIP by Environment Vip. :return: Dictionary with the following structure: :: {‘option_vip’: [{‘id’: < id >, ‘tipo_opcao’: < tipo_opcao >, ‘nome_opcao_txt’: < nome_opcao_txt >}, ... too option vips ...] } :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise DataBaseError: Can't connect to networkapi database. :raise XMLError: Failed to generate the XML response.
[ "Get", "all", "Option", "VIP", "by", "Environment", "Vip", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L168-L188
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.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)
python
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)
[ "def", "associate", "(", "self", ",", "id_option_vip", ",", "id_environment_vip", ")", ":", "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", ")" ]
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.
[ "Create", "a", "relationship", "of", "OptionVip", "with", "EnvironmentVip", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L190-L224
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.buscar_timeout_opcvip
def buscar_timeout_opcvip(self, id_ambiente_vip): """Buscar nome_opcao_txt das Opcoes VIp quando tipo_opcao = 'Timeout' pelo environmentvip_id :return: Dictionary with the following structure: :: {‘timeout_opt’: ‘timeout_opt’: <'nome_opcao_txt'>} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and 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_ambiente_vip): raise InvalidParameterError( u'The identifier of environment-vip is invalid or was not informed.') url = 'environment-vip/get/timeout/' + str(id_ambiente_vip) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def buscar_timeout_opcvip(self, id_ambiente_vip): """Buscar nome_opcao_txt das Opcoes VIp quando tipo_opcao = 'Timeout' pelo environmentvip_id :return: Dictionary with the following structure: :: {‘timeout_opt’: ‘timeout_opt’: <'nome_opcao_txt'>} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and 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_ambiente_vip): raise InvalidParameterError( u'The identifier of environment-vip is invalid or was not informed.') url = 'environment-vip/get/timeout/' + str(id_ambiente_vip) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "buscar_timeout_opcvip", "(", "self", ",", "id_ambiente_vip", ")", ":", "if", "not", "is_valid_int_param", "(", "id_ambiente_vip", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of environment-vip is invalid or was not informed.'", ")", "url", "=", "'environment-vip/get/timeout/'", "+", "str", "(", "id_ambiente_vip", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Buscar nome_opcao_txt das Opcoes VIp quando tipo_opcao = 'Timeout' pelo environmentvip_id :return: Dictionary with the following structure: :: {‘timeout_opt’: ‘timeout_opt’: <'nome_opcao_txt'>} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Buscar", "nome_opcao_txt", "das", "Opcoes", "VIp", "quando", "tipo_opcao", "=", "Timeout", "pelo", "environmentvip_id" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L258-L281
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.buscar_rules
def buscar_rules(self, id_ambiente_vip, id_vip=''): """Search rules ​by environmentvip_id :return: Dictionary with the following structure: :: {'name_rule_opt': [{'name_rule_opt': <name>, 'id': <id>}, ...]} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'environment-vip/get/rules/' + \ str(id_ambiente_vip) + '/' + str(id_vip) code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def buscar_rules(self, id_ambiente_vip, id_vip=''): """Search rules ​by environmentvip_id :return: Dictionary with the following structure: :: {'name_rule_opt': [{'name_rule_opt': <name>, 'id': <id>}, ...]} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'environment-vip/get/rules/' + \ str(id_ambiente_vip) + '/' + str(id_vip) code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "buscar_rules", "(", "self", ",", "id_ambiente_vip", ",", "id_vip", "=", "''", ")", ":", "url", "=", "'environment-vip/get/rules/'", "+", "str", "(", "id_ambiente_vip", ")", "+", "'/'", "+", "str", "(", "id_vip", ")", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Search rules ​by environmentvip_id :return: Dictionary with the following structure: :: {'name_rule_opt': [{'name_rule_opt': <name>, 'id': <id>}, ...]} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Search", "rules", "​by", "environmentvip_id" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L364-L385
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.buscar_healthchecks
def buscar_healthchecks(self, id_ambiente_vip): """Search healthcheck ​by environmentvip_id :return: Dictionary with the following structure: :: {'healthcheck_opt': [{'name': <name>, 'id': <id>},...]} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: id_ambiente_vip is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'environment-vip/get/healthcheck/' + str(id_ambiente_vip) code, xml = self.submit(None, 'GET', url) return self.response(code, xml, ['healthcheck_opt'])
python
def buscar_healthchecks(self, id_ambiente_vip): """Search healthcheck ​by environmentvip_id :return: Dictionary with the following structure: :: {'healthcheck_opt': [{'name': <name>, 'id': <id>},...]} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: id_ambiente_vip is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'environment-vip/get/healthcheck/' + str(id_ambiente_vip) code, xml = self.submit(None, 'GET', url) return self.response(code, xml, ['healthcheck_opt'])
[ "def", "buscar_healthchecks", "(", "self", ",", "id_ambiente_vip", ")", ":", "url", "=", "'environment-vip/get/healthcheck/'", "+", "str", "(", "id_ambiente_vip", ")", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ",", "[", "'healthcheck_opt'", "]", ")" ]
Search healthcheck ​by environmentvip_id :return: Dictionary with the following structure: :: {'healthcheck_opt': [{'name': <name>, 'id': <id>},...]} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: id_ambiente_vip is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Search", "healthcheck", "​by", "environmentvip_id" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L387-L407
globocom/GloboNetworkAPI-client-python
networkapiclient/OptionVIP.py
OptionVIP.buscar_idtrafficreturn_opcvip
def buscar_idtrafficreturn_opcvip(self, nome_opcao_txt): """Search id of Option VIP when tipo_opcao = 'Retorno de trafego' ​​ :return: Dictionary with the following structure: :: {‘trafficreturn_opt’: ‘trafficreturn_opt’: <'id'>} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ trafficreturn_map = dict() trafficreturn_map['trafficreturn'] = nome_opcao_txt url = 'optionvip/trafficreturn/search/' code, xml = self.submit({'trafficreturn_opt':trafficreturn_map }, 'POST', url) return self.response(code, xml)
python
def buscar_idtrafficreturn_opcvip(self, nome_opcao_txt): """Search id of Option VIP when tipo_opcao = 'Retorno de trafego' ​​ :return: Dictionary with the following structure: :: {‘trafficreturn_opt’: ‘trafficreturn_opt’: <'id'>} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ trafficreturn_map = dict() trafficreturn_map['trafficreturn'] = nome_opcao_txt url = 'optionvip/trafficreturn/search/' code, xml = self.submit({'trafficreturn_opt':trafficreturn_map }, 'POST', url) return self.response(code, xml)
[ "def", "buscar_idtrafficreturn_opcvip", "(", "self", ",", "nome_opcao_txt", ")", ":", "trafficreturn_map", "=", "dict", "(", ")", "trafficreturn_map", "[", "'trafficreturn'", "]", "=", "nome_opcao_txt", "url", "=", "'optionvip/trafficreturn/search/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'trafficreturn_opt'", ":", "trafficreturn_map", "}", ",", "'POST'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Search id of Option VIP when tipo_opcao = 'Retorno de trafego' ​​ :return: Dictionary with the following structure: :: {‘trafficreturn_opt’: ‘trafficreturn_opt’: <'id'>} :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Search", "id", "of", "Option", "VIP", "when", "tipo_opcao", "=", "Retorno", "de", "trafego", "​​" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionVIP.py#L436-L459
globocom/GloboNetworkAPI-client-python
networkapiclient/Modelo.py
Modelo.listar_por_marca
def listar_por_marca(self, id_brand): """List all Model by Brand. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :return: Dictionary with the following structure: :: {‘model’: [{‘id’: < id >, ‘nome’: < nome >, ‘id_marca’: < id_marca >}, ... too Model ...]} :raise InvalidParameterError: The identifier of Brand is null and invalid. :raise MarcaNaoExisteError: Brand 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_brand): raise InvalidParameterError( u'The identifier of Brand is invalid or was not informed.') url = 'model/brand/' + str(id_brand) + '/' code, map = self.submit(None, 'GET', url) key = 'model' return get_list_map(self.response(code, map, [key]), key)
python
def listar_por_marca(self, id_brand): """List all Model by Brand. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :return: Dictionary with the following structure: :: {‘model’: [{‘id’: < id >, ‘nome’: < nome >, ‘id_marca’: < id_marca >}, ... too Model ...]} :raise InvalidParameterError: The identifier of Brand is null and invalid. :raise MarcaNaoExisteError: Brand 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_brand): raise InvalidParameterError( u'The identifier of Brand is invalid or was not informed.') url = 'model/brand/' + str(id_brand) + '/' code, map = self.submit(None, 'GET', url) key = 'model' return get_list_map(self.response(code, map, [key]), key)
[ "def", "listar_por_marca", "(", "self", ",", "id_brand", ")", ":", "if", "not", "is_valid_int_param", "(", "id_brand", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Brand is invalid or was not informed.'", ")", "url", "=", "'model/brand/'", "+", "str", "(", "id_brand", ")", "+", "'/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "key", "=", "'model'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List all Model by Brand. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :return: Dictionary with the following structure: :: {‘model’: [{‘id’: < id >, ‘nome’: < nome >, ‘id_marca’: < id_marca >}, ... too Model ...]} :raise InvalidParameterError: The identifier of Brand is null and invalid. :raise MarcaNaoExisteError: Brand not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response
[ "List", "all", "Model", "by", "Brand", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Modelo.py#L32-L60
globocom/GloboNetworkAPI-client-python
networkapiclient/Modelo.py
Modelo.inserir
def inserir(self, id_brand, name): """Inserts a new Model and returns its identifier :param id_brand: Identifier of the Brand. Integer value and greater than zero. :param name: Model name. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'model': {'id': < id_model >}} :raise InvalidParameterError: The identifier of Brand or name is null and invalid. :raise NomeMarcaModeloDuplicadoError: There is already a registered Model with the value of name and brand. :raise MarcaNaoExisteError: Brand not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ model_map = dict() model_map['name'] = name model_map['id_brand'] = id_brand code, xml = self.submit({'model': model_map}, 'POST', 'model/') return self.response(code, xml)
python
def inserir(self, id_brand, name): """Inserts a new Model and returns its identifier :param id_brand: Identifier of the Brand. Integer value and greater than zero. :param name: Model name. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'model': {'id': < id_model >}} :raise InvalidParameterError: The identifier of Brand or name is null and invalid. :raise NomeMarcaModeloDuplicadoError: There is already a registered Model with the value of name and brand. :raise MarcaNaoExisteError: Brand not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ model_map = dict() model_map['name'] = name model_map['id_brand'] = id_brand code, xml = self.submit({'model': model_map}, 'POST', 'model/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "id_brand", ",", "name", ")", ":", "model_map", "=", "dict", "(", ")", "model_map", "[", "'name'", "]", "=", "name", "model_map", "[", "'id_brand'", "]", "=", "id_brand", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'model'", ":", "model_map", "}", ",", "'POST'", ",", "'model/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Inserts a new Model and returns its identifier :param id_brand: Identifier of the Brand. Integer value and greater than zero. :param name: Model name. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'model': {'id': < id_model >}} :raise InvalidParameterError: The identifier of Brand or name is null and invalid. :raise NomeMarcaModeloDuplicadoError: There is already a registered Model with the value of name and brand. :raise MarcaNaoExisteError: Brand not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response
[ "Inserts", "a", "new", "Model", "and", "returns", "its", "identifier" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Modelo.py#L95-L119
globocom/GloboNetworkAPI-client-python
networkapiclient/Modelo.py
Modelo.alterar
def alterar(self, id_model, id_brand, name): """Change Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :param name: Model name. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Model, Brand or name is null and invalid. :raise MarcaNaoExisteError: Brand not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise NomeMarcaModeloDuplicadoError: There is already a registered Model with the value of name and brand. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ if not is_valid_int_param(id_model): raise InvalidParameterError( u'The identifier of Model is invalid or was not informed.') model_map = dict() model_map['name'] = name model_map['id_brand'] = id_brand url = 'model/' + str(id_model) + '/' code, xml = self.submit({'model': model_map}, 'PUT', url) return self.response(code, xml)
python
def alterar(self, id_model, id_brand, name): """Change Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :param name: Model name. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Model, Brand or name is null and invalid. :raise MarcaNaoExisteError: Brand not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise NomeMarcaModeloDuplicadoError: There is already a registered Model with the value of name and brand. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ if not is_valid_int_param(id_model): raise InvalidParameterError( u'The identifier of Model is invalid or was not informed.') model_map = dict() model_map['name'] = name model_map['id_brand'] = id_brand url = 'model/' + str(id_model) + '/' code, xml = self.submit({'model': model_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alterar", "(", "self", ",", "id_model", ",", "id_brand", ",", "name", ")", ":", "if", "not", "is_valid_int_param", "(", "id_model", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Model is invalid or was not informed.'", ")", "model_map", "=", "dict", "(", ")", "model_map", "[", "'name'", "]", "=", "name", "model_map", "[", "'id_brand'", "]", "=", "id_brand", "url", "=", "'model/'", "+", "str", "(", "id_model", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'model'", ":", "model_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :param name: Model name. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Model, Brand or name is null and invalid. :raise MarcaNaoExisteError: Brand not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise NomeMarcaModeloDuplicadoError: There is already a registered Model with the value of name and brand. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response
[ "Change", "Model", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Modelo.py#L121-L150
globocom/GloboNetworkAPI-client-python
networkapiclient/Modelo.py
Modelo.remover
def remover(self, id_model): """Remove Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Model is null and invalid. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise ModeloEquipamentoError: The Model is associated with a equipment. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ if not is_valid_int_param(id_model): raise InvalidParameterError( u'The identifier of Model is invalid or was not informed.') url = 'model/' + str(id_model) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remover(self, id_model): """Remove Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Model is null and invalid. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise ModeloEquipamentoError: The Model is associated with a equipment. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ if not is_valid_int_param(id_model): raise InvalidParameterError( u'The identifier of Model is invalid or was not informed.') url = 'model/' + str(id_model) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remover", "(", "self", ",", "id_model", ")", ":", "if", "not", "is_valid_int_param", "(", "id_model", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Model is invalid or was not informed.'", ")", "url", "=", "'model/'", "+", "str", "(", "id_model", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Model is null and invalid. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise ModeloEquipamentoError: The Model is associated with a equipment. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response
[ "Remove", "Model", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Modelo.py#L152-L174
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.listar_por_equipamento
def listar_por_equipamento(self, id_equipamento): """List all interfaces of an equipment. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: :: {'interface': [{'protegida': < protegida >, 'nome': < nome >, 'id_ligacao_front': < id_ligacao_front >, 'id_equipamento': < id_equipamento >, 'id': < id >, 'descricao': < descricao >, 'id_ligacao_back': < id_ligacao_back >}, ... other interfaces ...]} :raise InvalidParameterError: Equipment identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_equipamento): raise InvalidParameterError( u'Equipment id is invalid or was not informed.') url = 'interface/equipamento/' + str(id_equipamento) + '/' code, map = self.submit(None, 'GET', url) key = 'interface' return get_list_map(self.response(code, map, [key]), key)
python
def listar_por_equipamento(self, id_equipamento): """List all interfaces of an equipment. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: :: {'interface': [{'protegida': < protegida >, 'nome': < nome >, 'id_ligacao_front': < id_ligacao_front >, 'id_equipamento': < id_equipamento >, 'id': < id >, 'descricao': < descricao >, 'id_ligacao_back': < id_ligacao_back >}, ... other interfaces ...]} :raise InvalidParameterError: Equipment identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_equipamento): raise InvalidParameterError( u'Equipment id is invalid or was not informed.') url = 'interface/equipamento/' + str(id_equipamento) + '/' code, map = self.submit(None, 'GET', url) key = 'interface' return get_list_map(self.response(code, map, [key]), key)
[ "def", "listar_por_equipamento", "(", "self", ",", "id_equipamento", ")", ":", "if", "not", "is_valid_int_param", "(", "id_equipamento", ")", ":", "raise", "InvalidParameterError", "(", "u'Equipment id is invalid or was not informed.'", ")", "url", "=", "'interface/equipamento/'", "+", "str", "(", "id_equipamento", ")", "+", "'/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "key", "=", "'interface'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List all interfaces of an equipment. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: :: {'interface': [{'protegida': < protegida >, 'nome': < nome >, 'id_ligacao_front': < id_ligacao_front >, 'id_equipamento': < id_equipamento >, 'id': < id >, 'descricao': < descricao >, 'id_ligacao_back': < id_ligacao_back >}, ... other interfaces ...]} :raise InvalidParameterError: Equipment identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "all", "interfaces", "of", "an", "equipment", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L41-L72
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.get_by_id
def get_by_id(self, id_interface): """Get an interface by id. :param id_interface: Interface identifier. :return: Following dictionary: :: {'interface': {'id': < id >, 'interface': < interface >, 'descricao': < descricao >, 'protegida': < protegida >, 'tipo_equip': < id_tipo_equipamento >, 'equipamento': < id_equipamento >, 'equipamento_nome': < nome_equipamento > 'ligacao_front': < id_ligacao_front >, 'nome_ligacao_front': < interface_name >, 'nome_equip_l_front': < equipment_name >, 'ligacao_back': < id_ligacao_back >, 'nome_ligacao_back': < interface_name >, 'nome_equip_l_back': < equipment_name > }} :raise InvalidParameterError: Interface identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_interface): raise InvalidParameterError( u'Interface id is invalid or was not informed.') url = 'interface/' + str(id_interface) + '/get/' code, map = self.submit(None, 'GET', url) return self.response(code, map)
python
def get_by_id(self, id_interface): """Get an interface by id. :param id_interface: Interface identifier. :return: Following dictionary: :: {'interface': {'id': < id >, 'interface': < interface >, 'descricao': < descricao >, 'protegida': < protegida >, 'tipo_equip': < id_tipo_equipamento >, 'equipamento': < id_equipamento >, 'equipamento_nome': < nome_equipamento > 'ligacao_front': < id_ligacao_front >, 'nome_ligacao_front': < interface_name >, 'nome_equip_l_front': < equipment_name >, 'ligacao_back': < id_ligacao_back >, 'nome_ligacao_back': < interface_name >, 'nome_equip_l_back': < equipment_name > }} :raise InvalidParameterError: Interface identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_interface): raise InvalidParameterError( u'Interface id is invalid or was not informed.') url = 'interface/' + str(id_interface) + '/get/' code, map = self.submit(None, 'GET', url) return self.response(code, map)
[ "def", "get_by_id", "(", "self", ",", "id_interface", ")", ":", "if", "not", "is_valid_int_param", "(", "id_interface", ")", ":", "raise", "InvalidParameterError", "(", "u'Interface id is invalid or was not informed.'", ")", "url", "=", "'interface/'", "+", "str", "(", "id_interface", ")", "+", "'/get/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "map", ")" ]
Get an interface by id. :param id_interface: Interface identifier. :return: Following dictionary: :: {'interface': {'id': < id >, 'interface': < interface >, 'descricao': < descricao >, 'protegida': < protegida >, 'tipo_equip': < id_tipo_equipamento >, 'equipamento': < id_equipamento >, 'equipamento_nome': < nome_equipamento > 'ligacao_front': < id_ligacao_front >, 'nome_ligacao_front': < interface_name >, 'nome_equip_l_front': < equipment_name >, 'ligacao_back': < id_ligacao_back >, 'nome_ligacao_back': < interface_name >, 'nome_equip_l_back': < equipment_name > }} :raise InvalidParameterError: Interface identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Get", "an", "interface", "by", "id", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L112-L147
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.inserir
def inserir( self, nome, protegida, descricao, id_ligacao_front, id_ligacao_back, id_equipamento, tipo=None, vlan=None): """Insert new interface for an equipment. :param nome: Interface name. :param protegida: Indication of protected ('0' or '1'). :param descricao: Interface description. :param id_ligacao_front: Front end link interface identifier. :param id_ligacao_back: Back end link interface identifier. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: {'interface': {'id': < id >}} :raise EquipamentoNaoExisteError: Equipment does not exist. :raise InvalidParameterError: The parameters nome, protegida and/or equipment id are none or invalid. :raise NomeInterfaceDuplicadoParaEquipamentoError: There is already an interface with this name for this equipment. :raise InterfaceNaoExisteError: Front link interface and/or back link interface doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ interface_map = dict() interface_map['nome'] = nome interface_map['protegida'] = protegida interface_map['descricao'] = descricao interface_map['id_ligacao_front'] = id_ligacao_front interface_map['id_ligacao_back'] = id_ligacao_back interface_map['id_equipamento'] = id_equipamento interface_map['tipo'] = tipo interface_map['vlan'] = vlan code, xml = self.submit( {'interface': interface_map}, 'POST', 'interface/') return self.response(code, xml)
python
def inserir( self, nome, protegida, descricao, id_ligacao_front, id_ligacao_back, id_equipamento, tipo=None, vlan=None): """Insert new interface for an equipment. :param nome: Interface name. :param protegida: Indication of protected ('0' or '1'). :param descricao: Interface description. :param id_ligacao_front: Front end link interface identifier. :param id_ligacao_back: Back end link interface identifier. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: {'interface': {'id': < id >}} :raise EquipamentoNaoExisteError: Equipment does not exist. :raise InvalidParameterError: The parameters nome, protegida and/or equipment id are none or invalid. :raise NomeInterfaceDuplicadoParaEquipamentoError: There is already an interface with this name for this equipment. :raise InterfaceNaoExisteError: Front link interface and/or back link interface doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ interface_map = dict() interface_map['nome'] = nome interface_map['protegida'] = protegida interface_map['descricao'] = descricao interface_map['id_ligacao_front'] = id_ligacao_front interface_map['id_ligacao_back'] = id_ligacao_back interface_map['id_equipamento'] = id_equipamento interface_map['tipo'] = tipo interface_map['vlan'] = vlan code, xml = self.submit( {'interface': interface_map}, 'POST', 'interface/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "nome", ",", "protegida", ",", "descricao", ",", "id_ligacao_front", ",", "id_ligacao_back", ",", "id_equipamento", ",", "tipo", "=", "None", ",", "vlan", "=", "None", ")", ":", "interface_map", "=", "dict", "(", ")", "interface_map", "[", "'nome'", "]", "=", "nome", "interface_map", "[", "'protegida'", "]", "=", "protegida", "interface_map", "[", "'descricao'", "]", "=", "descricao", "interface_map", "[", "'id_ligacao_front'", "]", "=", "id_ligacao_front", "interface_map", "[", "'id_ligacao_back'", "]", "=", "id_ligacao_back", "interface_map", "[", "'id_equipamento'", "]", "=", "id_equipamento", "interface_map", "[", "'tipo'", "]", "=", "tipo", "interface_map", "[", "'vlan'", "]", "=", "vlan", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'interface'", ":", "interface_map", "}", ",", "'POST'", ",", "'interface/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Insert new interface for an equipment. :param nome: Interface name. :param protegida: Indication of protected ('0' or '1'). :param descricao: Interface description. :param id_ligacao_front: Front end link interface identifier. :param id_ligacao_back: Back end link interface identifier. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: {'interface': {'id': < id >}} :raise EquipamentoNaoExisteError: Equipment does not exist. :raise InvalidParameterError: The parameters nome, protegida and/or equipment id are none or invalid. :raise NomeInterfaceDuplicadoParaEquipamentoError: There is already an interface with this name for this equipment. :raise InterfaceNaoExisteError: Front link interface and/or back link interface doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Insert", "new", "interface", "for", "an", "equipment", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L149-L189
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.alterar
def alterar( self, id_interface, nome, protegida, descricao, id_ligacao_front, id_ligacao_back, tipo=None, vlan=None): """Edit an interface by its identifier. Equipment identifier is not changed. :param nome: Interface name. :param protegida: Indication of protected ('0' or '1'). :param descricao: Interface description. :param id_ligacao_front: Front end link interface identifier. :param id_ligacao_back: Back end link interface identifier. :param id_interface: Interface identifier. :return: None :raise InvalidParameterError: The parameters interface id, nome and protegida are none or invalid. :raise NomeInterfaceDuplicadoParaEquipamentoError: There is already an interface with this name for this equipment. :raise InterfaceNaoExisteError: Front link interface and/or back link interface doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_interface): raise InvalidParameterError( u'Interface id is invalid or was not informed.') url = 'interface/' + str(id_interface) + '/' interface_map = dict() interface_map['nome'] = nome interface_map['protegida'] = protegida interface_map['descricao'] = descricao interface_map['id_ligacao_front'] = id_ligacao_front interface_map['id_ligacao_back'] = id_ligacao_back interface_map['tipo'] = tipo interface_map['vlan'] = vlan code, xml = self.submit({'interface': interface_map}, 'PUT', url) return self.response(code, xml)
python
def alterar( self, id_interface, nome, protegida, descricao, id_ligacao_front, id_ligacao_back, tipo=None, vlan=None): """Edit an interface by its identifier. Equipment identifier is not changed. :param nome: Interface name. :param protegida: Indication of protected ('0' or '1'). :param descricao: Interface description. :param id_ligacao_front: Front end link interface identifier. :param id_ligacao_back: Back end link interface identifier. :param id_interface: Interface identifier. :return: None :raise InvalidParameterError: The parameters interface id, nome and protegida are none or invalid. :raise NomeInterfaceDuplicadoParaEquipamentoError: There is already an interface with this name for this equipment. :raise InterfaceNaoExisteError: Front link interface and/or back link interface doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_interface): raise InvalidParameterError( u'Interface id is invalid or was not informed.') url = 'interface/' + str(id_interface) + '/' interface_map = dict() interface_map['nome'] = nome interface_map['protegida'] = protegida interface_map['descricao'] = descricao interface_map['id_ligacao_front'] = id_ligacao_front interface_map['id_ligacao_back'] = id_ligacao_back interface_map['tipo'] = tipo interface_map['vlan'] = vlan code, xml = self.submit({'interface': interface_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alterar", "(", "self", ",", "id_interface", ",", "nome", ",", "protegida", ",", "descricao", ",", "id_ligacao_front", ",", "id_ligacao_back", ",", "tipo", "=", "None", ",", "vlan", "=", "None", ")", ":", "if", "not", "is_valid_int_param", "(", "id_interface", ")", ":", "raise", "InvalidParameterError", "(", "u'Interface id is invalid or was not informed.'", ")", "url", "=", "'interface/'", "+", "str", "(", "id_interface", ")", "+", "'/'", "interface_map", "=", "dict", "(", ")", "interface_map", "[", "'nome'", "]", "=", "nome", "interface_map", "[", "'protegida'", "]", "=", "protegida", "interface_map", "[", "'descricao'", "]", "=", "descricao", "interface_map", "[", "'id_ligacao_front'", "]", "=", "id_ligacao_front", "interface_map", "[", "'id_ligacao_back'", "]", "=", "id_ligacao_back", "interface_map", "[", "'tipo'", "]", "=", "tipo", "interface_map", "[", "'vlan'", "]", "=", "vlan", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'interface'", ":", "interface_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Edit an interface by its identifier. Equipment identifier is not changed. :param nome: Interface name. :param protegida: Indication of protected ('0' or '1'). :param descricao: Interface description. :param id_ligacao_front: Front end link interface identifier. :param id_ligacao_back: Back end link interface identifier. :param id_interface: Interface identifier. :return: None :raise InvalidParameterError: The parameters interface id, nome and protegida are none or invalid. :raise NomeInterfaceDuplicadoParaEquipamentoError: There is already an interface with this name for this equipment. :raise InterfaceNaoExisteError: Front link interface and/or back link interface doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Edit", "an", "interface", "by", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L191-L237
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.remover
def remover(self, id_interface): """Remove an interface by its identifier. :param id_interface: Interface identifier. :return: None :raise InterfaceNaoExisteError: Interface doesn't exist. :raise InterfaceError: Interface is linked to another interface. :raise InvalidParameterError: The interface identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_interface): raise InvalidParameterError( u'Interface id is invalid or was not informed.') url = 'interface/' + str(id_interface) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remover(self, id_interface): """Remove an interface by its identifier. :param id_interface: Interface identifier. :return: None :raise InterfaceNaoExisteError: Interface doesn't exist. :raise InterfaceError: Interface is linked to another interface. :raise InvalidParameterError: The interface identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_interface): raise InvalidParameterError( u'Interface id is invalid or was not informed.') url = 'interface/' + str(id_interface) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remover", "(", "self", ",", "id_interface", ")", ":", "if", "not", "is_valid_int_param", "(", "id_interface", ")", ":", "raise", "InvalidParameterError", "(", "u'Interface id is invalid or was not informed.'", ")", "url", "=", "'interface/'", "+", "str", "(", "id_interface", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove an interface by its identifier. :param id_interface: Interface identifier. :return: None :raise InterfaceNaoExisteError: Interface doesn't exist. :raise InterfaceError: Interface is linked to another interface. :raise InvalidParameterError: The interface identifier is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Remove", "an", "interface", "by", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L239-L260
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.remove_connection
def remove_connection(self, id_interface, back_or_front): """ Remove a connection between two interfaces :param id_interface: One side of relation :param back_or_front: This side of relation is back(0) or front(1) :return: None :raise InterfaceInvalidBackFrontError: Front or Back of interfaces not match to remove connection :raise InvalidParameterError: Interface id or back or front indicator is none or invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ msg_err = u'Parameter %s is invalid. Value: %s.' if not is_valid_0_1(back_or_front): raise InvalidParameterError( msg_err % ('back_or_front', back_or_front)) if not is_valid_int_param(id_interface): raise InvalidParameterError( msg_err % ('id_interface', id_interface)) url = 'interface/%s/%s/' % (str(id_interface), str(back_or_front)) code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remove_connection(self, id_interface, back_or_front): """ Remove a connection between two interfaces :param id_interface: One side of relation :param back_or_front: This side of relation is back(0) or front(1) :return: None :raise InterfaceInvalidBackFrontError: Front or Back of interfaces not match to remove connection :raise InvalidParameterError: Interface id or back or front indicator is none or invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ msg_err = u'Parameter %s is invalid. Value: %s.' if not is_valid_0_1(back_or_front): raise InvalidParameterError( msg_err % ('back_or_front', back_or_front)) if not is_valid_int_param(id_interface): raise InvalidParameterError( msg_err % ('id_interface', id_interface)) url = 'interface/%s/%s/' % (str(id_interface), str(back_or_front)) code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remove_connection", "(", "self", ",", "id_interface", ",", "back_or_front", ")", ":", "msg_err", "=", "u'Parameter %s is invalid. Value: %s.'", "if", "not", "is_valid_0_1", "(", "back_or_front", ")", ":", "raise", "InvalidParameterError", "(", "msg_err", "%", "(", "'back_or_front'", ",", "back_or_front", ")", ")", "if", "not", "is_valid_int_param", "(", "id_interface", ")", ":", "raise", "InvalidParameterError", "(", "msg_err", "%", "(", "'id_interface'", ",", "id_interface", ")", ")", "url", "=", "'interface/%s/%s/'", "%", "(", "str", "(", "id_interface", ")", ",", "str", "(", "back_or_front", ")", ")", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove a connection between two interfaces :param id_interface: One side of relation :param back_or_front: This side of relation is back(0) or front(1) :return: None :raise InterfaceInvalidBackFrontError: Front or Back of interfaces not match to remove connection :raise InvalidParameterError: Interface id or back or front indicator is none or invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Remove", "a", "connection", "between", "two", "interfaces" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L262-L293
globocom/GloboNetworkAPI-client-python
networkapiclient/Interface.py
Interface.list_connections
def list_connections(self, nome_interface, id_equipamento): """List interfaces linked to back and front of specified interface. :param nome_interface: Interface name. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: :: {'interfaces':[ {'id': < id >, 'interface': < nome >, 'descricao': < descricao >, 'protegida': < protegida >, 'equipamento': < id_equipamento >, 'tipo_equip': < id_tipo_equipamento >, 'ligacao_front': < id_ligacao_front >, 'nome_ligacao_front': < interface_name >, 'nome_equip_l_front': < equipment_name >, 'ligacao_back': < id_ligacao_back >, 'nome_ligacao_back': < interface_name >, 'nome_equip_l_back': < equipment_name > }, ... other interfaces ...]} :raise InterfaceNaoExisteError: Interface doesn't exist or is not associated with this equipment. :raise EquipamentoNaoExisteError: Equipment doesn't exist. :raise InvalidParameterError: Interface name and/or equipment identifier are none 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_equipamento): raise InvalidParameterError( u'Equipment identifier is none or was not informed.') if (nome_interface is None) or (nome_interface == ''): raise InvalidParameterError(u'Interface name was not informed.') # Temporário, remover. Fazer de outra forma. nome_interface = nome_interface.replace('/', 's2it_replace') url = 'interface/' + \ urllib.quote(nome_interface) + '/equipment/' + \ str(id_equipamento) + '/' code, map = self.submit(None, 'GET', url) key = 'interfaces' return get_list_map(self.response(code, map, [key]), key)
python
def list_connections(self, nome_interface, id_equipamento): """List interfaces linked to back and front of specified interface. :param nome_interface: Interface name. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: :: {'interfaces':[ {'id': < id >, 'interface': < nome >, 'descricao': < descricao >, 'protegida': < protegida >, 'equipamento': < id_equipamento >, 'tipo_equip': < id_tipo_equipamento >, 'ligacao_front': < id_ligacao_front >, 'nome_ligacao_front': < interface_name >, 'nome_equip_l_front': < equipment_name >, 'ligacao_back': < id_ligacao_back >, 'nome_ligacao_back': < interface_name >, 'nome_equip_l_back': < equipment_name > }, ... other interfaces ...]} :raise InterfaceNaoExisteError: Interface doesn't exist or is not associated with this equipment. :raise EquipamentoNaoExisteError: Equipment doesn't exist. :raise InvalidParameterError: Interface name and/or equipment identifier are none 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_equipamento): raise InvalidParameterError( u'Equipment identifier is none or was not informed.') if (nome_interface is None) or (nome_interface == ''): raise InvalidParameterError(u'Interface name was not informed.') # Temporário, remover. Fazer de outra forma. nome_interface = nome_interface.replace('/', 's2it_replace') url = 'interface/' + \ urllib.quote(nome_interface) + '/equipment/' + \ str(id_equipamento) + '/' code, map = self.submit(None, 'GET', url) key = 'interfaces' return get_list_map(self.response(code, map, [key]), key)
[ "def", "list_connections", "(", "self", ",", "nome_interface", ",", "id_equipamento", ")", ":", "if", "not", "is_valid_int_param", "(", "id_equipamento", ")", ":", "raise", "InvalidParameterError", "(", "u'Equipment identifier is none or was not informed.'", ")", "if", "(", "nome_interface", "is", "None", ")", "or", "(", "nome_interface", "==", "''", ")", ":", "raise", "InvalidParameterError", "(", "u'Interface name was not informed.'", ")", "# Temporário, remover. Fazer de outra forma.", "nome_interface", "=", "nome_interface", ".", "replace", "(", "'/'", ",", "'s2it_replace'", ")", "url", "=", "'interface/'", "+", "urllib", ".", "quote", "(", "nome_interface", ")", "+", "'/equipment/'", "+", "str", "(", "id_equipamento", ")", "+", "'/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "key", "=", "'interfaces'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List interfaces linked to back and front of specified interface. :param nome_interface: Interface name. :param id_equipamento: Equipment identifier. :return: Dictionary with the following: :: {'interfaces':[ {'id': < id >, 'interface': < nome >, 'descricao': < descricao >, 'protegida': < protegida >, 'equipamento': < id_equipamento >, 'tipo_equip': < id_tipo_equipamento >, 'ligacao_front': < id_ligacao_front >, 'nome_ligacao_front': < interface_name >, 'nome_equip_l_front': < equipment_name >, 'ligacao_back': < id_ligacao_back >, 'nome_ligacao_back': < interface_name >, 'nome_equip_l_back': < equipment_name > }, ... other interfaces ...]} :raise InterfaceNaoExisteError: Interface doesn't exist or is not associated with this equipment. :raise EquipamentoNaoExisteError: Equipment doesn't exist. :raise InvalidParameterError: Interface name and/or equipment identifier are none or invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "interfaces", "linked", "to", "back", "and", "front", "of", "specified", "interface", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Interface.py#L335-L381
globocom/GloboNetworkAPI-client-python
networkapiclient/Permission.py
Permission.list_all
def list_all(self): """List all Permission. :return: Dictionary with the following structure: :: {'perms': [{ 'function' < function >, 'id': < id > }, ... more permissions ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ code, map = self.submit(None, 'GET', 'perms/all/') key = 'perms' return get_list_map(self.response(code, map, [key]), key)
python
def list_all(self): """List all Permission. :return: Dictionary with the following structure: :: {'perms': [{ 'function' < function >, 'id': < id > }, ... more permissions ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ code, map = self.submit(None, 'GET', 'perms/all/') key = 'perms' return get_list_map(self.response(code, map, [key]), key)
[ "def", "list_all", "(", "self", ")", ":", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "'perms/all/'", ")", "key", "=", "'perms'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List all Permission. :return: Dictionary with the following structure: :: {'perms': [{ 'function' < function >, 'id': < id > }, ... more permissions ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "all", "Permission", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Permission.py#L37-L52
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4IPv4.py
ApiV4IPv4.search
def search(self, **kwargs): """ Method to search ipv4's based on extends search. :param search: Dict containing QuerySets to find ipv4's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv4's """ return super(ApiV4IPv4, self).get(self.prepare_url('api/v4/ipv4/', kwargs))
python
def search(self, **kwargs): """ Method to search ipv4's based on extends search. :param search: Dict containing QuerySets to find ipv4's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv4's """ return super(ApiV4IPv4, self).get(self.prepare_url('api/v4/ipv4/', kwargs))
[ "def", "search", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ApiV4IPv4", ",", "self", ")", ".", "get", "(", "self", ".", "prepare_url", "(", "'api/v4/ipv4/'", ",", "kwargs", ")", ")" ]
Method to search ipv4's based on extends search. :param search: Dict containing QuerySets to find ipv4's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing ipv4's
[ "Method", "to", "search", "ipv4", "s", "based", "on", "extends", "search", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4IPv4.py#L36-L49
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4IPv4.py
ApiV4IPv4.delete
def delete(self, ids): """ Method to delete ipv4's by their ids :param ids: Identifiers of ipv4's :return: None """ url = build_uri_with_ids('api/v4/ipv4/%s/', ids) return super(ApiV4IPv4, self).delete(url)
python
def delete(self, ids): """ Method to delete ipv4's by their ids :param ids: Identifiers of ipv4's :return: None """ url = build_uri_with_ids('api/v4/ipv4/%s/', ids) return super(ApiV4IPv4, self).delete(url)
[ "def", "delete", "(", "self", ",", "ids", ")", ":", "url", "=", "build_uri_with_ids", "(", "'api/v4/ipv4/%s/'", ",", "ids", ")", "return", "super", "(", "ApiV4IPv4", ",", "self", ")", ".", "delete", "(", "url", ")" ]
Method to delete ipv4's by their ids :param ids: Identifiers of ipv4's :return: None
[ "Method", "to", "delete", "ipv4", "s", "by", "their", "ids" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4IPv4.py#L66-L75
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4IPv4.py
ApiV4IPv4.create
def create(self, ipv4s): """ Method to create ipv4's :param ipv4s: List containing ipv4's desired to be created on database :return: None """ data = {'ips': ipv4s} return super(ApiV4IPv4, self).post('api/v4/ipv4/', data)
python
def create(self, ipv4s): """ Method to create ipv4's :param ipv4s: List containing ipv4's desired to be created on database :return: None """ data = {'ips': ipv4s} return super(ApiV4IPv4, self).post('api/v4/ipv4/', data)
[ "def", "create", "(", "self", ",", "ipv4s", ")", ":", "data", "=", "{", "'ips'", ":", "ipv4s", "}", "return", "super", "(", "ApiV4IPv4", ",", "self", ")", ".", "post", "(", "'api/v4/ipv4/'", ",", "data", ")" ]
Method to create ipv4's :param ipv4s: List containing ipv4's desired to be created on database :return: None
[ "Method", "to", "create", "ipv4", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4IPv4.py#L91-L100
globocom/GloboNetworkAPI-client-python
networkapiclient/GrupoVirtual.py
GrupoVirtual.provisionar
def provisionar(self, equipamentos, vips): """Realiza a inserção ou alteração de um grupo virtual para o sistema de Orquestração de VM. :param equipamentos: Lista de equipamentos gerada pelo método "add_equipamento" da classe "EspecificacaoGrupoVirtual". :param vips: Lista de VIPs gerada pelo método "add_vip" da classe "EspecificacaoGrupoVirtual". :return: Retorno da operação de inserir ou alterar um grupo virtual: :: {'equipamentos': {'equipamento': [{'id': < id>, 'nome': < nome>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}}, ... demais vips ...]}}, ... demais equipamentos...]}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'requisicao_vip': {'id': < id>}}, ... demais vips...]}} {'equipamentos': {'equipamento': [{'id': < id>, 'nome': < nome>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}}, ... demais vips ...]}}, ... demais equipamentos...]}, 'vips': {'vip': [{'id': < id>, 'requisicao_vip': {'id': < id>}}, ... demais vips...]}} :raise InvalidParameterError: Algum dado obrigatório não foi informado nas listas ou possui um valor inválido. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise VlanNaoExisteError: VLAN não cadastrada. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise IPNaoDisponivelError: Não existe IP disponível para a VLAN informada. :raise TipoEquipamentoNaoExisteError: Tipo de equipamento não cadastrado. :raise ModeloEquipamentoNaoExisteError: Modelo do equipamento não cadastrado. :raise GrupoEquipamentoNaoExisteError: Grupo de equipamentos não cadastrado. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise IpNaoExisteError: IP não cadastrado. :raise IpError: IP já está associado ao equipamento. :raise VipNaoExisteError: Requisição de VIP não cadastrada. :raise HealthCheckExpectNaoExisteError: Healthcheck_expect não cadastrado. """ code, map = self.submit( { 'equipamentos': { 'equipamento': equipamentos}, 'vips': { 'vip': vips}}, 'POST', 'grupovirtual/') return self.response(code, map, force_list=['equipamento', 'vip'])
python
def provisionar(self, equipamentos, vips): """Realiza a inserção ou alteração de um grupo virtual para o sistema de Orquestração de VM. :param equipamentos: Lista de equipamentos gerada pelo método "add_equipamento" da classe "EspecificacaoGrupoVirtual". :param vips: Lista de VIPs gerada pelo método "add_vip" da classe "EspecificacaoGrupoVirtual". :return: Retorno da operação de inserir ou alterar um grupo virtual: :: {'equipamentos': {'equipamento': [{'id': < id>, 'nome': < nome>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}}, ... demais vips ...]}}, ... demais equipamentos...]}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'requisicao_vip': {'id': < id>}}, ... demais vips...]}} {'equipamentos': {'equipamento': [{'id': < id>, 'nome': < nome>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}}, ... demais vips ...]}}, ... demais equipamentos...]}, 'vips': {'vip': [{'id': < id>, 'requisicao_vip': {'id': < id>}}, ... demais vips...]}} :raise InvalidParameterError: Algum dado obrigatório não foi informado nas listas ou possui um valor inválido. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise VlanNaoExisteError: VLAN não cadastrada. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise IPNaoDisponivelError: Não existe IP disponível para a VLAN informada. :raise TipoEquipamentoNaoExisteError: Tipo de equipamento não cadastrado. :raise ModeloEquipamentoNaoExisteError: Modelo do equipamento não cadastrado. :raise GrupoEquipamentoNaoExisteError: Grupo de equipamentos não cadastrado. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise IpNaoExisteError: IP não cadastrado. :raise IpError: IP já está associado ao equipamento. :raise VipNaoExisteError: Requisição de VIP não cadastrada. :raise HealthCheckExpectNaoExisteError: Healthcheck_expect não cadastrado. """ code, map = self.submit( { 'equipamentos': { 'equipamento': equipamentos}, 'vips': { 'vip': vips}}, 'POST', 'grupovirtual/') return self.response(code, map, force_list=['equipamento', 'vip'])
[ "def", "provisionar", "(", "self", ",", "equipamentos", ",", "vips", ")", ":", "code", ",", "map", "=", "self", ".", "submit", "(", "{", "'equipamentos'", ":", "{", "'equipamento'", ":", "equipamentos", "}", ",", "'vips'", ":", "{", "'vip'", ":", "vips", "}", "}", ",", "'POST'", ",", "'grupovirtual/'", ")", "return", "self", ".", "response", "(", "code", ",", "map", ",", "force_list", "=", "[", "'equipamento'", ",", "'vip'", "]", ")" ]
Realiza a inserção ou alteração de um grupo virtual para o sistema de Orquestração de VM. :param equipamentos: Lista de equipamentos gerada pelo método "add_equipamento" da classe "EspecificacaoGrupoVirtual". :param vips: Lista de VIPs gerada pelo método "add_vip" da classe "EspecificacaoGrupoVirtual". :return: Retorno da operação de inserir ou alterar um grupo virtual: :: {'equipamentos': {'equipamento': [{'id': < id>, 'nome': < nome>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}}, ... demais vips ...]}}, ... demais equipamentos...]}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'requisicao_vip': {'id': < id>}}, ... demais vips...]}} {'equipamentos': {'equipamento': [{'id': < id>, 'nome': < nome>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}, 'vips': {'vip': [{'id': < id>, 'ip': {'id': < id>, 'id_vlan': < id_vlan>, 'oct4': < oct4>, 'oct3': < oct3>, 'oct2': < oct2>, 'oct1': < oct1>, 'descricao': < descricao>}}, ... demais vips ...]}}, ... demais equipamentos...]}, 'vips': {'vip': [{'id': < id>, 'requisicao_vip': {'id': < id>}}, ... demais vips...]}} :raise InvalidParameterError: Algum dado obrigatório não foi informado nas listas ou possui um valor inválido. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise VlanNaoExisteError: VLAN não cadastrada. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise IPNaoDisponivelError: Não existe IP disponível para a VLAN informada. :raise TipoEquipamentoNaoExisteError: Tipo de equipamento não cadastrado. :raise ModeloEquipamentoNaoExisteError: Modelo do equipamento não cadastrado. :raise GrupoEquipamentoNaoExisteError: Grupo de equipamentos não cadastrado. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise IpNaoExisteError: IP não cadastrado. :raise IpError: IP já está associado ao equipamento. :raise VipNaoExisteError: Requisição de VIP não cadastrada. :raise HealthCheckExpectNaoExisteError: Healthcheck_expect não cadastrado.
[ "Realiza", "a", "inserção", "ou", "alteração", "de", "um", "grupo", "virtual", "para", "o", "sistema", "de", "Orquestração", "de", "VM", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoVirtual.py#L29-L109
globocom/GloboNetworkAPI-client-python
networkapiclient/GrupoVirtual.py
GrupoVirtual.remover_provisionamento
def remover_provisionamento(self, equipamentos, vips): """Remove o provisionamento de um grupo virtual para o sistema de Orquestração VM. :param equipamentos: Lista de equipamentos gerada pelo método "add_equipamento_remove" da classe "EspecificacaoGrupoVirtual". :param vips: Lista de VIPs gerada pelo método "add_vip_remove" da classe "EspecificacaoGrupoVirtual". :return: None :raise InvalidParameterError: Algum dado obrigatório não foi informado nas listas ou possui um valor inválido. :raise IpNaoExisteError: IP não cadastrado. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise IpError: IP não está associado ao equipamento. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. """ code, map = self.submit({'equipamentos': {'equipamento': equipamentos}, 'vips': { 'vip': vips}}, 'DELETE', 'grupovirtual/') return self.response(code, map)
python
def remover_provisionamento(self, equipamentos, vips): """Remove o provisionamento de um grupo virtual para o sistema de Orquestração VM. :param equipamentos: Lista de equipamentos gerada pelo método "add_equipamento_remove" da classe "EspecificacaoGrupoVirtual". :param vips: Lista de VIPs gerada pelo método "add_vip_remove" da classe "EspecificacaoGrupoVirtual". :return: None :raise InvalidParameterError: Algum dado obrigatório não foi informado nas listas ou possui um valor inválido. :raise IpNaoExisteError: IP não cadastrado. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise IpError: IP não está associado ao equipamento. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. """ code, map = self.submit({'equipamentos': {'equipamento': equipamentos}, 'vips': { 'vip': vips}}, 'DELETE', 'grupovirtual/') return self.response(code, map)
[ "def", "remover_provisionamento", "(", "self", ",", "equipamentos", ",", "vips", ")", ":", "code", ",", "map", "=", "self", ".", "submit", "(", "{", "'equipamentos'", ":", "{", "'equipamento'", ":", "equipamentos", "}", ",", "'vips'", ":", "{", "'vip'", ":", "vips", "}", "}", ",", "'DELETE'", ",", "'grupovirtual/'", ")", "return", "self", ".", "response", "(", "code", ",", "map", ")" ]
Remove o provisionamento de um grupo virtual para o sistema de Orquestração VM. :param equipamentos: Lista de equipamentos gerada pelo método "add_equipamento_remove" da classe "EspecificacaoGrupoVirtual". :param vips: Lista de VIPs gerada pelo método "add_vip_remove" da classe "EspecificacaoGrupoVirtual". :return: None :raise InvalidParameterError: Algum dado obrigatório não foi informado nas listas ou possui um valor inválido. :raise IpNaoExisteError: IP não cadastrado. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise IpError: IP não está associado ao equipamento. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta.
[ "Remove", "o", "provisionamento", "de", "um", "grupo", "virtual", "para", "o", "sistema", "de", "Orquestração", "VM", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoVirtual.py#L111-L131
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.list_with_usergroup
def list_with_usergroup(self): """List all users and their user groups. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < user >, 'ativo': < ativo >, 'email': < email >, 'is_more': <True ou False>, 'grupos': [nome_grupo, ...more user groups...]}, ...more user...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'usuario/get/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def list_with_usergroup(self): """List all users and their user groups. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < user >, 'ativo': < ativo >, 'email': < email >, 'is_more': <True ou False>, 'grupos': [nome_grupo, ...more user groups...]}, ...more user...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'usuario/get/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "list_with_usergroup", "(", "self", ")", ":", "url", "=", "'usuario/get/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
List all users and their user groups. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < user >, 'ativo': < ativo >, 'email': < email >, 'is_more': <True ou False>, 'grupos': [nome_grupo, ...more user groups...]}, ...more user...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "all", "users", "and", "their", "user", "groups", ".", "is_more", "-", "If", "more", "than", "3", "of", "groups", "of", "users", "or", "no", "to", "control", "expansion", "Screen", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L121-L146
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.get_by_user_ldap
def get_by_user_ldap(self, user_name): """Get user by the ldap name. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < user >, 'ativo': < ativo >, 'email': < email >, 'grupos': [nome_grupo, ...more user groups...], 'user_ldap': < user_ldap >}} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'user/get/ldap/' + str(user_name) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def get_by_user_ldap(self, user_name): """Get user by the ldap name. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < user >, 'ativo': < ativo >, 'email': < email >, 'grupos': [nome_grupo, ...more user groups...], 'user_ldap': < user_ldap >}} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'user/get/ldap/' + str(user_name) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "get_by_user_ldap", "(", "self", ",", "user_name", ")", ":", "url", "=", "'user/get/ldap/'", "+", "str", "(", "user_name", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Get user by the ldap name. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < user >, 'ativo': < ativo >, 'email': < email >, 'grupos': [nome_grupo, ...more user groups...], 'user_ldap': < user_ldap >}} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Get", "user", "by", "the", "ldap", "name", ".", "is_more", "-", "If", "more", "than", "3", "of", "groups", "of", "users", "or", "no", "to", "control", "expansion", "Screen", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L179-L204
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.inserir
def inserir(self, user, pwd, name, email, user_ldap): """Inserts a new User and returns its identifier. The user will be created with active status. :param user: Username. String with a minimum 3 and maximum of 45 characters :param pwd: User password. String with a minimum 3 and maximum of 45 characters :param name: User name. String with a minimum 3 and maximum of 200 characters :param email: User Email. String with a minimum 3 and maximum of 300 characters :param user_ldap: LDAP Username. String with a minimum 3 and maximum of 45 characters :return: Dictionary with the following structure: :: {'usuario': {'id': < id_user >}} :raise InvalidParameterError: The identifier of User, user, pwd, name or email is null and invalid. :raise UserUsuarioDuplicadoError: There is already a registered user with the value of user. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ user_map = dict() user_map['user'] = user user_map['password'] = pwd user_map['name'] = name user_map['email'] = email user_map['user_ldap'] = user_ldap code, xml = self.submit({'user': user_map}, 'POST', 'user/') return self.response(code, xml)
python
def inserir(self, user, pwd, name, email, user_ldap): """Inserts a new User and returns its identifier. The user will be created with active status. :param user: Username. String with a minimum 3 and maximum of 45 characters :param pwd: User password. String with a minimum 3 and maximum of 45 characters :param name: User name. String with a minimum 3 and maximum of 200 characters :param email: User Email. String with a minimum 3 and maximum of 300 characters :param user_ldap: LDAP Username. String with a minimum 3 and maximum of 45 characters :return: Dictionary with the following structure: :: {'usuario': {'id': < id_user >}} :raise InvalidParameterError: The identifier of User, user, pwd, name or email is null and invalid. :raise UserUsuarioDuplicadoError: There is already a registered user with the value of user. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ user_map = dict() user_map['user'] = user user_map['password'] = pwd user_map['name'] = name user_map['email'] = email user_map['user_ldap'] = user_ldap code, xml = self.submit({'user': user_map}, 'POST', 'user/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "user", ",", "pwd", ",", "name", ",", "email", ",", "user_ldap", ")", ":", "user_map", "=", "dict", "(", ")", "user_map", "[", "'user'", "]", "=", "user", "user_map", "[", "'password'", "]", "=", "pwd", "user_map", "[", "'name'", "]", "=", "name", "user_map", "[", "'email'", "]", "=", "email", "user_map", "[", "'user_ldap'", "]", "=", "user_ldap", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'user'", ":", "user_map", "}", ",", "'POST'", ",", "'user/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Inserts a new User and returns its identifier. The user will be created with active status. :param user: Username. String with a minimum 3 and maximum of 45 characters :param pwd: User password. String with a minimum 3 and maximum of 45 characters :param name: User name. String with a minimum 3 and maximum of 200 characters :param email: User Email. String with a minimum 3 and maximum of 300 characters :param user_ldap: LDAP Username. String with a minimum 3 and maximum of 45 characters :return: Dictionary with the following structure: :: {'usuario': {'id': < id_user >}} :raise InvalidParameterError: The identifier of User, user, pwd, name or email is null and invalid. :raise UserUsuarioDuplicadoError: There is already a registered user with the value of user. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Inserts", "a", "new", "User", "and", "returns", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L206-L237
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.alterar
def alterar(self, id_user, user, password, nome, ativo, email, user_ldap): """Change User from by the identifier. :param id_user: Identifier of the User. Integer value and greater than zero. :param user: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :param nome: User name. String with a minimum 3 and maximum of 200 characters :param email: User Email. String with a minimum 3 and maximum of 300 characters :param ativo: Status. 0 or 1 :param user_ldap: LDAP Username. String with a minimum 3 and maximum of 45 characters :return: None :raise InvalidParameterError: The identifier of User, user, pwd, name, email or active is null and invalid. :raise UserUsuarioDuplicadoError: There is already a registered user with the value of user. :raise UsuarioNaoExisteError: User 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_user): raise InvalidParameterError( u'The identifier of User is invalid or was not informed.') url = 'user/' + str(id_user) + '/' user_map = dict() user_map['user'] = user user_map['password'] = password user_map['name'] = nome user_map['active'] = ativo user_map['email'] = email user_map['user_ldap'] = user_ldap code, xml = self.submit({'user': user_map}, 'PUT', url) return self.response(code, xml)
python
def alterar(self, id_user, user, password, nome, ativo, email, user_ldap): """Change User from by the identifier. :param id_user: Identifier of the User. Integer value and greater than zero. :param user: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :param nome: User name. String with a minimum 3 and maximum of 200 characters :param email: User Email. String with a minimum 3 and maximum of 300 characters :param ativo: Status. 0 or 1 :param user_ldap: LDAP Username. String with a minimum 3 and maximum of 45 characters :return: None :raise InvalidParameterError: The identifier of User, user, pwd, name, email or active is null and invalid. :raise UserUsuarioDuplicadoError: There is already a registered user with the value of user. :raise UsuarioNaoExisteError: User 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_user): raise InvalidParameterError( u'The identifier of User is invalid or was not informed.') url = 'user/' + str(id_user) + '/' user_map = dict() user_map['user'] = user user_map['password'] = password user_map['name'] = nome user_map['active'] = ativo user_map['email'] = email user_map['user_ldap'] = user_ldap code, xml = self.submit({'user': user_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alterar", "(", "self", ",", "id_user", ",", "user", ",", "password", ",", "nome", ",", "ativo", ",", "email", ",", "user_ldap", ")", ":", "if", "not", "is_valid_int_param", "(", "id_user", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of User is invalid or was not informed.'", ")", "url", "=", "'user/'", "+", "str", "(", "id_user", ")", "+", "'/'", "user_map", "=", "dict", "(", ")", "user_map", "[", "'user'", "]", "=", "user", "user_map", "[", "'password'", "]", "=", "password", "user_map", "[", "'name'", "]", "=", "nome", "user_map", "[", "'active'", "]", "=", "ativo", "user_map", "[", "'email'", "]", "=", "email", "user_map", "[", "'user_ldap'", "]", "=", "user_ldap", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'user'", ":", "user_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change User from by the identifier. :param id_user: Identifier of the User. Integer value and greater than zero. :param user: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :param nome: User name. String with a minimum 3 and maximum of 200 characters :param email: User Email. String with a minimum 3 and maximum of 300 characters :param ativo: Status. 0 or 1 :param user_ldap: LDAP Username. String with a minimum 3 and maximum of 45 characters :return: None :raise InvalidParameterError: The identifier of User, user, pwd, name, email or active is null and invalid. :raise UserUsuarioDuplicadoError: There is already a registered user with the value of user. :raise UsuarioNaoExisteError: User not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Change", "User", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L239-L275
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.change_password
def change_password(self, id_user, user_current_password, password): """Change password of User from by the identifier. :param id_user: Identifier of the User. Integer value and greater than zero. :param user_current_password: Senha atual do usuário. :param password: Nova Senha do usuário. :return: None :raise UsuarioNaoExisteError: User not registered. :raise InvalidParameterError: The identifier of User is null and 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_user): raise InvalidParameterError( u'The identifier of User is invalid or was not informed.') if password is None or password == "": raise InvalidParameterError( u'A nova senha do usuário é inválida ou não foi informada') user_map = dict() user_map['user_id'] = id_user user_map['password'] = password code, xml = self.submit( {'user': user_map}, 'POST', 'user-change-pass/') return self.response(code, xml)
python
def change_password(self, id_user, user_current_password, password): """Change password of User from by the identifier. :param id_user: Identifier of the User. Integer value and greater than zero. :param user_current_password: Senha atual do usuário. :param password: Nova Senha do usuário. :return: None :raise UsuarioNaoExisteError: User not registered. :raise InvalidParameterError: The identifier of User is null and 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_user): raise InvalidParameterError( u'The identifier of User is invalid or was not informed.') if password is None or password == "": raise InvalidParameterError( u'A nova senha do usuário é inválida ou não foi informada') user_map = dict() user_map['user_id'] = id_user user_map['password'] = password code, xml = self.submit( {'user': user_map}, 'POST', 'user-change-pass/') return self.response(code, xml)
[ "def", "change_password", "(", "self", ",", "id_user", ",", "user_current_password", ",", "password", ")", ":", "if", "not", "is_valid_int_param", "(", "id_user", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of User is invalid or was not informed.'", ")", "if", "password", "is", "None", "or", "password", "==", "\"\"", ":", "raise", "InvalidParameterError", "(", "u'A nova senha do usuário é inválida ou não foi informada')", "", "user_map", "=", "dict", "(", ")", "user_map", "[", "'user_id'", "]", "=", "id_user", "user_map", "[", "'password'", "]", "=", "password", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'user'", ":", "user_map", "}", ",", "'POST'", ",", "'user-change-pass/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change password of User from by the identifier. :param id_user: Identifier of the User. Integer value and greater than zero. :param user_current_password: Senha atual do usuário. :param password: Nova Senha do usuário. :return: None :raise UsuarioNaoExisteError: User not registered. :raise InvalidParameterError: The identifier of User is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Change", "password", "of", "User", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L277-L307
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.authenticate
def authenticate(self, username, password, is_ldap_user): """Get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'user': < user >} {'nome': < nome >} {'pwd': < pwd >} {'email': < email >} {'active': < active >} {'permission':[ {'<function>': { 'write': <value>, 'read': <value>}, ... more function ... ] } } } :raise InvalidParameterError: The value of username or password is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ user_map = dict() user_map['username'] = username user_map['password'] = password user_map['is_ldap_user'] = is_ldap_user code, xml = self.submit({'user': user_map}, 'POST', 'authenticate/') return self.response(code, xml)
python
def authenticate(self, username, password, is_ldap_user): """Get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'user': < user >} {'nome': < nome >} {'pwd': < pwd >} {'email': < email >} {'active': < active >} {'permission':[ {'<function>': { 'write': <value>, 'read': <value>}, ... more function ... ] } } } :raise InvalidParameterError: The value of username or password is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ user_map = dict() user_map['username'] = username user_map['password'] = password user_map['is_ldap_user'] = is_ldap_user code, xml = self.submit({'user': user_map}, 'POST', 'authenticate/') return self.response(code, xml)
[ "def", "authenticate", "(", "self", ",", "username", ",", "password", ",", "is_ldap_user", ")", ":", "user_map", "=", "dict", "(", ")", "user_map", "[", "'username'", "]", "=", "username", "user_map", "[", "'password'", "]", "=", "password", "user_map", "[", "'is_ldap_user'", "]", "=", "is_ldap_user", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'user'", ":", "user_map", "}", ",", "'POST'", ",", "'authenticate/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'user': < user >} {'nome': < nome >} {'pwd': < pwd >} {'email': < email >} {'active': < active >} {'permission':[ {'<function>': { 'write': <value>, 'read': <value>}, ... more function ... ] } } } :raise InvalidParameterError: The value of username or password is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Get", "user", "by", "username", "and", "password", "and", "their", "permissions", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L331-L360
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.authenticate_ldap
def authenticate_ldap(self, username, password): """Get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'user': < user >} {'nome': < nome >} {'pwd': < pwd >} {'email': < email >} {'active': < active >} {'permission':[ {'<function>': { 'write': <value>, 'read': <value>}, ... more function ... ] } } } :raise InvalidParameterError: The value of username or password is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ user_map = dict() user_map['username'] = username user_map['password'] = password code, xml = self.submit( {'user': user_map}, 'POST', 'authenticate/ldap/') return self.response(code, xml)
python
def authenticate_ldap(self, username, password): """Get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'user': < user >} {'nome': < nome >} {'pwd': < pwd >} {'email': < email >} {'active': < active >} {'permission':[ {'<function>': { 'write': <value>, 'read': <value>}, ... more function ... ] } } } :raise InvalidParameterError: The value of username or password is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ user_map = dict() user_map['username'] = username user_map['password'] = password code, xml = self.submit( {'user': user_map}, 'POST', 'authenticate/ldap/') return self.response(code, xml)
[ "def", "authenticate_ldap", "(", "self", ",", "username", ",", "password", ")", ":", "user_map", "=", "dict", "(", ")", "user_map", "[", "'username'", "]", "=", "username", "user_map", "[", "'password'", "]", "=", "password", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'user'", ":", "user_map", "}", ",", "'POST'", ",", "'authenticate/ldap/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'user': < user >} {'nome': < nome >} {'pwd': < pwd >} {'email': < email >} {'active': < active >} {'permission':[ {'<function>': { 'write': <value>, 'read': <value>}, ... more function ... ] } } } :raise InvalidParameterError: The value of username or password is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Get", "user", "by", "username", "and", "password", "and", "their", "permissions", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L362-L391
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoAcesso.py
TipoAcesso.listar
def listar(self): """List all access types. :return: Dictionary with structure: :: {‘tipo_acesso’: [{‘id’: < id >, ‘protocolo’: < protocolo >}, ... other access types ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ code, map = self.submit(None, 'GET', 'tipoacesso/') key = 'tipo_acesso' return get_list_map(self.response(code, map, [key]), key)
python
def listar(self): """List all access types. :return: Dictionary with structure: :: {‘tipo_acesso’: [{‘id’: < id >, ‘protocolo’: < protocolo >}, ... other access types ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ code, map = self.submit(None, 'GET', 'tipoacesso/') key = 'tipo_acesso' return get_list_map(self.response(code, map, [key]), key)
[ "def", "listar", "(", "self", ")", ":", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "'tipoacesso/'", ")", "key", "=", "'tipo_acesso'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "map", ",", "[", "key", "]", ")", ",", "key", ")" ]
List all access types. :return: Dictionary with structure: :: {‘tipo_acesso’: [{‘id’: < id >, ‘protocolo’: < protocolo >}, ... other access types ...]} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "List", "all", "access", "types", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoAcesso.py#L38-L54
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoAcesso.py
TipoAcesso.inserir
def inserir(self, protocolo): """Insert new access type and returns its identifier. :param protocolo: Protocol. :return: Dictionary with structure: {‘tipo_acesso’: {‘id’: < id >}} :raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists. :raise InvalidParameterError: Protocol value is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ tipo_acesso_map = dict() tipo_acesso_map['protocolo'] = protocolo code, xml = self.submit( {'tipo_acesso': tipo_acesso_map}, 'POST', 'tipoacesso/') return self.response(code, xml)
python
def inserir(self, protocolo): """Insert new access type and returns its identifier. :param protocolo: Protocol. :return: Dictionary with structure: {‘tipo_acesso’: {‘id’: < id >}} :raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists. :raise InvalidParameterError: Protocol value is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ tipo_acesso_map = dict() tipo_acesso_map['protocolo'] = protocolo code, xml = self.submit( {'tipo_acesso': tipo_acesso_map}, 'POST', 'tipoacesso/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "protocolo", ")", ":", "tipo_acesso_map", "=", "dict", "(", ")", "tipo_acesso_map", "[", "'protocolo'", "]", "=", "protocolo", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'tipo_acesso'", ":", "tipo_acesso_map", "}", ",", "'POST'", ",", "'tipoacesso/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Insert new access type and returns its identifier. :param protocolo: Protocol. :return: Dictionary with structure: {‘tipo_acesso’: {‘id’: < id >}} :raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists. :raise InvalidParameterError: Protocol value is invalid or none. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Insert", "new", "access", "type", "and", "returns", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoAcesso.py#L56-L74
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoAcesso.py
TipoAcesso.alterar
def alterar(self, id_tipo_acesso, protocolo): """Edit access type by its identifier. :param id_tipo_acesso: Access type identifier. :param protocolo: Protocol. :return: None :raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists. :raise InvalidParameterError: Protocol value is invalid or none. :raise TipoAcessoNaoExisteError: Access type doesn't exist. :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 or was not informed.') tipo_acesso_map = dict() tipo_acesso_map['protocolo'] = protocolo url = 'tipoacesso/' + str(id_tipo_acesso) + '/' code, xml = self.submit({'tipo_acesso': tipo_acesso_map}, 'PUT', url) return self.response(code, xml)
python
def alterar(self, id_tipo_acesso, protocolo): """Edit access type by its identifier. :param id_tipo_acesso: Access type identifier. :param protocolo: Protocol. :return: None :raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists. :raise InvalidParameterError: Protocol value is invalid or none. :raise TipoAcessoNaoExisteError: Access type doesn't exist. :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 or was not informed.') tipo_acesso_map = dict() tipo_acesso_map['protocolo'] = protocolo url = 'tipoacesso/' + str(id_tipo_acesso) + '/' code, xml = self.submit({'tipo_acesso': tipo_acesso_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alterar", "(", "self", ",", "id_tipo_acesso", ",", "protocolo", ")", ":", "if", "not", "is_valid_int_param", "(", "id_tipo_acesso", ")", ":", "raise", "InvalidParameterError", "(", "u'Access type id is invalid or was not informed.'", ")", "tipo_acesso_map", "=", "dict", "(", ")", "tipo_acesso_map", "[", "'protocolo'", "]", "=", "protocolo", "url", "=", "'tipoacesso/'", "+", "str", "(", "id_tipo_acesso", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'tipo_acesso'", ":", "tipo_acesso_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Edit access type by its identifier. :param id_tipo_acesso: Access type identifier. :param protocolo: Protocol. :return: None :raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists. :raise InvalidParameterError: Protocol value is invalid or none. :raise TipoAcessoNaoExisteError: Access type doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Edit", "access", "type", "by", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoAcesso.py#L76-L101
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoAcesso.py
TipoAcesso.remover
def remover(self, id_tipo_acesso): """Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError: Access type associated with equipment, cannot be removed. :raise InvalidParameterError: Protocol value is invalid or none. :raise TipoAcessoNaoExisteError: Access type doesn't exist. :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 or was not informed.') url = 'tipoacesso/' + str(id_tipo_acesso) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remover(self, id_tipo_acesso): """Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError: Access type associated with equipment, cannot be removed. :raise InvalidParameterError: Protocol value is invalid or none. :raise TipoAcessoNaoExisteError: Access type doesn't exist. :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 or was not informed.') url = 'tipoacesso/' + str(id_tipo_acesso) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remover", "(", "self", ",", "id_tipo_acesso", ")", ":", "if", "not", "is_valid_int_param", "(", "id_tipo_acesso", ")", ":", "raise", "InvalidParameterError", "(", "u'Access type id is invalid or was not informed.'", ")", "url", "=", "'tipoacesso/'", "+", "str", "(", "id_tipo_acesso", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError: Access type associated with equipment, cannot be removed. :raise InvalidParameterError: Protocol value is invalid or none. :raise TipoAcessoNaoExisteError: Access type doesn't exist. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Removes", "access", "type", "by", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoAcesso.py#L103-L124
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRoteiro.py
TipoRoteiro.inserir
def inserir(self, type, description): """Inserts a new Script Type and returns its identifier. :param type: Script Type type. String with a minimum 3 and maximum of 40 characters :param description: Script Type description. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'script_type': {'id': < id_script_type >}} :raise InvalidParameterError: Type or description is null and invalid. :raise NomeTipoRoteiroDuplicadoError: Type script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ script_type_map = dict() script_type_map['type'] = type script_type_map['description'] = description code, xml = self.submit( {'script_type': script_type_map}, 'POST', 'scripttype/') return self.response(code, xml)
python
def inserir(self, type, description): """Inserts a new Script Type and returns its identifier. :param type: Script Type type. String with a minimum 3 and maximum of 40 characters :param description: Script Type description. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'script_type': {'id': < id_script_type >}} :raise InvalidParameterError: Type or description is null and invalid. :raise NomeTipoRoteiroDuplicadoError: Type script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ script_type_map = dict() script_type_map['type'] = type script_type_map['description'] = description code, xml = self.submit( {'script_type': script_type_map}, 'POST', 'scripttype/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "type", ",", "description", ")", ":", "script_type_map", "=", "dict", "(", ")", "script_type_map", "[", "'type'", "]", "=", "type", "script_type_map", "[", "'description'", "]", "=", "description", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'script_type'", ":", "script_type_map", "}", ",", "'POST'", ",", "'scripttype/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Inserts a new Script Type and returns its identifier. :param type: Script Type type. String with a minimum 3 and maximum of 40 characters :param description: Script Type description. String with a minimum 3 and maximum of 100 characters :return: Dictionary with the following structure: :: {'script_type': {'id': < id_script_type >}} :raise InvalidParameterError: Type or description is null and invalid. :raise NomeTipoRoteiroDuplicadoError: Type script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Inserts", "a", "new", "Script", "Type", "and", "returns", "its", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRoteiro.py#L58-L82
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRoteiro.py
TipoRoteiro.alterar
def alterar(self, id_script_type, type, description): """Change Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param type: Script Type type. String with a minimum 3 and maximum of 40 characters :param description: Script Type description. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Script Type, type or description is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeTipoRoteiroDuplicadoError: Type script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_script_type): raise InvalidParameterError( u'The identifier of Script Type is invalid or was not informed.') script_type_map = dict() script_type_map['type'] = type script_type_map['description'] = description url = 'scripttype/' + str(id_script_type) + '/' code, xml = self.submit({'script_type': script_type_map}, 'PUT', url) return self.response(code, xml)
python
def alterar(self, id_script_type, type, description): """Change Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param type: Script Type type. String with a minimum 3 and maximum of 40 characters :param description: Script Type description. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Script Type, type or description is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeTipoRoteiroDuplicadoError: Type script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not is_valid_int_param(id_script_type): raise InvalidParameterError( u'The identifier of Script Type is invalid or was not informed.') script_type_map = dict() script_type_map['type'] = type script_type_map['description'] = description url = 'scripttype/' + str(id_script_type) + '/' code, xml = self.submit({'script_type': script_type_map}, 'PUT', url) return self.response(code, xml)
[ "def", "alterar", "(", "self", ",", "id_script_type", ",", "type", ",", "description", ")", ":", "if", "not", "is_valid_int_param", "(", "id_script_type", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Script Type is invalid or was not informed.'", ")", "script_type_map", "=", "dict", "(", ")", "script_type_map", "[", "'type'", "]", "=", "type", "script_type_map", "[", "'description'", "]", "=", "description", "url", "=", "'scripttype/'", "+", "str", "(", "id_script_type", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'script_type'", ":", "script_type_map", "}", ",", "'PUT'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :param type: Script Type type. String with a minimum 3 and maximum of 40 characters :param description: Script Type description. String with a minimum 3 and maximum of 100 characters :return: None :raise InvalidParameterError: The identifier of Script Type, type or description is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise NomeTipoRoteiroDuplicadoError: Type script already registered with informed. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Change", "Script", "Type", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRoteiro.py#L84-L111
globocom/GloboNetworkAPI-client-python
networkapiclient/TipoRoteiro.py
TipoRoteiro.remover
def remover(self, id_script_type): """Remove Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Script Type is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise TipoRoteiroError: Script type is associated with a 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_script_type): raise InvalidParameterError( u'The identifier of Script Type is invalid or was not informed.') url = 'scripttype/' + str(id_script_type) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remover(self, id_script_type): """Remove Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Script Type is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise TipoRoteiroError: Script type is associated with a 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_script_type): raise InvalidParameterError( u'The identifier of Script Type is invalid or was not informed.') url = 'scripttype/' + str(id_script_type) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remover", "(", "self", ",", "id_script_type", ")", ":", "if", "not", "is_valid_int_param", "(", "id_script_type", ")", ":", "raise", "InvalidParameterError", "(", "u'The identifier of Script Type is invalid or was not informed.'", ")", "url", "=", "'scripttype/'", "+", "str", "(", "id_script_type", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Script Type is null and invalid. :raise TipoRoteiroNaoExisteError: Script Type not registered. :raise TipoRoteiroError: Script type is associated with a script. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Remove", "Script", "Type", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/TipoRoteiro.py#L113-L134
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.pool_by_environmentvip
def pool_by_environmentvip(self, environment_vip_id): """ Method to return list object pool by environment vip id Param environment_vip_id: environment vip id Return list object pool """ uri = 'api/v3/pool/environment-vip/%s/' % environment_vip_id return super(ApiPool, self).get(uri)
python
def pool_by_environmentvip(self, environment_vip_id): """ Method to return list object pool by environment vip id Param environment_vip_id: environment vip id Return list object pool """ uri = 'api/v3/pool/environment-vip/%s/' % environment_vip_id return super(ApiPool, self).get(uri)
[ "def", "pool_by_environmentvip", "(", "self", ",", "environment_vip_id", ")", ":", "uri", "=", "'api/v3/pool/environment-vip/%s/'", "%", "environment_vip_id", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "get", "(", "uri", ")" ]
Method to return list object pool by environment vip id Param environment_vip_id: environment vip id Return list object pool
[ "Method", "to", "return", "list", "object", "pool", "by", "environment", "vip", "id", "Param", "environment_vip_id", ":", "environment", "vip", "id", "Return", "list", "object", "pool" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L36-L45
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.pool_by_id
def pool_by_id(self, pool_id): """ Method to return object pool by id Param pool_id: pool id Returns object pool """ uri = 'api/v3/pool/%s/' % pool_id return super(ApiPool, self).get(uri)
python
def pool_by_id(self, pool_id): """ Method to return object pool by id Param pool_id: pool id Returns object pool """ uri = 'api/v3/pool/%s/' % pool_id return super(ApiPool, self).get(uri)
[ "def", "pool_by_id", "(", "self", ",", "pool_id", ")", ":", "uri", "=", "'api/v3/pool/%s/'", "%", "pool_id", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "get", "(", "uri", ")" ]
Method to return object pool by id Param pool_id: pool id Returns object pool
[ "Method", "to", "return", "object", "pool", "by", "id", "Param", "pool_id", ":", "pool", "id", "Returns", "object", "pool" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L47-L56
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.get_pool_details
def get_pool_details(self, pool_id): """ Method to return object pool by id Param pool_id: pool id Returns object pool """ uri = 'api/v3/pool/details/%s/' % pool_id return super(ApiPool, self).get(uri)
python
def get_pool_details(self, pool_id): """ Method to return object pool by id Param pool_id: pool id Returns object pool """ uri = 'api/v3/pool/details/%s/' % pool_id return super(ApiPool, self).get(uri)
[ "def", "get_pool_details", "(", "self", ",", "pool_id", ")", ":", "uri", "=", "'api/v3/pool/details/%s/'", "%", "pool_id", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "get", "(", "uri", ")" ]
Method to return object pool by id Param pool_id: pool id Returns object pool
[ "Method", "to", "return", "object", "pool", "by", "id", "Param", "pool_id", ":", "pool", "id", "Returns", "object", "pool" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L58-L67
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.search
def search(self, **kwargs): """ Method to search pool's based on extends search. :param search: Dict containing QuerySets to find pool's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing pool's """ return super(ApiPool, self).get(self.prepare_url('api/v3/pool/', kwargs))
python
def search(self, **kwargs): """ Method to search pool's based on extends search. :param search: Dict containing QuerySets to find pool's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing pool's """ return super(ApiPool, self).get(self.prepare_url('api/v3/pool/', kwargs))
[ "def", "search", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "get", "(", "self", ".", "prepare_url", "(", "'api/v3/pool/'", ",", "kwargs", ")", ")" ]
Method to search pool's based on extends search. :param search: Dict containing QuerySets to find pool's. :param include: Array containing fields to include on response. :param exclude: Array containing fields to exclude on response. :param fields: Array containing fields to override default fields. :param kind: Determine if result will be detailed ('detail') or basic ('basic'). :return: Dict containing pool's
[ "Method", "to", "search", "pool", "s", "based", "on", "extends", "search", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L69-L82
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.delete
def delete(self, ids): """ Method to delete pool's by their ids :param ids: Identifiers of pool's :return: None """ url = build_uri_with_ids('api/v3/pool/%s/', ids) return super(ApiPool, self).delete(url)
python
def delete(self, ids): """ Method to delete pool's by their ids :param ids: Identifiers of pool's :return: None """ url = build_uri_with_ids('api/v3/pool/%s/', ids) return super(ApiPool, self).delete(url)
[ "def", "delete", "(", "self", ",", "ids", ")", ":", "url", "=", "build_uri_with_ids", "(", "'api/v3/pool/%s/'", ",", "ids", ")", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "delete", "(", "url", ")" ]
Method to delete pool's by their ids :param ids: Identifiers of pool's :return: None
[ "Method", "to", "delete", "pool", "s", "by", "their", "ids" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L99-L108
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.update
def update(self, pools): """ Method to update pool's :param pools: List containing pool's desired to updated :return: None """ data = {'server_pools': pools} pools_ids = [str(pool.get('id')) for pool in pools] return super(ApiPool, self).put('api/v3/pool/%s/' % ';'.join(pools_ids), data)
python
def update(self, pools): """ Method to update pool's :param pools: List containing pool's desired to updated :return: None """ data = {'server_pools': pools} pools_ids = [str(pool.get('id')) for pool in pools] return super(ApiPool, self).put('api/v3/pool/%s/' % ';'.join(pools_ids), data)
[ "def", "update", "(", "self", ",", "pools", ")", ":", "data", "=", "{", "'server_pools'", ":", "pools", "}", "pools_ids", "=", "[", "str", "(", "pool", ".", "get", "(", "'id'", ")", ")", "for", "pool", "in", "pools", "]", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "put", "(", "'api/v3/pool/%s/'", "%", "';'", ".", "join", "(", "pools_ids", ")", ",", "data", ")" ]
Method to update pool's :param pools: List containing pool's desired to updated :return: None
[ "Method", "to", "update", "pool", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L110-L123
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiPool.py
ApiPool.create
def create(self, pools): """ Method to create pool's :param pools: List containing pool's desired to be created on database :return: None """ data = {'server_pools': pools} return super(ApiPool, self).post('api/v3/pool/', data)
python
def create(self, pools): """ Method to create pool's :param pools: List containing pool's desired to be created on database :return: None """ data = {'server_pools': pools} return super(ApiPool, self).post('api/v3/pool/', data)
[ "def", "create", "(", "self", ",", "pools", ")", ":", "data", "=", "{", "'server_pools'", ":", "pools", "}", "return", "super", "(", "ApiPool", ",", "self", ")", ".", "post", "(", "'api/v3/pool/'", ",", "data", ")" ]
Method to create pool's :param pools: List containing pool's desired to be created on database :return: None
[ "Method", "to", "create", "pool", "s" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPool.py#L125-L134
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.get_real_related
def get_real_related(self, id_equip): """ Find reals related with equipment :param id_equip: Identifier of equipment :return: Following dictionary: :: {'vips': [{'port_real': < port_real >, 'server_pool_member_id': < server_pool_member_id >, 'ip': < ip >, 'port_vip': < port_vip >, 'host_name': < host_name >, 'id_vip': < id_vip >, ...], 'equip_name': < equip_name > }} :raise EquipamentoNaoExisteError: Equipment not registered. :raise InvalidParameterError: Some parameter was invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'equipamento/get_real_related/' + str(id_equip) + '/' code, xml = self.submit(None, 'GET', url) data = self.response(code, xml) return data
python
def get_real_related(self, id_equip): """ Find reals related with equipment :param id_equip: Identifier of equipment :return: Following dictionary: :: {'vips': [{'port_real': < port_real >, 'server_pool_member_id': < server_pool_member_id >, 'ip': < ip >, 'port_vip': < port_vip >, 'host_name': < host_name >, 'id_vip': < id_vip >, ...], 'equip_name': < equip_name > }} :raise EquipamentoNaoExisteError: Equipment not registered. :raise InvalidParameterError: Some parameter was invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'equipamento/get_real_related/' + str(id_equip) + '/' code, xml = self.submit(None, 'GET', url) data = self.response(code, xml) return data
[ "def", "get_real_related", "(", "self", ",", "id_equip", ")", ":", "url", "=", "'equipamento/get_real_related/'", "+", "str", "(", "id_equip", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "data", "=", "self", ".", "response", "(", "code", ",", "xml", ")", "return", "data" ]
Find reals related with equipment :param id_equip: Identifier of equipment :return: Following dictionary: :: {'vips': [{'port_real': < port_real >, 'server_pool_member_id': < server_pool_member_id >, 'ip': < ip >, 'port_vip': < port_vip >, 'host_name': < host_name >, 'id_vip': < id_vip >, ...], 'equip_name': < equip_name > }} :raise EquipamentoNaoExisteError: Equipment not registered. :raise InvalidParameterError: Some parameter was invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Find", "reals", "related", "with", "equipment" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L40-L68
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.find_equips
def find_equips( self, name, iexact, environment, equip_type, group, ip, pagination): """ Find vlans by all search parameters :param name: Filter by vlan name column :param iexact: Filter by name will be exact? :param environment: Filter by environment ID related :param equip_type: Filter by equipment_type ID related :param group: Filter by equipment group ID related :param ip: Filter by each octs in ips related :param pagination: Class with all data needed to paginate :return: Following dictionary: :: {'equipamento': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_ambiente': < id_ambiente >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >, 'ambiente_name': < divisao_dc-ambiente_logico-grupo_l3 > 'redeipv4': [ { all networkipv4 related } ], 'redeipv6': [ { all networkipv6 related } ] }, 'total': {< total_registros >} } :raise InvalidParameterError: Some parameter was invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not isinstance(pagination, Pagination): raise InvalidParameterError( u"Invalid parameter: pagination must be a class of type 'Pagination'.") equip_map = dict() equip_map["start_record"] = pagination.start_record equip_map["end_record"] = pagination.end_record equip_map["asorting_cols"] = pagination.asorting_cols equip_map["searchable_columns"] = pagination.searchable_columns equip_map["custom_search"] = pagination.custom_search equip_map["nome"] = name equip_map["exato"] = iexact equip_map["ambiente"] = environment equip_map["tipo_equipamento"] = equip_type equip_map["grupo"] = group equip_map["ip"] = ip url = "equipamento/find/" code, xml = self.submit({"equipamento": equip_map}, "POST", url) key = "equipamento" return get_list_map( self.response( code, xml, [ key, "ips", "grupos"]), key)
python
def find_equips( self, name, iexact, environment, equip_type, group, ip, pagination): """ Find vlans by all search parameters :param name: Filter by vlan name column :param iexact: Filter by name will be exact? :param environment: Filter by environment ID related :param equip_type: Filter by equipment_type ID related :param group: Filter by equipment group ID related :param ip: Filter by each octs in ips related :param pagination: Class with all data needed to paginate :return: Following dictionary: :: {'equipamento': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_ambiente': < id_ambiente >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >, 'ambiente_name': < divisao_dc-ambiente_logico-grupo_l3 > 'redeipv4': [ { all networkipv4 related } ], 'redeipv6': [ { all networkipv6 related } ] }, 'total': {< total_registros >} } :raise InvalidParameterError: Some parameter was invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ if not isinstance(pagination, Pagination): raise InvalidParameterError( u"Invalid parameter: pagination must be a class of type 'Pagination'.") equip_map = dict() equip_map["start_record"] = pagination.start_record equip_map["end_record"] = pagination.end_record equip_map["asorting_cols"] = pagination.asorting_cols equip_map["searchable_columns"] = pagination.searchable_columns equip_map["custom_search"] = pagination.custom_search equip_map["nome"] = name equip_map["exato"] = iexact equip_map["ambiente"] = environment equip_map["tipo_equipamento"] = equip_type equip_map["grupo"] = group equip_map["ip"] = ip url = "equipamento/find/" code, xml = self.submit({"equipamento": equip_map}, "POST", url) key = "equipamento" return get_list_map( self.response( code, xml, [ key, "ips", "grupos"]), key)
[ "def", "find_equips", "(", "self", ",", "name", ",", "iexact", ",", "environment", ",", "equip_type", ",", "group", ",", "ip", ",", "pagination", ")", ":", "if", "not", "isinstance", "(", "pagination", ",", "Pagination", ")", ":", "raise", "InvalidParameterError", "(", "u\"Invalid parameter: pagination must be a class of type 'Pagination'.\"", ")", "equip_map", "=", "dict", "(", ")", "equip_map", "[", "\"start_record\"", "]", "=", "pagination", ".", "start_record", "equip_map", "[", "\"end_record\"", "]", "=", "pagination", ".", "end_record", "equip_map", "[", "\"asorting_cols\"", "]", "=", "pagination", ".", "asorting_cols", "equip_map", "[", "\"searchable_columns\"", "]", "=", "pagination", ".", "searchable_columns", "equip_map", "[", "\"custom_search\"", "]", "=", "pagination", ".", "custom_search", "equip_map", "[", "\"nome\"", "]", "=", "name", "equip_map", "[", "\"exato\"", "]", "=", "iexact", "equip_map", "[", "\"ambiente\"", "]", "=", "environment", "equip_map", "[", "\"tipo_equipamento\"", "]", "=", "equip_type", "equip_map", "[", "\"grupo\"", "]", "=", "group", "equip_map", "[", "\"ip\"", "]", "=", "ip", "url", "=", "\"equipamento/find/\"", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "\"equipamento\"", ":", "equip_map", "}", ",", "\"POST\"", ",", "url", ")", "key", "=", "\"equipamento\"", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "xml", ",", "[", "key", ",", "\"ips\"", ",", "\"grupos\"", "]", ")", ",", "key", ")" ]
Find vlans by all search parameters :param name: Filter by vlan name column :param iexact: Filter by name will be exact? :param environment: Filter by environment ID related :param equip_type: Filter by equipment_type ID related :param group: Filter by equipment group ID related :param ip: Filter by each octs in ips related :param pagination: Class with all data needed to paginate :return: Following dictionary: :: {'equipamento': {'id': < id_vlan >, 'nome': < nome_vlan >, 'num_vlan': < num_vlan >, 'id_ambiente': < id_ambiente >, 'descricao': < descricao >, 'acl_file_name': < acl_file_name >, 'acl_valida': < acl_valida >, 'ativada': < ativada >, 'ambiente_name': < divisao_dc-ambiente_logico-grupo_l3 > 'redeipv4': [ { all networkipv4 related } ], 'redeipv6': [ { all networkipv6 related } ] }, 'total': {< total_registros >} } :raise InvalidParameterError: Some parameter was invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Find", "vlans", "by", "all", "search", "parameters" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L70-L139
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.inserir
def inserir(self, name, id_equipment_type, id_model, id_group, maintenance=False): """Inserts a new Equipment and returns its identifier Além de inserir o equipamento, a networkAPI também associa o equipamento ao grupo informado. :param name: Equipment name. String with a minimum 3 and maximum of 30 characters :param id_equipment_type: Identifier of the Equipment Type. Integer value and greater than zero. :param id_model: Identifier of the Model. 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: :: {'equipamento': {'id': < id_equipamento >}, 'equipamento_grupo': {'id': < id_grupo_equipamento >}} :raise InvalidParameterError: The identifier of Equipment type, model, group or name is null and invalid. :raise TipoEquipamentoNaoExisteError: Equipment Type not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise GrupoEquipamentoNaoExisteError: Group not registered. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ equip_map = dict() equip_map['id_tipo_equipamento'] = id_equipment_type equip_map['id_modelo'] = id_model equip_map['nome'] = name equip_map['id_grupo'] = id_group equip_map['maintenance'] = maintenance code, xml = self.submit( {'equipamento': equip_map}, 'POST', 'equipamento/') return self.response(code, xml)
python
def inserir(self, name, id_equipment_type, id_model, id_group, maintenance=False): """Inserts a new Equipment and returns its identifier Além de inserir o equipamento, a networkAPI também associa o equipamento ao grupo informado. :param name: Equipment name. String with a minimum 3 and maximum of 30 characters :param id_equipment_type: Identifier of the Equipment Type. Integer value and greater than zero. :param id_model: Identifier of the Model. 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: :: {'equipamento': {'id': < id_equipamento >}, 'equipamento_grupo': {'id': < id_grupo_equipamento >}} :raise InvalidParameterError: The identifier of Equipment type, model, group or name is null and invalid. :raise TipoEquipamentoNaoExisteError: Equipment Type not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise GrupoEquipamentoNaoExisteError: Group not registered. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ equip_map = dict() equip_map['id_tipo_equipamento'] = id_equipment_type equip_map['id_modelo'] = id_model equip_map['nome'] = name equip_map['id_grupo'] = id_group equip_map['maintenance'] = maintenance code, xml = self.submit( {'equipamento': equip_map}, 'POST', 'equipamento/') return self.response(code, xml)
[ "def", "inserir", "(", "self", ",", "name", ",", "id_equipment_type", ",", "id_model", ",", "id_group", ",", "maintenance", "=", "False", ")", ":", "equip_map", "=", "dict", "(", ")", "equip_map", "[", "'id_tipo_equipamento'", "]", "=", "id_equipment_type", "equip_map", "[", "'id_modelo'", "]", "=", "id_model", "equip_map", "[", "'nome'", "]", "=", "name", "equip_map", "[", "'id_grupo'", "]", "=", "id_group", "equip_map", "[", "'maintenance'", "]", "=", "maintenance", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'equipamento'", ":", "equip_map", "}", ",", "'POST'", ",", "'equipamento/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Inserts a new Equipment and returns its identifier Além de inserir o equipamento, a networkAPI também associa o equipamento ao grupo informado. :param name: Equipment name. String with a minimum 3 and maximum of 30 characters :param id_equipment_type: Identifier of the Equipment Type. Integer value and greater than zero. :param id_model: Identifier of the Model. 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: :: {'equipamento': {'id': < id_equipamento >}, 'equipamento_grupo': {'id': < id_grupo_equipamento >}} :raise InvalidParameterError: The identifier of Equipment type, model, group or name is null and invalid. :raise TipoEquipamentoNaoExisteError: Equipment Type not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise GrupoEquipamentoNaoExisteError: Group not registered. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response
[ "Inserts", "a", "new", "Equipment", "and", "returns", "its", "identifier" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L141-L181
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.edit
def edit(self, id_equip, nome, id_tipo_equipamento, id_modelo, maintenance=None): """Change Equipment from by the identifier. :param id_equip: Identifier of the Equipment. Integer value and greater than zero. :param nome: Equipment name. String with a minimum 3 and maximum of 30 characters :param id_tipo_equipamento: Identifier of the Equipment Type. Integer value and greater than zero. :param id_modelo: Identifier of the Model. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Equipment, model, equipment type or name is null and invalid. :raise EquipamentoNaoExisteError: Equipment not registered. :raise TipoEquipamentoNaoExisteError: Equipment Type not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise GrupoEquipamentoNaoExisteError: Group not registered. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ equip_map = dict() equip_map['id_equip'] = id_equip equip_map['id_tipo_equipamento'] = id_tipo_equipamento equip_map['id_modelo'] = id_modelo equip_map['nome'] = nome if maintenance is not None: equip_map['maintenance'] = maintenance url = 'equipamento/edit/' + str(id_equip) + '/' code, xml = self.submit({'equipamento': equip_map}, 'POST', url) return self.response(code, xml)
python
def edit(self, id_equip, nome, id_tipo_equipamento, id_modelo, maintenance=None): """Change Equipment from by the identifier. :param id_equip: Identifier of the Equipment. Integer value and greater than zero. :param nome: Equipment name. String with a minimum 3 and maximum of 30 characters :param id_tipo_equipamento: Identifier of the Equipment Type. Integer value and greater than zero. :param id_modelo: Identifier of the Model. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Equipment, model, equipment type or name is null and invalid. :raise EquipamentoNaoExisteError: Equipment not registered. :raise TipoEquipamentoNaoExisteError: Equipment Type not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise GrupoEquipamentoNaoExisteError: Group not registered. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response """ equip_map = dict() equip_map['id_equip'] = id_equip equip_map['id_tipo_equipamento'] = id_tipo_equipamento equip_map['id_modelo'] = id_modelo equip_map['nome'] = nome if maintenance is not None: equip_map['maintenance'] = maintenance url = 'equipamento/edit/' + str(id_equip) + '/' code, xml = self.submit({'equipamento': equip_map}, 'POST', url) return self.response(code, xml)
[ "def", "edit", "(", "self", ",", "id_equip", ",", "nome", ",", "id_tipo_equipamento", ",", "id_modelo", ",", "maintenance", "=", "None", ")", ":", "equip_map", "=", "dict", "(", ")", "equip_map", "[", "'id_equip'", "]", "=", "id_equip", "equip_map", "[", "'id_tipo_equipamento'", "]", "=", "id_tipo_equipamento", "equip_map", "[", "'id_modelo'", "]", "=", "id_modelo", "equip_map", "[", "'nome'", "]", "=", "nome", "if", "maintenance", "is", "not", "None", ":", "equip_map", "[", "'maintenance'", "]", "=", "maintenance", "url", "=", "'equipamento/edit/'", "+", "str", "(", "id_equip", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'equipamento'", ":", "equip_map", "}", ",", "'POST'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Change Equipment from by the identifier. :param id_equip: Identifier of the Equipment. Integer value and greater than zero. :param nome: Equipment name. String with a minimum 3 and maximum of 30 characters :param id_tipo_equipamento: Identifier of the Equipment Type. Integer value and greater than zero. :param id_modelo: Identifier of the Model. Integer value and greater than zero. :return: None :raise InvalidParameterError: The identifier of Equipment, model, equipment type or name is null and invalid. :raise EquipamentoNaoExisteError: Equipment not registered. :raise TipoEquipamentoNaoExisteError: Equipment Type not registered. :raise ModeloEquipamentoNaoExisteError: Model not registered. :raise GrupoEquipamentoNaoExisteError: Group not registered. :raise EquipamentoError: Equipamento com o nome duplicado ou Equipamento do grupo “Equipamentos Orquestração” somente poderá ser criado com tipo igual a “Servidor Virtual". :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response
[ "Change", "Equipment", "from", "by", "the", "identifier", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L183-L220
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.criar_ip
def criar_ip(self, id_vlan, id_equipamento, descricao): """Aloca um IP em uma VLAN para um equipamento. Insere um novo IP para a VLAN e o associa ao equipamento. :param id_vlan: Identificador da vlan. :param id_equipamento: Identificador do equipamento. :param descricao: Descriçao do IP. :return: Dicionário com a seguinte estrutura: :: {'ip': {'id': < id_ip >, 'id_network_ipv4': < id_network_ipv4 >, 'oct1’: < oct1 >, 'oct2': < oct2 >, 'oct3': < oct3 >, 'oct4': < oct4 >, 'descricao': < descricao >}} :raise InvalidParameterError: O identificador da VLAN e/ou do equipamento são nulos ou inválidos. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise VlanNaoExisteError: VLAN não cadastrada. :raise IPNaoDisponivelError: Não existe IP disponível para a VLAN informada. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. """ ip_map = dict() ip_map['id_vlan'] = id_vlan ip_map['descricao'] = descricao ip_map['id_equipamento'] = id_equipamento code, xml = self.submit({'ip': ip_map}, 'POST', 'ip/') return self.response(code, xml)
python
def criar_ip(self, id_vlan, id_equipamento, descricao): """Aloca um IP em uma VLAN para um equipamento. Insere um novo IP para a VLAN e o associa ao equipamento. :param id_vlan: Identificador da vlan. :param id_equipamento: Identificador do equipamento. :param descricao: Descriçao do IP. :return: Dicionário com a seguinte estrutura: :: {'ip': {'id': < id_ip >, 'id_network_ipv4': < id_network_ipv4 >, 'oct1’: < oct1 >, 'oct2': < oct2 >, 'oct3': < oct3 >, 'oct4': < oct4 >, 'descricao': < descricao >}} :raise InvalidParameterError: O identificador da VLAN e/ou do equipamento são nulos ou inválidos. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise VlanNaoExisteError: VLAN não cadastrada. :raise IPNaoDisponivelError: Não existe IP disponível para a VLAN informada. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. """ ip_map = dict() ip_map['id_vlan'] = id_vlan ip_map['descricao'] = descricao ip_map['id_equipamento'] = id_equipamento code, xml = self.submit({'ip': ip_map}, 'POST', 'ip/') return self.response(code, xml)
[ "def", "criar_ip", "(", "self", ",", "id_vlan", ",", "id_equipamento", ",", "descricao", ")", ":", "ip_map", "=", "dict", "(", ")", "ip_map", "[", "'id_vlan'", "]", "=", "id_vlan", "ip_map", "[", "'descricao'", "]", "=", "descricao", "ip_map", "[", "'id_equipamento'", "]", "=", "id_equipamento", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'ip'", ":", "ip_map", "}", ",", "'POST'", ",", "'ip/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Aloca um IP em uma VLAN para um equipamento. Insere um novo IP para a VLAN e o associa ao equipamento. :param id_vlan: Identificador da vlan. :param id_equipamento: Identificador do equipamento. :param descricao: Descriçao do IP. :return: Dicionário com a seguinte estrutura: :: {'ip': {'id': < id_ip >, 'id_network_ipv4': < id_network_ipv4 >, 'oct1’: < oct1 >, 'oct2': < oct2 >, 'oct3': < oct3 >, 'oct4': < oct4 >, 'descricao': < descricao >}} :raise InvalidParameterError: O identificador da VLAN e/ou do equipamento são nulos ou inválidos. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise VlanNaoExisteError: VLAN não cadastrada. :raise IPNaoDisponivelError: Não existe IP disponível para a VLAN informada. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta.
[ "Aloca", "um", "IP", "em", "uma", "VLAN", "para", "um", "equipamento", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L222-L257
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.add_ipv4
def add_ipv4(self, id_network_ipv4, id_equipamento, descricao): """Allocate an IP on a network to an equipment. Insert new IP for network and associate to the equipment :param id_network_ipv4: ID for NetworkIPv4. :param id_equipamento: ID for Equipment. :param descricao: Description for IP. :return: Following dictionary: :: {'ip': {'id': < id_ip >, 'id_network_ipv4': < id_network_ipv4 >, 'oct1’: < oct1 >, 'oct2': < oct2 >, 'oct3': < oct3 >, 'oct4': < oct4 >, 'descricao': < descricao >}} :raise InvalidParameterError: Invalid ID for NetworkIPv4 or Equipment. :raise InvalidParameterError: The value of description is invalid. :raise EquipamentoNaoExisteError: Equipment not found. :raise RedeIPv4NaoExisteError: NetworkIPv4 not found. :raise IPNaoDisponivelError: There is no network address is available to create the VLAN. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ ip_map = dict() ip_map['id_network_ipv4'] = id_network_ipv4 ip_map['description'] = descricao ip_map['id_equipment'] = id_equipamento code, xml = self.submit({'ip': ip_map}, 'POST', 'ipv4/') return self.response(code, xml)
python
def add_ipv4(self, id_network_ipv4, id_equipamento, descricao): """Allocate an IP on a network to an equipment. Insert new IP for network and associate to the equipment :param id_network_ipv4: ID for NetworkIPv4. :param id_equipamento: ID for Equipment. :param descricao: Description for IP. :return: Following dictionary: :: {'ip': {'id': < id_ip >, 'id_network_ipv4': < id_network_ipv4 >, 'oct1’: < oct1 >, 'oct2': < oct2 >, 'oct3': < oct3 >, 'oct4': < oct4 >, 'descricao': < descricao >}} :raise InvalidParameterError: Invalid ID for NetworkIPv4 or Equipment. :raise InvalidParameterError: The value of description is invalid. :raise EquipamentoNaoExisteError: Equipment not found. :raise RedeIPv4NaoExisteError: NetworkIPv4 not found. :raise IPNaoDisponivelError: There is no network address is available to create the VLAN. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ ip_map = dict() ip_map['id_network_ipv4'] = id_network_ipv4 ip_map['description'] = descricao ip_map['id_equipment'] = id_equipamento code, xml = self.submit({'ip': ip_map}, 'POST', 'ipv4/') return self.response(code, xml)
[ "def", "add_ipv4", "(", "self", ",", "id_network_ipv4", ",", "id_equipamento", ",", "descricao", ")", ":", "ip_map", "=", "dict", "(", ")", "ip_map", "[", "'id_network_ipv4'", "]", "=", "id_network_ipv4", "ip_map", "[", "'description'", "]", "=", "descricao", "ip_map", "[", "'id_equipment'", "]", "=", "id_equipamento", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'ip'", ":", "ip_map", "}", ",", "'POST'", ",", "'ipv4/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Allocate an IP on a network to an equipment. Insert new IP for network and associate to the equipment :param id_network_ipv4: ID for NetworkIPv4. :param id_equipamento: ID for Equipment. :param descricao: Description for IP. :return: Following dictionary: :: {'ip': {'id': < id_ip >, 'id_network_ipv4': < id_network_ipv4 >, 'oct1’: < oct1 >, 'oct2': < oct2 >, 'oct3': < oct3 >, 'oct4': < oct4 >, 'descricao': < descricao >}} :raise InvalidParameterError: Invalid ID for NetworkIPv4 or Equipment. :raise InvalidParameterError: The value of description is invalid. :raise EquipamentoNaoExisteError: Equipment not found. :raise RedeIPv4NaoExisteError: NetworkIPv4 not found. :raise IPNaoDisponivelError: There is no network address is available to create the VLAN. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Allocate", "an", "IP", "on", "a", "network", "to", "an", "equipment", ".", "Insert", "new", "IP", "for", "network", "and", "associate", "to", "the", "equipment" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L259-L296
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.add_ipv6
def add_ipv6(self, id_network_ipv6, id_equip, description): """Allocate an IP on a network to an equipment. Insert new IP for network and associate to the equipment :param id_network_ipv6: ID for NetworkIPv6. :param id_equip: ID for Equipment. :param description: Description for IP. :return: Following dictionary: :: {'ip': {'id': < id_ip >, 'id_network_ipv6': < id_network_ipv6 >, 'bloco1': < bloco1 >, 'bloco2': < bloco2 >, 'bloco3': < bloco3 >, 'bloco4': < bloco4 >, 'bloco5': < bloco5 >, 'bloco6': < bloco6 >, 'bloco7': < bloco7 >, 'bloco8': < bloco8 >, 'descricao': < descricao >}} :raise InvalidParameterError: NetworkIPv6 identifier or Equipament identifier is null and invalid, :raise InvalidParameterError: The value of description is invalid. :raise EquipamentoNaoExisteError: Equipment not found. :raise RedeIPv6NaoExisteError: NetworkIPv6 not found. :raise IPNaoDisponivelError: There is no network address is available to create the VLAN. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ ip_map = dict() ip_map['id_network_ipv6'] = id_network_ipv6 ip_map['description'] = description ip_map['id_equip'] = id_equip code, xml = self.submit({'ip': ip_map}, 'POST', 'ipv6/') return self.response(code, xml)
python
def add_ipv6(self, id_network_ipv6, id_equip, description): """Allocate an IP on a network to an equipment. Insert new IP for network and associate to the equipment :param id_network_ipv6: ID for NetworkIPv6. :param id_equip: ID for Equipment. :param description: Description for IP. :return: Following dictionary: :: {'ip': {'id': < id_ip >, 'id_network_ipv6': < id_network_ipv6 >, 'bloco1': < bloco1 >, 'bloco2': < bloco2 >, 'bloco3': < bloco3 >, 'bloco4': < bloco4 >, 'bloco5': < bloco5 >, 'bloco6': < bloco6 >, 'bloco7': < bloco7 >, 'bloco8': < bloco8 >, 'descricao': < descricao >}} :raise InvalidParameterError: NetworkIPv6 identifier or Equipament identifier is null and invalid, :raise InvalidParameterError: The value of description is invalid. :raise EquipamentoNaoExisteError: Equipment not found. :raise RedeIPv6NaoExisteError: NetworkIPv6 not found. :raise IPNaoDisponivelError: There is no network address is available to create the VLAN. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ ip_map = dict() ip_map['id_network_ipv6'] = id_network_ipv6 ip_map['description'] = description ip_map['id_equip'] = id_equip code, xml = self.submit({'ip': ip_map}, 'POST', 'ipv6/') return self.response(code, xml)
[ "def", "add_ipv6", "(", "self", ",", "id_network_ipv6", ",", "id_equip", ",", "description", ")", ":", "ip_map", "=", "dict", "(", ")", "ip_map", "[", "'id_network_ipv6'", "]", "=", "id_network_ipv6", "ip_map", "[", "'description'", "]", "=", "description", "ip_map", "[", "'id_equip'", "]", "=", "id_equip", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'ip'", ":", "ip_map", "}", ",", "'POST'", ",", "'ipv6/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Allocate an IP on a network to an equipment. Insert new IP for network and associate to the equipment :param id_network_ipv6: ID for NetworkIPv6. :param id_equip: ID for Equipment. :param description: Description for IP. :return: Following dictionary: :: {'ip': {'id': < id_ip >, 'id_network_ipv6': < id_network_ipv6 >, 'bloco1': < bloco1 >, 'bloco2': < bloco2 >, 'bloco3': < bloco3 >, 'bloco4': < bloco4 >, 'bloco5': < bloco5 >, 'bloco6': < bloco6 >, 'bloco7': < bloco7 >, 'bloco8': < bloco8 >, 'descricao': < descricao >}} :raise InvalidParameterError: NetworkIPv6 identifier or Equipament identifier is null and invalid, :raise InvalidParameterError: The value of description is invalid. :raise EquipamentoNaoExisteError: Equipment not found. :raise RedeIPv6NaoExisteError: NetworkIPv6 not found. :raise IPNaoDisponivelError: There is no network address is available to create the VLAN. :raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Allocate", "an", "IP", "on", "a", "network", "to", "an", "equipment", ".", "Insert", "new", "IP", "for", "network", "and", "associate", "to", "the", "equipment" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L298-L339
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.remover_ip
def remover_ip(self, id_equipamento, id_ip): """Removes association of IP and Equipment. If IP has no other association with equipments, IP is also removed. :param id_equipamento: Equipment identifier :param id_ip: IP identifier. :return: None :raise VipIpError: Ip can't be removed because there is a created Vip Request. :raise IpEquipCantDissociateFromVip: Equipment is the last balancer for created Vip Request. :raise IpError: IP not associated with equipment. :raise InvalidParameterError: Equipment or IP identifier is none or invalid. :raise EquipamentoNaoExisteError: Equipment doesn't exist. :raise DataBaseError: Networkapi failed to access database. :raise XMLError: Networkapi failed to build response XML. """ 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, 'DELETE', url) return self.response(code, xml)
python
def remover_ip(self, id_equipamento, id_ip): """Removes association of IP and Equipment. If IP has no other association with equipments, IP is also removed. :param id_equipamento: Equipment identifier :param id_ip: IP identifier. :return: None :raise VipIpError: Ip can't be removed because there is a created Vip Request. :raise IpEquipCantDissociateFromVip: Equipment is the last balancer for created Vip Request. :raise IpError: IP not associated with equipment. :raise InvalidParameterError: Equipment or IP identifier is none or invalid. :raise EquipamentoNaoExisteError: Equipment doesn't exist. :raise DataBaseError: Networkapi failed to access database. :raise XMLError: Networkapi failed to build response XML. """ 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, 'DELETE', url) return self.response(code, xml)
[ "def", "remover_ip", "(", "self", ",", "id_equipamento", ",", "id_ip", ")", ":", "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", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Removes association of IP and Equipment. If IP has no other association with equipments, IP is also removed. :param id_equipamento: Equipment identifier :param id_ip: IP identifier. :return: None :raise VipIpError: Ip can't be removed because there is a created Vip Request. :raise IpEquipCantDissociateFromVip: Equipment is the last balancer for created Vip Request. :raise IpError: IP not associated with equipment. :raise InvalidParameterError: Equipment or IP identifier is none or invalid. :raise EquipamentoNaoExisteError: Equipment doesn't exist. :raise DataBaseError: Networkapi failed to access database. :raise XMLError: Networkapi failed to build response XML.
[ "Removes", "association", "of", "IP", "and", "Equipment", ".", "If", "IP", "has", "no", "other", "association", "with", "equipments", "IP", "is", "also", "removed", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L341-L371
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.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)
python
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)
[ "def", "associate_ipv6", "(", "self", ",", "id_equip", ",", "id_ipv6", ")", ":", "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", ")" ]
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.
[ "Associates", "an", "IPv6", "to", "a", "equipament", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L404-L433
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.listar_por_tipo_ambiente
def listar_por_tipo_ambiente(self, id_tipo_equipamento, id_ambiente): """Lista os equipamentos de um tipo e que estão associados a um ambiente. :param id_tipo_equipamento: Identificador do tipo do equipamento. :param id_ambiente: Identificador do ambiente. :return: Dicionário com a seguinte estrutura: :: {'equipamento': [{'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca > }, ... demais equipamentos ...]} :raise InvalidParameterError: O identificador do tipo de equipamento e/ou do ambiente 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_tipo_equipamento): raise InvalidParameterError( u'O identificador do tipo do equipamento é inválido ou não foi informado.') if not is_valid_int_param(id_ambiente): raise InvalidParameterError( u'O identificador do ambiente é inválido ou não foi informado.') url = 'equipamento/tipoequipamento/' + \ str(id_tipo_equipamento) + '/ambiente/' + str(id_ambiente) + '/' code, xml = self.submit(None, 'GET', url) key = 'equipamento' return get_list_map(self.response(code, xml, [key]), key)
python
def listar_por_tipo_ambiente(self, id_tipo_equipamento, id_ambiente): """Lista os equipamentos de um tipo e que estão associados a um ambiente. :param id_tipo_equipamento: Identificador do tipo do equipamento. :param id_ambiente: Identificador do ambiente. :return: Dicionário com a seguinte estrutura: :: {'equipamento': [{'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca > }, ... demais equipamentos ...]} :raise InvalidParameterError: O identificador do tipo de equipamento e/ou do ambiente 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_tipo_equipamento): raise InvalidParameterError( u'O identificador do tipo do equipamento é inválido ou não foi informado.') if not is_valid_int_param(id_ambiente): raise InvalidParameterError( u'O identificador do ambiente é inválido ou não foi informado.') url = 'equipamento/tipoequipamento/' + \ str(id_tipo_equipamento) + '/ambiente/' + str(id_ambiente) + '/' code, xml = self.submit(None, 'GET', url) key = 'equipamento' return get_list_map(self.response(code, xml, [key]), key)
[ "def", "listar_por_tipo_ambiente", "(", "self", ",", "id_tipo_equipamento", ",", "id_ambiente", ")", ":", "if", "not", "is_valid_int_param", "(", "id_tipo_equipamento", ")", ":", "raise", "InvalidParameterError", "(", "u'O identificador do tipo do equipamento é inválido ou não foi informado.')", "", "if", "not", "is_valid_int_param", "(", "id_ambiente", ")", ":", "raise", "InvalidParameterError", "(", "u'O identificador do ambiente é inválido ou não foi informado.')", "", "url", "=", "'equipamento/tipoequipamento/'", "+", "str", "(", "id_tipo_equipamento", ")", "+", "'/ambiente/'", "+", "str", "(", "id_ambiente", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "key", "=", "'equipamento'", "return", "get_list_map", "(", "self", ".", "response", "(", "code", ",", "xml", ",", "[", "key", "]", ")", ",", "key", ")" ]
Lista os equipamentos de um tipo e que estão associados a um ambiente. :param id_tipo_equipamento: Identificador do tipo do equipamento. :param id_ambiente: Identificador do ambiente. :return: Dicionário com a seguinte estrutura: :: {'equipamento': [{'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca > }, ... demais equipamentos ...]} :raise InvalidParameterError: O identificador do tipo de equipamento e/ou do ambiente 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.
[ "Lista", "os", "equipamentos", "de", "um", "tipo", "e", "que", "estão", "associados", "a", "um", "ambiente", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L466-L505
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.listar_por_nome
def listar_por_nome(self, nome): """Obtém um equipamento a partir do seu nome. :param nome: Nome do equipamento. :return: Dicionário com a seguinte estrutura: :: {'equipamento': {'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca >}} :raise EquipamentoNaoExisteError: Equipamento com o nome informado não cadastrado. :raise InvalidParameterError: O nome do equipamento é nulo ou vazio. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao gerar o XML de resposta. """ if nome == '' or nome is None: raise InvalidParameterError( u'O nome do equipamento não foi informado.') url = 'equipamento/nome/' + urllib.quote(nome) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def listar_por_nome(self, nome): """Obtém um equipamento a partir do seu nome. :param nome: Nome do equipamento. :return: Dicionário com a seguinte estrutura: :: {'equipamento': {'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca >}} :raise EquipamentoNaoExisteError: Equipamento com o nome informado não cadastrado. :raise InvalidParameterError: O nome do equipamento é nulo ou vazio. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao gerar o XML de resposta. """ if nome == '' or nome is None: raise InvalidParameterError( u'O nome do equipamento não foi informado.') url = 'equipamento/nome/' + urllib.quote(nome) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "listar_por_nome", "(", "self", ",", "nome", ")", ":", "if", "nome", "==", "''", "or", "nome", "is", "None", ":", "raise", "InvalidParameterError", "(", "u'O nome do equipamento não foi informado.')", "", "url", "=", "'equipamento/nome/'", "+", "urllib", ".", "quote", "(", "nome", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Obtém um equipamento a partir do seu nome. :param nome: Nome do equipamento. :return: Dicionário com a seguinte estrutura: :: {'equipamento': {'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca >}} :raise EquipamentoNaoExisteError: Equipamento com o nome informado não cadastrado. :raise InvalidParameterError: O nome do equipamento é nulo ou vazio. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao gerar o XML de resposta.
[ "Obtém", "um", "equipamento", "a", "partir", "do", "seu", "nome", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L507-L540
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.listar_por_id
def listar_por_id(self, id): """Obtém um equipamento a partir do seu identificador. :param id: ID do equipamento. :return: Dicionário com a seguinte estrutura: :: {'equipamento': {'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca >}} :raise EquipamentoNaoExisteError: Equipamento com o id informado não cadastrado. :raise InvalidParameterError: O nome do equipamento é nulo ou vazio. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao gerar o XML de resposta. """ if id is None: raise InvalidParameterError( u'O id do equipamento não foi informado.') url = 'equipamento/id/' + urllib.quote(id) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def listar_por_id(self, id): """Obtém um equipamento a partir do seu identificador. :param id: ID do equipamento. :return: Dicionário com a seguinte estrutura: :: {'equipamento': {'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca >}} :raise EquipamentoNaoExisteError: Equipamento com o id informado não cadastrado. :raise InvalidParameterError: O nome do equipamento é nulo ou vazio. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao gerar o XML de resposta. """ if id is None: raise InvalidParameterError( u'O id do equipamento não foi informado.') url = 'equipamento/id/' + urllib.quote(id) + '/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "listar_por_id", "(", "self", ",", "id", ")", ":", "if", "id", "is", "None", ":", "raise", "InvalidParameterError", "(", "u'O id do equipamento não foi informado.')", "", "url", "=", "'equipamento/id/'", "+", "urllib", ".", "quote", "(", "id", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Obtém um equipamento a partir do seu identificador. :param id: ID do equipamento. :return: Dicionário com a seguinte estrutura: :: {'equipamento': {'id': < id_equipamento >, 'nome': < nome_equipamento >, 'id_tipo_equipamento': < id_tipo_equipamento >, 'nome_tipo_equipamento': < nome_tipo_equipamento >, 'id_modelo': < id_modelo >, 'nome_modelo': < nome_modelo >, 'id_marca': < id_marca >, 'nome_marca': < nome_marca >}} :raise EquipamentoNaoExisteError: Equipamento com o id informado não cadastrado. :raise InvalidParameterError: O nome do equipamento é nulo ou vazio. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao gerar o XML de resposta.
[ "Obtém", "um", "equipamento", "a", "partir", "do", "seu", "identificador", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L542-L575
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.list_all
def list_all(self): """Return all equipments in database :return: Dictionary with the following structure: :: {'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'equipamento/list/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def list_all(self): """Return all equipments in database :return: Dictionary with the following structure: :: {'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'equipamento/list/' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "list_all", "(", "self", ")", ":", "url", "=", "'equipamento/list/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Return all equipments in database :return: Dictionary with the following structure: :: {'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Return", "all", "equipments", "in", "database" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L577-L594
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.get_all
def get_all(self): """Return all equipments in database :return: Dictionary with the following structure: :: {'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'equipment/all' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
python
def get_all(self): """Return all equipments in database :return: Dictionary with the following structure: :: {'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """ url = 'equipment/all' code, xml = self.submit(None, 'GET', url) return self.response(code, xml)
[ "def", "get_all", "(", "self", ")", ":", "url", "=", "'equipment/all'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Return all equipments in database :return: Dictionary with the following structure: :: {'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response.
[ "Return", "all", "equipments", "in", "database" ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L596-L612
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.remover
def remover(self, id_equipamento): """Remove um equipamento a partir do seu identificador. Além de remover o equipamento, a API também remove: - O relacionamento do equipamento com os tipos de acessos. - O relacionamento do equipamento com os roteiros. - O relacionamento do equipamento com os IPs. - As interfaces do equipamento. - O relacionamento do equipamento com os ambientes. - O relacionamento do equipamento com os grupos. :param id_equipamento: Identificador do equipamento. :return: None :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise InvalidParameterError: O identificador do equipamento é 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_equipamento): raise InvalidParameterError( u'O identificador do equipamento é inválido ou não foi informado.') url = 'equipamento/' + str(id_equipamento) + '/' code, map = self.submit(None, 'DELETE', url) return self.response(code, map)
python
def remover(self, id_equipamento): """Remove um equipamento a partir do seu identificador. Além de remover o equipamento, a API também remove: - O relacionamento do equipamento com os tipos de acessos. - O relacionamento do equipamento com os roteiros. - O relacionamento do equipamento com os IPs. - As interfaces do equipamento. - O relacionamento do equipamento com os ambientes. - O relacionamento do equipamento com os grupos. :param id_equipamento: Identificador do equipamento. :return: None :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise InvalidParameterError: O identificador do equipamento é 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_equipamento): raise InvalidParameterError( u'O identificador do equipamento é inválido ou não foi informado.') url = 'equipamento/' + str(id_equipamento) + '/' code, map = self.submit(None, 'DELETE', url) return self.response(code, map)
[ "def", "remover", "(", "self", ",", "id_equipamento", ")", ":", "if", "not", "is_valid_int_param", "(", "id_equipamento", ")", ":", "raise", "InvalidParameterError", "(", "u'O identificador do equipamento é inválido ou não foi informado.')", "", "url", "=", "'equipamento/'", "+", "str", "(", "id_equipamento", ")", "+", "'/'", "code", ",", "map", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "map", ")" ]
Remove um equipamento a partir do seu identificador. Além de remover o equipamento, a API também remove: - O relacionamento do equipamento com os tipos de acessos. - O relacionamento do equipamento com os roteiros. - O relacionamento do equipamento com os IPs. - As interfaces do equipamento. - O relacionamento do equipamento com os ambientes. - O relacionamento do equipamento com os grupos. :param id_equipamento: Identificador do equipamento. :return: None :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise InvalidParameterError: O identificador do equipamento é 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.
[ "Remove", "um", "equipamento", "a", "partir", "do", "seu", "identificador", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L614-L643
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.associar_grupo
def associar_grupo(self, id_equipamento, id_grupo_equipamento): """Associa um equipamento a um grupo. :param id_equipamento: Identificador do equipamento. :param id_grupo_equipamento: Identificador do grupo de equipamento. :return: Dicionário com a seguinte estrutura: {'equipamento_grupo':{'id': < id_equip_do_grupo >}} :raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado. :raise InvalidParameterError: O identificador do equipamento e/ou do grupo são nulos ou inválidos. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise EquipamentoError: Equipamento já está associado ao grupo. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. """ equip_map = dict() equip_map['id_grupo'] = id_grupo_equipamento equip_map['id_equipamento'] = id_equipamento code, xml = self.submit( {'equipamento_grupo': equip_map}, 'POST', 'equipamentogrupo/') return self.response(code, xml)
python
def associar_grupo(self, id_equipamento, id_grupo_equipamento): """Associa um equipamento a um grupo. :param id_equipamento: Identificador do equipamento. :param id_grupo_equipamento: Identificador do grupo de equipamento. :return: Dicionário com a seguinte estrutura: {'equipamento_grupo':{'id': < id_equip_do_grupo >}} :raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado. :raise InvalidParameterError: O identificador do equipamento e/ou do grupo são nulos ou inválidos. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise EquipamentoError: Equipamento já está associado ao grupo. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta. """ equip_map = dict() equip_map['id_grupo'] = id_grupo_equipamento equip_map['id_equipamento'] = id_equipamento code, xml = self.submit( {'equipamento_grupo': equip_map}, 'POST', 'equipamentogrupo/') return self.response(code, xml)
[ "def", "associar_grupo", "(", "self", ",", "id_equipamento", ",", "id_grupo_equipamento", ")", ":", "equip_map", "=", "dict", "(", ")", "equip_map", "[", "'id_grupo'", "]", "=", "id_grupo_equipamento", "equip_map", "[", "'id_equipamento'", "]", "=", "id_equipamento", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "'equipamento_grupo'", ":", "equip_map", "}", ",", "'POST'", ",", "'equipamentogrupo/'", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Associa um equipamento a um grupo. :param id_equipamento: Identificador do equipamento. :param id_grupo_equipamento: Identificador do grupo de equipamento. :return: Dicionário com a seguinte estrutura: {'equipamento_grupo':{'id': < id_equip_do_grupo >}} :raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado. :raise InvalidParameterError: O identificador do equipamento e/ou do grupo são nulos ou inválidos. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise EquipamentoError: Equipamento já está associado ao grupo. :raise DataBaseError: Falha na networkapi ao acessar o banco de dados. :raise XMLError: Falha na networkapi ao ler o XML de requisição ou gerar o XML de resposta.
[ "Associa", "um", "equipamento", "a", "um", "grupo", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L645-L669
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.remover_grupo
def remover_grupo(self, id_equipamento, id_grupo): """Remove a associação de um equipamento com um grupo de equipamento. :param id_equipamento: Identificador do equipamento. :param id_grupo: Identificador do grupo de equipamento. :return: None :raise EquipamentoGrupoNaoExisteError: Associação entre grupo e equipamento não cadastrada. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise EquipmentDontRemoveError: Failure to remove an association between an equipment and a group because the group is related only to a group. :raise InvalidParameterError: O identificador do equipamento e/ou do grupo 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_grupo): raise InvalidParameterError( u'O identificador do grupo é inválido ou não foi informado.') url = 'equipamentogrupo/equipamento/' + \ str(id_equipamento) + '/egrupo/' + str(id_grupo) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
python
def remover_grupo(self, id_equipamento, id_grupo): """Remove a associação de um equipamento com um grupo de equipamento. :param id_equipamento: Identificador do equipamento. :param id_grupo: Identificador do grupo de equipamento. :return: None :raise EquipamentoGrupoNaoExisteError: Associação entre grupo e equipamento não cadastrada. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise EquipmentDontRemoveError: Failure to remove an association between an equipment and a group because the group is related only to a group. :raise InvalidParameterError: O identificador do equipamento e/ou do grupo 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_grupo): raise InvalidParameterError( u'O identificador do grupo é inválido ou não foi informado.') url = 'equipamentogrupo/equipamento/' + \ str(id_equipamento) + '/egrupo/' + str(id_grupo) + '/' code, xml = self.submit(None, 'DELETE', url) return self.response(code, xml)
[ "def", "remover_grupo", "(", "self", ",", "id_equipamento", ",", "id_grupo", ")", ":", "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_grupo", ")", ":", "raise", "InvalidParameterError", "(", "u'O identificador do grupo é inválido ou não foi informado.')", "", "url", "=", "'equipamentogrupo/equipamento/'", "+", "str", "(", "id_equipamento", ")", "+", "'/egrupo/'", "+", "str", "(", "id_grupo", ")", "+", "'/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'DELETE'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
Remove a associação de um equipamento com um grupo de equipamento. :param id_equipamento: Identificador do equipamento. :param id_grupo: Identificador do grupo de equipamento. :return: None :raise EquipamentoGrupoNaoExisteError: Associação entre grupo e equipamento não cadastrada. :raise EquipamentoNaoExisteError: Equipamento não cadastrado. :raise EquipmentDontRemoveError: Failure to remove an association between an equipment and a group because the group is related only to a group. :raise InvalidParameterError: O identificador do equipamento e/ou do grupo 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.
[ "Remove", "a", "associação", "de", "um", "equipamento", "com", "um", "grupo", "de", "equipamento", "." ]
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L671-L700