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/Equipamento.py | Equipamento.list_by_group | def list_by_group(self, id_egroup):
"""Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < name_equipament >, 'grupos': < id_group >,
'mark': {'id': < id_mark >, 'nome': < name_mark >},'modelo': < id_model >,
'tipo_equipamento': < id_type >,
'model': {'nome': , 'id': < id_model >, 'marca': < id_mark >},
'type': {id': < id_type >, 'tipo_equipamento': < name_type >},
'id': < id_equipment >}, ... ]}
:raise InvalidParameterError: Group Equipment is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if id_egroup is None:
raise InvalidParameterError(
u'The identifier of Group Equipament is invalid or was not informed.')
url = 'equipment/group/' + str(id_egroup) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def list_by_group(self, id_egroup):
"""Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < name_equipament >, 'grupos': < id_group >,
'mark': {'id': < id_mark >, 'nome': < name_mark >},'modelo': < id_model >,
'tipo_equipamento': < id_type >,
'model': {'nome': , 'id': < id_model >, 'marca': < id_mark >},
'type': {id': < id_type >, 'tipo_equipamento': < name_type >},
'id': < id_equipment >}, ... ]}
:raise InvalidParameterError: Group Equipment is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if id_egroup is None:
raise InvalidParameterError(
u'The identifier of Group Equipament is invalid or was not informed.')
url = 'equipment/group/' + str(id_egroup) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"list_by_group",
"(",
"self",
",",
"id_egroup",
")",
":",
"if",
"id_egroup",
"is",
"None",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Group Equipament is invalid or was not informed.'",
")",
"url",
"=",
"'equipment/group/'",
"+",
"str",
"(",
"id_egroup",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < name_equipament >, 'grupos': < id_group >,
'mark': {'id': < id_mark >, 'nome': < name_mark >},'modelo': < id_model >,
'tipo_equipamento': < id_type >,
'model': {'nome': , 'id': < id_model >, 'marca': < id_mark >},
'type': {id': < id_type >, 'tipo_equipamento': < name_type >},
'id': < id_equipment >}, ... ]}
:raise InvalidParameterError: Group Equipment is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Search",
"Group",
"Equipment",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L702-L733 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Equipamento.py | Equipamento.get_ips_by_equipment_and_environment | def get_ips_by_equipment_and_environment(self, equip_nome, id_ambiente):
"""Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < name_equipament >, 'grupos': < id_group >,
'mark': {'id': < id_mark >, 'nome': < name_mark >},'modelo': < id_model >,
'tipo_equipamento': < id_type >,
'model': {'nome': , 'id': < id_model >, 'marca': < id_mark >},
'type': {id': < id_type >, 'tipo_equipamento': < name_type >},
'id': < id_equipment >}, ... ]}
:raise InvalidParameterError: Group Equipment is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if id_ambiente is None:
raise InvalidParameterError(
u'The environment id is invalid or was not informed.')
url = 'equipment/getipsbyambiente/' + str(equip_nome) + '/' + str(id_ambiente)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def get_ips_by_equipment_and_environment(self, equip_nome, id_ambiente):
"""Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < name_equipament >, 'grupos': < id_group >,
'mark': {'id': < id_mark >, 'nome': < name_mark >},'modelo': < id_model >,
'tipo_equipamento': < id_type >,
'model': {'nome': , 'id': < id_model >, 'marca': < id_mark >},
'type': {id': < id_type >, 'tipo_equipamento': < name_type >},
'id': < id_equipment >}, ... ]}
:raise InvalidParameterError: Group Equipment is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if id_ambiente is None:
raise InvalidParameterError(
u'The environment id is invalid or was not informed.')
url = 'equipment/getipsbyambiente/' + str(equip_nome) + '/' + str(id_ambiente)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"get_ips_by_equipment_and_environment",
"(",
"self",
",",
"equip_nome",
",",
"id_ambiente",
")",
":",
"if",
"id_ambiente",
"is",
"None",
":",
"raise",
"InvalidParameterError",
"(",
"u'The environment id is invalid or was not informed.'",
")",
"url",
"=",
"'equipment/getipsbyambiente/'",
"+",
"str",
"(",
"equip_nome",
")",
"+",
"'/'",
"+",
"str",
"(",
"id_ambiente",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < name_equipament >, 'grupos': < id_group >,
'mark': {'id': < id_mark >, 'nome': < name_mark >},'modelo': < id_model >,
'tipo_equipamento': < id_type >,
'model': {'nome': , 'id': < id_model >, 'marca': < id_mark >},
'type': {id': < id_type >, 'tipo_equipamento': < name_type >},
'id': < id_equipment >}, ... ]}
:raise InvalidParameterError: Group Equipment is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Search",
"Group",
"Equipment",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L735-L766 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiGenericClient.py | ApiGenericClient.get | def get(self, uri):
"""
Sends a GET request.
@param uri: Uri of Service API.
@param data: Requesting Data. Default: None
@raise NetworkAPIClientError: Client failed to access the API.
"""
request = None
try:
request = requests.get(
self._url(uri),
auth=self._auth_basic(),
headers=self._header()
)
request.raise_for_status()
try:
return request.json()
except Exception:
return request
except HTTPError:
try:
error = request.json()
self.logger.error(error)
err = error.get('detail', '')
except:
err = request
raise NetworkAPIClientError(err)
finally:
self.logger.info('URI: %s', uri)
if request:
self.logger.info('Status Code: %s',
request.status_code if request else '')
self.logger.info('X-Request-Id: %s',
request.headers.get('x-request-id'))
self.logger.info('X-Request-Context: %s',
request.headers.get('x-request-context')) | python | def get(self, uri):
"""
Sends a GET request.
@param uri: Uri of Service API.
@param data: Requesting Data. Default: None
@raise NetworkAPIClientError: Client failed to access the API.
"""
request = None
try:
request = requests.get(
self._url(uri),
auth=self._auth_basic(),
headers=self._header()
)
request.raise_for_status()
try:
return request.json()
except Exception:
return request
except HTTPError:
try:
error = request.json()
self.logger.error(error)
err = error.get('detail', '')
except:
err = request
raise NetworkAPIClientError(err)
finally:
self.logger.info('URI: %s', uri)
if request:
self.logger.info('Status Code: %s',
request.status_code if request else '')
self.logger.info('X-Request-Id: %s',
request.headers.get('x-request-id'))
self.logger.info('X-Request-Context: %s',
request.headers.get('x-request-context')) | [
"def",
"get",
"(",
"self",
",",
"uri",
")",
":",
"request",
"=",
"None",
"try",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"_url",
"(",
"uri",
")",
",",
"auth",
"=",
"self",
".",
"_auth_basic",
"(",
")",
",",
"headers",
"=",
"self",
".",
"_header",
"(",
")",
")",
"request",
".",
"raise_for_status",
"(",
")",
"try",
":",
"return",
"request",
".",
"json",
"(",
")",
"except",
"Exception",
":",
"return",
"request",
"except",
"HTTPError",
":",
"try",
":",
"error",
"=",
"request",
".",
"json",
"(",
")",
"self",
".",
"logger",
".",
"error",
"(",
"error",
")",
"err",
"=",
"error",
".",
"get",
"(",
"'detail'",
",",
"''",
")",
"except",
":",
"err",
"=",
"request",
"raise",
"NetworkAPIClientError",
"(",
"err",
")",
"finally",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'URI: %s'",
",",
"uri",
")",
"if",
"request",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Status Code: %s'",
",",
"request",
".",
"status_code",
"if",
"request",
"else",
"''",
")",
"self",
".",
"logger",
".",
"info",
"(",
"'X-Request-Id: %s'",
",",
"request",
".",
"headers",
".",
"get",
"(",
"'x-request-id'",
")",
")",
"self",
".",
"logger",
".",
"info",
"(",
"'X-Request-Context: %s'",
",",
"request",
".",
"headers",
".",
"get",
"(",
"'x-request-context'",
")",
")"
] | Sends a GET request.
@param uri: Uri of Service API.
@param data: Requesting Data. Default: None
@raise NetworkAPIClientError: Client failed to access the API. | [
"Sends",
"a",
"GET",
"request",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiGenericClient.py#L54-L96 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiGenericClient.py | ApiGenericClient._parse | def _parse(self, content):
"""
Parse data request to data from python.
@param content: Context of request.
@raise ParseError:
"""
if content:
stream = BytesIO(str(content))
data = json.loads(stream.getvalue())
return data | python | def _parse(self, content):
"""
Parse data request to data from python.
@param content: Context of request.
@raise ParseError:
"""
if content:
stream = BytesIO(str(content))
data = json.loads(stream.getvalue())
return data | [
"def",
"_parse",
"(",
"self",
",",
"content",
")",
":",
"if",
"content",
":",
"stream",
"=",
"BytesIO",
"(",
"str",
"(",
"content",
")",
")",
"data",
"=",
"json",
".",
"loads",
"(",
"stream",
".",
"getvalue",
"(",
")",
")",
"return",
"data"
] | Parse data request to data from python.
@param content: Context of request.
@raise ParseError: | [
"Parse",
"data",
"request",
"to",
"data",
"from",
"python",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiGenericClient.py#L233-L246 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiGenericClient.py | ApiGenericClient.prepare_url | def prepare_url(self, uri, kwargs):
"""Convert dict for URL params
"""
params = dict()
for key in kwargs:
if key in ('include', 'exclude', 'fields'):
params.update({
key: ','.join(kwargs.get(key))
})
elif key in ('search', 'kind'):
params.update({
key: kwargs.get(key)
})
if params:
params = urlencode(params)
uri = '%s?%s' % (uri, params)
return uri | python | def prepare_url(self, uri, kwargs):
"""Convert dict for URL params
"""
params = dict()
for key in kwargs:
if key in ('include', 'exclude', 'fields'):
params.update({
key: ','.join(kwargs.get(key))
})
elif key in ('search', 'kind'):
params.update({
key: kwargs.get(key)
})
if params:
params = urlencode(params)
uri = '%s?%s' % (uri, params)
return uri | [
"def",
"prepare_url",
"(",
"self",
",",
"uri",
",",
"kwargs",
")",
":",
"params",
"=",
"dict",
"(",
")",
"for",
"key",
"in",
"kwargs",
":",
"if",
"key",
"in",
"(",
"'include'",
",",
"'exclude'",
",",
"'fields'",
")",
":",
"params",
".",
"update",
"(",
"{",
"key",
":",
"','",
".",
"join",
"(",
"kwargs",
".",
"get",
"(",
"key",
")",
")",
"}",
")",
"elif",
"key",
"in",
"(",
"'search'",
",",
"'kind'",
")",
":",
"params",
".",
"update",
"(",
"{",
"key",
":",
"kwargs",
".",
"get",
"(",
"key",
")",
"}",
")",
"if",
"params",
":",
"params",
"=",
"urlencode",
"(",
"params",
")",
"uri",
"=",
"'%s?%s'",
"%",
"(",
"uri",
",",
"params",
")",
"return",
"uri"
] | Convert dict for URL params | [
"Convert",
"dict",
"for",
"URL",
"params"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiGenericClient.py#L270-L288 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Rack.py | Rack.insert_rack | def insert_rack(
self,
number,
name,
mac_address_sw1,
mac_address_sw2,
mac_address_ilo,
id_sw1,
id_sw2,
id_ilo):
"""Create new Rack
:param number: Number of Rack
:return: Following dictionary:
::
{'rack': {'id': < id_rack >,
'num_rack': < num_rack >,
'name_rack': < name_rack >,
'mac_sw1': < mac_sw1 >,
'mac_sw2': < mac_sw2 >,
'mac_ilo': < mac_ilo >,
'id_sw1': < id_sw1 >,
'id_sw2': < id_sw2 >,
'id_ilo': < id_ilo >, } }
:raise RacksError: Rack already registered with informed.
:raise NumeroRackDuplicadoError: There is already a registered Rack with the value of number.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(number):
raise InvalidParameterError(u'Rack number is none or invalid')
rack_map = dict()
rack_map['number'] = number
rack_map['name'] = name
rack_map['mac_address_sw1'] = mac_address_sw1
rack_map['mac_address_sw2'] = mac_address_sw2
rack_map['mac_address_ilo'] = mac_address_ilo
rack_map['id_sw1'] = id_sw1
rack_map['id_sw2'] = id_sw2
rack_map['id_ilo'] = id_ilo
code, xml = self.submit({'rack': rack_map}, 'POST', 'rack/insert/')
return self.response(code, xml) | python | def insert_rack(
self,
number,
name,
mac_address_sw1,
mac_address_sw2,
mac_address_ilo,
id_sw1,
id_sw2,
id_ilo):
"""Create new Rack
:param number: Number of Rack
:return: Following dictionary:
::
{'rack': {'id': < id_rack >,
'num_rack': < num_rack >,
'name_rack': < name_rack >,
'mac_sw1': < mac_sw1 >,
'mac_sw2': < mac_sw2 >,
'mac_ilo': < mac_ilo >,
'id_sw1': < id_sw1 >,
'id_sw2': < id_sw2 >,
'id_ilo': < id_ilo >, } }
:raise RacksError: Rack already registered with informed.
:raise NumeroRackDuplicadoError: There is already a registered Rack with the value of number.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(number):
raise InvalidParameterError(u'Rack number is none or invalid')
rack_map = dict()
rack_map['number'] = number
rack_map['name'] = name
rack_map['mac_address_sw1'] = mac_address_sw1
rack_map['mac_address_sw2'] = mac_address_sw2
rack_map['mac_address_ilo'] = mac_address_ilo
rack_map['id_sw1'] = id_sw1
rack_map['id_sw2'] = id_sw2
rack_map['id_ilo'] = id_ilo
code, xml = self.submit({'rack': rack_map}, 'POST', 'rack/insert/')
return self.response(code, xml) | [
"def",
"insert_rack",
"(",
"self",
",",
"number",
",",
"name",
",",
"mac_address_sw1",
",",
"mac_address_sw2",
",",
"mac_address_ilo",
",",
"id_sw1",
",",
"id_sw2",
",",
"id_ilo",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"number",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'Rack number is none or invalid'",
")",
"rack_map",
"=",
"dict",
"(",
")",
"rack_map",
"[",
"'number'",
"]",
"=",
"number",
"rack_map",
"[",
"'name'",
"]",
"=",
"name",
"rack_map",
"[",
"'mac_address_sw1'",
"]",
"=",
"mac_address_sw1",
"rack_map",
"[",
"'mac_address_sw2'",
"]",
"=",
"mac_address_sw2",
"rack_map",
"[",
"'mac_address_ilo'",
"]",
"=",
"mac_address_ilo",
"rack_map",
"[",
"'id_sw1'",
"]",
"=",
"id_sw1",
"rack_map",
"[",
"'id_sw2'",
"]",
"=",
"id_sw2",
"rack_map",
"[",
"'id_ilo'",
"]",
"=",
"id_ilo",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'rack'",
":",
"rack_map",
"}",
",",
"'POST'",
",",
"'rack/insert/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Create new Rack
:param number: Number of Rack
:return: Following dictionary:
::
{'rack': {'id': < id_rack >,
'num_rack': < num_rack >,
'name_rack': < name_rack >,
'mac_sw1': < mac_sw1 >,
'mac_sw2': < mac_sw2 >,
'mac_ilo': < mac_ilo >,
'id_sw1': < id_sw1 >,
'id_sw2': < id_sw2 >,
'id_ilo': < id_ilo >, } }
:raise RacksError: Rack already registered with informed.
:raise NumeroRackDuplicadoError: There is already a registered Rack with the value of number.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Create",
"new",
"Rack",
":",
"param",
"number",
":",
"Number",
"of",
"Rack",
":",
"return",
":",
"Following",
"dictionary",
":",
"::",
"{",
"rack",
":",
"{",
"id",
":",
"<",
"id_rack",
">",
"num_rack",
":",
"<",
"num_rack",
">",
"name_rack",
":",
"<",
"name_rack",
">",
"mac_sw1",
":",
"<",
"mac_sw1",
">",
"mac_sw2",
":",
"<",
"mac_sw2",
">",
"mac_ilo",
":",
"<",
"mac_ilo",
">",
"id_sw1",
":",
"<",
"id_sw1",
">",
"id_sw2",
":",
"<",
"id_sw2",
">",
"id_ilo",
":",
"<",
"id_ilo",
">",
"}",
"}",
":",
"raise",
"RacksError",
":",
"Rack",
"already",
"registered",
"with",
"informed",
".",
":",
"raise",
"NumeroRackDuplicadoError",
":",
"There",
"is",
"already",
"a",
"registered",
"Rack",
"with",
"the",
"value",
"of",
"number",
".",
":",
"raise",
"DataBaseError",
":",
"Networkapi",
"failed",
"to",
"access",
"the",
"database",
".",
":",
"raise",
"XMLError",
":",
"Networkapi",
"failed",
"to",
"generate",
"the",
"XML",
"response",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Rack.py#L38-L82 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Rack.py | Rack.remover | def remover(self, id_rack):
"""Remove Rack by the identifier.
:param id_rack: Identifier of the Rack. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Rack is null and invalid.
:raise RackNaoExisteError: Rack not registered.
:raise RackError: Rack 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_rack):
raise InvalidParameterError(
u'The identifier of Rack is invalid or was not informed.')
url = 'rack/' + str(id_rack) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def remover(self, id_rack):
"""Remove Rack by the identifier.
:param id_rack: Identifier of the Rack. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Rack is null and invalid.
:raise RackNaoExisteError: Rack not registered.
:raise RackError: Rack 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_rack):
raise InvalidParameterError(
u'The identifier of Rack is invalid or was not informed.')
url = 'rack/' + str(id_rack) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"remover",
"(",
"self",
",",
"id_rack",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_rack",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Rack is invalid or was not informed.'",
")",
"url",
"=",
"'rack/'",
"+",
"str",
"(",
"id_rack",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove Rack by the identifier.
:param id_rack: Identifier of the Rack. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Rack is null and invalid.
:raise RackNaoExisteError: Rack not registered.
:raise RackError: Rack is associated with a script.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Rack",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Rack.py#L168-L189 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.listar | def listar(self, id_divisao=None, id_ambiente_logico=None):
"""Lista os ambientes filtrados conforme parâmetros informados.
Se os dois parâmetros têm o valor None então retorna todos os ambientes.
Se o id_divisao é diferente de None então retorna os ambientes filtrados
pelo valor de id_divisao.
Se o id_divisao e id_ambiente_logico são diferentes de None então retorna
os ambientes filtrados por id_divisao e id_ambiente_logico.
:param id_divisao: Identificador da divisão de data center.
:param id_ambiente_logico: Identificador do ambiente lógico.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': [{'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >},
... demais ambientes ... ]}
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
url = 'ambiente/'
if is_valid_int_param(id_divisao) and not is_valid_int_param(
id_ambiente_logico):
url = 'ambiente/divisao_dc/' + str(id_divisao) + '/'
elif is_valid_int_param(id_divisao) and is_valid_int_param(id_ambiente_logico):
url = 'ambiente/divisao_dc/' + \
str(id_divisao) + '/ambiente_logico/' + str(id_ambiente_logico) + '/'
code, xml = self.submit(None, 'GET', url)
key = 'ambiente'
return get_list_map(self.response(code, xml, [key]), key) | python | def listar(self, id_divisao=None, id_ambiente_logico=None):
"""Lista os ambientes filtrados conforme parâmetros informados.
Se os dois parâmetros têm o valor None então retorna todos os ambientes.
Se o id_divisao é diferente de None então retorna os ambientes filtrados
pelo valor de id_divisao.
Se o id_divisao e id_ambiente_logico são diferentes de None então retorna
os ambientes filtrados por id_divisao e id_ambiente_logico.
:param id_divisao: Identificador da divisão de data center.
:param id_ambiente_logico: Identificador do ambiente lógico.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': [{'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >},
... demais ambientes ... ]}
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
url = 'ambiente/'
if is_valid_int_param(id_divisao) and not is_valid_int_param(
id_ambiente_logico):
url = 'ambiente/divisao_dc/' + str(id_divisao) + '/'
elif is_valid_int_param(id_divisao) and is_valid_int_param(id_ambiente_logico):
url = 'ambiente/divisao_dc/' + \
str(id_divisao) + '/ambiente_logico/' + str(id_ambiente_logico) + '/'
code, xml = self.submit(None, 'GET', url)
key = 'ambiente'
return get_list_map(self.response(code, xml, [key]), key) | [
"def",
"listar",
"(",
"self",
",",
"id_divisao",
"=",
"None",
",",
"id_ambiente_logico",
"=",
"None",
")",
":",
"url",
"=",
"'ambiente/'",
"if",
"is_valid_int_param",
"(",
"id_divisao",
")",
"and",
"not",
"is_valid_int_param",
"(",
"id_ambiente_logico",
")",
":",
"url",
"=",
"'ambiente/divisao_dc/'",
"+",
"str",
"(",
"id_divisao",
")",
"+",
"'/'",
"elif",
"is_valid_int_param",
"(",
"id_divisao",
")",
"and",
"is_valid_int_param",
"(",
"id_ambiente_logico",
")",
":",
"url",
"=",
"'ambiente/divisao_dc/'",
"+",
"str",
"(",
"id_divisao",
")",
"+",
"'/ambiente_logico/'",
"+",
"str",
"(",
"id_ambiente_logico",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"key",
"=",
"'ambiente'",
"return",
"get_list_map",
"(",
"self",
".",
"response",
"(",
"code",
",",
"xml",
",",
"[",
"key",
"]",
")",
",",
"key",
")"
] | Lista os ambientes filtrados conforme parâmetros informados.
Se os dois parâmetros têm o valor None então retorna todos os ambientes.
Se o id_divisao é diferente de None então retorna os ambientes filtrados
pelo valor de id_divisao.
Se o id_divisao e id_ambiente_logico são diferentes de None então retorna
os ambientes filtrados por id_divisao e id_ambiente_logico.
:param id_divisao: Identificador da divisão de data center.
:param id_ambiente_logico: Identificador do ambiente lógico.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': [{'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >},
... demais ambientes ... ]}
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta. | [
"Lista",
"os",
"ambientes",
"filtrados",
"conforme",
"parâmetros",
"informados",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L69-L114 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.buscar_por_equipamento | def buscar_por_equipamento(self, nome_equipamento, ip_equipamento):
"""Obtém um ambiente a partir do ip e nome de um equipamento.
:param nome_equipamento: Nome do equipamento.
:param ip_equipamento: IP do equipamento no formato XXX.XXX.XXX.XXX.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >}}
:raise IpError: IP não cadastrado para o equipamento.
:raise InvalidParameterError: O nome e/ou o IP do equipamento são vazios ou nulos, ou o IP é inválido.
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if nome_equipamento == '' or nome_equipamento is None:
raise InvalidParameterError(
u'O nome do equipamento não foi informado.')
if not is_valid_ip(ip_equipamento):
raise InvalidParameterError(
u'O IP do equipamento é inválido ou não foi informado.')
url = 'ambiente/equipamento/' + \
urllib.quote(nome_equipamento) + '/ip/' + str(ip_equipamento) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def buscar_por_equipamento(self, nome_equipamento, ip_equipamento):
"""Obtém um ambiente a partir do ip e nome de um equipamento.
:param nome_equipamento: Nome do equipamento.
:param ip_equipamento: IP do equipamento no formato XXX.XXX.XXX.XXX.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >}}
:raise IpError: IP não cadastrado para o equipamento.
:raise InvalidParameterError: O nome e/ou o IP do equipamento são vazios ou nulos, ou o IP é inválido.
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if nome_equipamento == '' or nome_equipamento is None:
raise InvalidParameterError(
u'O nome do equipamento não foi informado.')
if not is_valid_ip(ip_equipamento):
raise InvalidParameterError(
u'O IP do equipamento é inválido ou não foi informado.')
url = 'ambiente/equipamento/' + \
urllib.quote(nome_equipamento) + '/ip/' + str(ip_equipamento) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"buscar_por_equipamento",
"(",
"self",
",",
"nome_equipamento",
",",
"ip_equipamento",
")",
":",
"if",
"nome_equipamento",
"==",
"''",
"or",
"nome_equipamento",
"is",
"None",
":",
"raise",
"InvalidParameterError",
"(",
"u'O nome do equipamento não foi informado.')",
"",
"if",
"not",
"is_valid_ip",
"(",
"ip_equipamento",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O IP do equipamento é inválido ou não foi informado.')",
"",
"url",
"=",
"'ambiente/equipamento/'",
"+",
"urllib",
".",
"quote",
"(",
"nome_equipamento",
")",
"+",
"'/ip/'",
"+",
"str",
"(",
"ip_equipamento",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Obtém um ambiente a partir do ip e nome de um equipamento.
:param nome_equipamento: Nome do equipamento.
:param ip_equipamento: IP do equipamento no formato XXX.XXX.XXX.XXX.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >}}
:raise IpError: IP não cadastrado para o equipamento.
:raise InvalidParameterError: O nome e/ou o IP do equipamento são vazios ou nulos, ou o IP é inválido.
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
: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",
"ambiente",
"a",
"partir",
"do",
"ip",
"e",
"nome",
"de",
"um",
"equipamento",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L116-L158 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.buscar_por_id | def buscar_por_id(self, id_ambiente):
"""Obtém um ambiente a partir da chave primária (identificador).
:param id_ambiente: Identificador do ambiente.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'acl_path': < acl_path >,
'ipv4_template': < ipv4_template >,
'ipv6_template': < ipv6_template >,
'ambiente_rede': < ambiente_rede >}}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidParameterError: Identificador do ambiente é 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_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'environment/id/' + str(id_ambiente) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def buscar_por_id(self, id_ambiente):
"""Obtém um ambiente a partir da chave primária (identificador).
:param id_ambiente: Identificador do ambiente.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'acl_path': < acl_path >,
'ipv4_template': < ipv4_template >,
'ipv6_template': < ipv6_template >,
'ambiente_rede': < ambiente_rede >}}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidParameterError: Identificador do ambiente é 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_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'environment/id/' + str(id_ambiente) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"buscar_por_id",
"(",
"self",
",",
"id_ambiente",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_ambiente",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do ambiente é inválido ou não foi informado.')",
"",
"url",
"=",
"'environment/id/'",
"+",
"str",
"(",
"id_ambiente",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Obtém um ambiente a partir da chave primária (identificador).
:param id_ambiente: Identificador do ambiente.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'acl_path': < acl_path >,
'ipv4_template': < ipv4_template >,
'ipv6_template': < ipv6_template >,
'ambiente_rede': < ambiente_rede >}}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidParameterError: Identificador do ambiente é 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. | [
"Obtém",
"um",
"ambiente",
"a",
"partir",
"da",
"chave",
"primária",
"(",
"identificador",
")",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L160-L197 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.buscar_healthcheck_por_id | def buscar_healthcheck_por_id(self, id_healthcheck):
"""Get HealthCheck by id.
:param id_healthcheck: HealthCheck ID.
:return: Following dictionary:
::
{'healthcheck_expect': {'match_list': < match_list >,
'expect_string': < expect_string >,
'id': < id >,
'ambiente': < ambiente >}}
:raise HealthCheckNaoExisteError: HealthCheck not registered.
:raise InvalidParameterError: HealthCheck identifier is null and invalid.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
if not is_valid_int_param(id_healthcheck):
raise InvalidParameterError(
u'O identificador do healthcheck é inválido ou não foi informado.')
url = 'healthcheckexpect/get/' + str(id_healthcheck) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def buscar_healthcheck_por_id(self, id_healthcheck):
"""Get HealthCheck by id.
:param id_healthcheck: HealthCheck ID.
:return: Following dictionary:
::
{'healthcheck_expect': {'match_list': < match_list >,
'expect_string': < expect_string >,
'id': < id >,
'ambiente': < ambiente >}}
:raise HealthCheckNaoExisteError: HealthCheck not registered.
:raise InvalidParameterError: HealthCheck identifier is null and invalid.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
if not is_valid_int_param(id_healthcheck):
raise InvalidParameterError(
u'O identificador do healthcheck é inválido ou não foi informado.')
url = 'healthcheckexpect/get/' + str(id_healthcheck) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"buscar_healthcheck_por_id",
"(",
"self",
",",
"id_healthcheck",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_healthcheck",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do healthcheck é inválido ou não foi informado.')",
"",
"url",
"=",
"'healthcheckexpect/get/'",
"+",
"str",
"(",
"id_healthcheck",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Get HealthCheck by id.
:param id_healthcheck: HealthCheck ID.
:return: Following dictionary:
::
{'healthcheck_expect': {'match_list': < match_list >,
'expect_string': < expect_string >,
'id': < id >,
'ambiente': < ambiente >}}
:raise HealthCheckNaoExisteError: HealthCheck not registered.
:raise InvalidParameterError: HealthCheck identifier is null and invalid.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response. | [
"Get",
"HealthCheck",
"by",
"id",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L199-L226 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.listar_por_equip | def listar_por_equip(self, equip_id):
"""Lista todos os ambientes por equipamento especifico.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >}}
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if equip_id is None:
raise InvalidParameterError(
u'O id do equipamento não foi informado.')
url = 'ambiente/equip/' + str(equip_id) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def listar_por_equip(self, equip_id):
"""Lista todos os ambientes por equipamento especifico.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >}}
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if equip_id is None:
raise InvalidParameterError(
u'O id do equipamento não foi informado.')
url = 'ambiente/equip/' + str(equip_id) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"listar_por_equip",
"(",
"self",
",",
"equip_id",
")",
":",
"if",
"equip_id",
"is",
"None",
":",
"raise",
"InvalidParameterError",
"(",
"u'O id do equipamento não foi informado.')",
"",
"url",
"=",
"'ambiente/equip/'",
"+",
"str",
"(",
"equip_id",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Lista todos os ambientes por equipamento especifico.
:return: Dicionário com a seguinte estrutura:
::
{'ambiente': {'id': < id_ambiente >,
'link': < link >,
'id_divisao': < id_divisao >,
'nome_divisao': < nome_divisao >,
'id_ambiente_logico': < id_ambiente_logico >,
'nome_ambiente_logico': < nome_ambiente_logico >,
'id_grupo_l3': < id_grupo_l3 >,
'nome_grupo_l3': < nome_grupo_l3 >,
'id_filter': < id_filter >,
'filter_name': < filter_name >,
'ambiente_rede': < ambiente_rede >}}
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta. | [
"Lista",
"todos",
"os",
"ambientes",
"por",
"equipamento",
"especifico",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L228-L259 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.listar_healthcheck_expect | def listar_healthcheck_expect(self, id_ambiente):
"""Lista os healthcheck_expect´s de um ambiente.
:param id_ambiente: Identificador do ambiente.
:return: Dicionário com a seguinte estrutura:
::
{'healthcheck_expect': [{'id': < id_healthcheck_expect >,
'expect_string': < expect_string >,
'match_list': < match_list >,
'id_ambiente': < id_ambiente >},
... demais healthcheck_expects ...]}
:raise InvalidParameterError: O identificador do ambiente é 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_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'healthcheckexpect/ambiente/' + str(id_ambiente) + '/'
code, xml = self.submit(None, 'GET', url)
key = 'healthcheck_expect'
return get_list_map(self.response(code, xml, [key]), key) | python | def listar_healthcheck_expect(self, id_ambiente):
"""Lista os healthcheck_expect´s de um ambiente.
:param id_ambiente: Identificador do ambiente.
:return: Dicionário com a seguinte estrutura:
::
{'healthcheck_expect': [{'id': < id_healthcheck_expect >,
'expect_string': < expect_string >,
'match_list': < match_list >,
'id_ambiente': < id_ambiente >},
... demais healthcheck_expects ...]}
:raise InvalidParameterError: O identificador do ambiente é 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_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'healthcheckexpect/ambiente/' + str(id_ambiente) + '/'
code, xml = self.submit(None, 'GET', url)
key = 'healthcheck_expect'
return get_list_map(self.response(code, xml, [key]), key) | [
"def",
"listar_healthcheck_expect",
"(",
"self",
",",
"id_ambiente",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_ambiente",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do ambiente é inválido ou não foi informado.')",
"",
"url",
"=",
"'healthcheckexpect/ambiente/'",
"+",
"str",
"(",
"id_ambiente",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"key",
"=",
"'healthcheck_expect'",
"return",
"get_list_map",
"(",
"self",
".",
"response",
"(",
"code",
",",
"xml",
",",
"[",
"key",
"]",
")",
",",
"key",
")"
] | Lista os healthcheck_expect´s de um ambiente.
:param id_ambiente: Identificador do ambiente.
:return: Dicionário com a seguinte estrutura:
::
{'healthcheck_expect': [{'id': < id_healthcheck_expect >,
'expect_string': < expect_string >,
'match_list': < match_list >,
'id_ambiente': < id_ambiente >},
... demais healthcheck_expects ...]}
:raise InvalidParameterError: O identificador do ambiente é 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. | [
"Lista",
"os",
"healthcheck_expect´s",
"de",
"um",
"ambiente",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L261-L290 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.add_healthcheck_expect | def add_healthcheck_expect(self, id_ambiente, expect_string, match_list):
"""Insere um novo healthckeck_expect e retorna o seu identificador.
:param expect_string: expect_string.
:param id_ambiente: Identificador do ambiente lógico.
:param match_list: match list.
:return: Dicionário com a seguinte estrutura: {'healthcheck_expect': {'id': < id >}}
:raise InvalidParameterError: O identificador do ambiente, match_lis,expect_string, são inválidos ou nulo.
:raise HealthCheckExpectJaCadastradoError: Já existe um healthcheck_expect com os mesmos dados cadastrados.
: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.
"""
healthcheck_map = dict()
healthcheck_map['id_ambiente'] = id_ambiente
healthcheck_map['expect_string'] = expect_string
healthcheck_map['match_list'] = match_list
url = 'healthcheckexpect/add/'
code, xml = self.submit({'healthcheck': healthcheck_map}, 'POST', url)
return self.response(code, xml) | python | def add_healthcheck_expect(self, id_ambiente, expect_string, match_list):
"""Insere um novo healthckeck_expect e retorna o seu identificador.
:param expect_string: expect_string.
:param id_ambiente: Identificador do ambiente lógico.
:param match_list: match list.
:return: Dicionário com a seguinte estrutura: {'healthcheck_expect': {'id': < id >}}
:raise InvalidParameterError: O identificador do ambiente, match_lis,expect_string, são inválidos ou nulo.
:raise HealthCheckExpectJaCadastradoError: Já existe um healthcheck_expect com os mesmos dados cadastrados.
: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.
"""
healthcheck_map = dict()
healthcheck_map['id_ambiente'] = id_ambiente
healthcheck_map['expect_string'] = expect_string
healthcheck_map['match_list'] = match_list
url = 'healthcheckexpect/add/'
code, xml = self.submit({'healthcheck': healthcheck_map}, 'POST', url)
return self.response(code, xml) | [
"def",
"add_healthcheck_expect",
"(",
"self",
",",
"id_ambiente",
",",
"expect_string",
",",
"match_list",
")",
":",
"healthcheck_map",
"=",
"dict",
"(",
")",
"healthcheck_map",
"[",
"'id_ambiente'",
"]",
"=",
"id_ambiente",
"healthcheck_map",
"[",
"'expect_string'",
"]",
"=",
"expect_string",
"healthcheck_map",
"[",
"'match_list'",
"]",
"=",
"match_list",
"url",
"=",
"'healthcheckexpect/add/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'healthcheck'",
":",
"healthcheck_map",
"}",
",",
"'POST'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Insere um novo healthckeck_expect e retorna o seu identificador.
:param expect_string: expect_string.
:param id_ambiente: Identificador do ambiente lógico.
:param match_list: match list.
:return: Dicionário com a seguinte estrutura: {'healthcheck_expect': {'id': < id >}}
:raise InvalidParameterError: O identificador do ambiente, match_lis,expect_string, são inválidos ou nulo.
:raise HealthCheckExpectJaCadastradoError: Já existe um healthcheck_expect com os mesmos dados cadastrados.
: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. | [
"Insere",
"um",
"novo",
"healthckeck_expect",
"e",
"retorna",
"o",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L292-L316 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.inserir | def inserir(
self,
id_grupo_l3,
id_ambiente_logico,
id_divisao,
link,
id_filter=None,
acl_path=None,
ipv4_template=None,
ipv6_template=None,
min_num_vlan_1=None,
max_num_vlan_1=None,
min_num_vlan_2=None,
max_num_vlan_2=None,
vrf=None):
"""Insere um novo ambiente e retorna o seu identificador.
:param id_grupo_l3: Identificador do grupo layer 3.
:param id_ambiente_logico: Identificador do ambiente lógico.
:param id_divisao: Identificador da divisão data center.
:param id_filter: Filter identifier.
:param link: Link
:param acl_path: Path where the ACL will be stored
:param ipv4_template: Template that will be used in Ipv6
:param ipv6_template: Template that will be used in Ipv4
:param min_num_vlan_1: Min 1 num vlan valid for this environment
:param max_num_vlan_1: Max 1 num vlan valid for this environment
:param min_num_vlan_2: Min 2 num vlan valid for this environment
:param max_num_vlan_2: Max 2 num vlan valid for this environment
:return: Dicionário com a seguinte estrutura: {'ambiente': {'id': < id >}}
:raise InvalidParameterError: O identificador do grupo l3, o identificador do ambiente lógico, e/ou
o identificador da divisão de data center são nulos ou inválidos.
:raise GrupoL3NaoExisteError: Grupo layer 3 não cadastrado.
:raise AmbienteLogicoNaoExisteError: Ambiente lógico não cadastrado.
:raise DivisaoDcNaoExisteError: Divisão datacenter não cadastrada.
:raise AmbienteDuplicadoError: Ambiente com o mesmo id_grupo_l3, id_ambiente_logico e id_divisao
já cadastrado.
: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.
"""
ambiente_map = dict()
ambiente_map['id_grupo_l3'] = id_grupo_l3
ambiente_map['id_ambiente_logico'] = id_ambiente_logico
ambiente_map['id_divisao'] = id_divisao
ambiente_map['id_filter'] = id_filter
ambiente_map['link'] = link
ambiente_map['acl_path'] = acl_path
ambiente_map['ipv4_template'] = ipv4_template
ambiente_map['ipv6_template'] = ipv6_template
ambiente_map['min_num_vlan_1'] = min_num_vlan_1
ambiente_map['max_num_vlan_1'] = max_num_vlan_1
ambiente_map['min_num_vlan_2'] = min_num_vlan_2
ambiente_map['max_num_vlan_2'] = max_num_vlan_2
ambiente_map['vrf'] = vrf
code, xml = self.submit(
{'ambiente': ambiente_map}, 'POST', 'ambiente/')
return self.response(code, xml) | python | def inserir(
self,
id_grupo_l3,
id_ambiente_logico,
id_divisao,
link,
id_filter=None,
acl_path=None,
ipv4_template=None,
ipv6_template=None,
min_num_vlan_1=None,
max_num_vlan_1=None,
min_num_vlan_2=None,
max_num_vlan_2=None,
vrf=None):
"""Insere um novo ambiente e retorna o seu identificador.
:param id_grupo_l3: Identificador do grupo layer 3.
:param id_ambiente_logico: Identificador do ambiente lógico.
:param id_divisao: Identificador da divisão data center.
:param id_filter: Filter identifier.
:param link: Link
:param acl_path: Path where the ACL will be stored
:param ipv4_template: Template that will be used in Ipv6
:param ipv6_template: Template that will be used in Ipv4
:param min_num_vlan_1: Min 1 num vlan valid for this environment
:param max_num_vlan_1: Max 1 num vlan valid for this environment
:param min_num_vlan_2: Min 2 num vlan valid for this environment
:param max_num_vlan_2: Max 2 num vlan valid for this environment
:return: Dicionário com a seguinte estrutura: {'ambiente': {'id': < id >}}
:raise InvalidParameterError: O identificador do grupo l3, o identificador do ambiente lógico, e/ou
o identificador da divisão de data center são nulos ou inválidos.
:raise GrupoL3NaoExisteError: Grupo layer 3 não cadastrado.
:raise AmbienteLogicoNaoExisteError: Ambiente lógico não cadastrado.
:raise DivisaoDcNaoExisteError: Divisão datacenter não cadastrada.
:raise AmbienteDuplicadoError: Ambiente com o mesmo id_grupo_l3, id_ambiente_logico e id_divisao
já cadastrado.
: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.
"""
ambiente_map = dict()
ambiente_map['id_grupo_l3'] = id_grupo_l3
ambiente_map['id_ambiente_logico'] = id_ambiente_logico
ambiente_map['id_divisao'] = id_divisao
ambiente_map['id_filter'] = id_filter
ambiente_map['link'] = link
ambiente_map['acl_path'] = acl_path
ambiente_map['ipv4_template'] = ipv4_template
ambiente_map['ipv6_template'] = ipv6_template
ambiente_map['min_num_vlan_1'] = min_num_vlan_1
ambiente_map['max_num_vlan_1'] = max_num_vlan_1
ambiente_map['min_num_vlan_2'] = min_num_vlan_2
ambiente_map['max_num_vlan_2'] = max_num_vlan_2
ambiente_map['vrf'] = vrf
code, xml = self.submit(
{'ambiente': ambiente_map}, 'POST', 'ambiente/')
return self.response(code, xml) | [
"def",
"inserir",
"(",
"self",
",",
"id_grupo_l3",
",",
"id_ambiente_logico",
",",
"id_divisao",
",",
"link",
",",
"id_filter",
"=",
"None",
",",
"acl_path",
"=",
"None",
",",
"ipv4_template",
"=",
"None",
",",
"ipv6_template",
"=",
"None",
",",
"min_num_vlan_1",
"=",
"None",
",",
"max_num_vlan_1",
"=",
"None",
",",
"min_num_vlan_2",
"=",
"None",
",",
"max_num_vlan_2",
"=",
"None",
",",
"vrf",
"=",
"None",
")",
":",
"ambiente_map",
"=",
"dict",
"(",
")",
"ambiente_map",
"[",
"'id_grupo_l3'",
"]",
"=",
"id_grupo_l3",
"ambiente_map",
"[",
"'id_ambiente_logico'",
"]",
"=",
"id_ambiente_logico",
"ambiente_map",
"[",
"'id_divisao'",
"]",
"=",
"id_divisao",
"ambiente_map",
"[",
"'id_filter'",
"]",
"=",
"id_filter",
"ambiente_map",
"[",
"'link'",
"]",
"=",
"link",
"ambiente_map",
"[",
"'acl_path'",
"]",
"=",
"acl_path",
"ambiente_map",
"[",
"'ipv4_template'",
"]",
"=",
"ipv4_template",
"ambiente_map",
"[",
"'ipv6_template'",
"]",
"=",
"ipv6_template",
"ambiente_map",
"[",
"'min_num_vlan_1'",
"]",
"=",
"min_num_vlan_1",
"ambiente_map",
"[",
"'max_num_vlan_1'",
"]",
"=",
"max_num_vlan_1",
"ambiente_map",
"[",
"'min_num_vlan_2'",
"]",
"=",
"min_num_vlan_2",
"ambiente_map",
"[",
"'max_num_vlan_2'",
"]",
"=",
"max_num_vlan_2",
"ambiente_map",
"[",
"'vrf'",
"]",
"=",
"vrf",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'ambiente'",
":",
"ambiente_map",
"}",
",",
"'POST'",
",",
"'ambiente/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Insere um novo ambiente e retorna o seu identificador.
:param id_grupo_l3: Identificador do grupo layer 3.
:param id_ambiente_logico: Identificador do ambiente lógico.
:param id_divisao: Identificador da divisão data center.
:param id_filter: Filter identifier.
:param link: Link
:param acl_path: Path where the ACL will be stored
:param ipv4_template: Template that will be used in Ipv6
:param ipv6_template: Template that will be used in Ipv4
:param min_num_vlan_1: Min 1 num vlan valid for this environment
:param max_num_vlan_1: Max 1 num vlan valid for this environment
:param min_num_vlan_2: Min 2 num vlan valid for this environment
:param max_num_vlan_2: Max 2 num vlan valid for this environment
:return: Dicionário com a seguinte estrutura: {'ambiente': {'id': < id >}}
:raise InvalidParameterError: O identificador do grupo l3, o identificador do ambiente lógico, e/ou
o identificador da divisão de data center são nulos ou inválidos.
:raise GrupoL3NaoExisteError: Grupo layer 3 não cadastrado.
:raise AmbienteLogicoNaoExisteError: Ambiente lógico não cadastrado.
:raise DivisaoDcNaoExisteError: Divisão datacenter não cadastrada.
:raise AmbienteDuplicadoError: Ambiente com o mesmo id_grupo_l3, id_ambiente_logico e id_divisao
já cadastrado.
: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. | [
"Insere",
"um",
"novo",
"ambiente",
"e",
"retorna",
"o",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L318-L379 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.insert_with_ip_range | def insert_with_ip_range(
self,
id_l3_group,
id_logical_environment,
id_division,
id_ip_config,
link,
id_filter=None):
"""Insert new environment with ip config and returns your id.
:param id_l3_group: Layer 3 Group ID.
:param id_logical_environment: Logical Environment ID.
:param id_division: Data Center Division ID.
:param id_filter: Filter identifier.
:param id_ip_config: IP Configuration ID.
:param link: Link.
:return: Following dictionary: {'ambiente': {'id': < id >}}
:raise ConfigEnvironmentDuplicateError: Error saving duplicate Environment Configuration.
:raise InvalidParameterError: Some parameter was invalid.
:raise GrupoL3NaoExisteError: Layer 3 Group not found.
:raise AmbienteLogicoNaoExisteError: Logical Environment not found.
:raise DivisaoDcNaoExisteError: Data Center Division not found.
:raise AmbienteDuplicadoError: Environment with this parameters already exists.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
environment_map = dict()
environment_map['id_grupo_l3'] = id_l3_group
environment_map['id_ambiente_logico'] = id_logical_environment
environment_map['id_divisao'] = id_division
environment_map['id_filter'] = id_filter
environment_map['id_ip_config'] = id_ip_config
environment_map['link'] = link
code, xml = self.submit(
{'ambiente': environment_map}, 'POST', 'ambiente/ipconfig/')
return self.response(code, xml) | python | def insert_with_ip_range(
self,
id_l3_group,
id_logical_environment,
id_division,
id_ip_config,
link,
id_filter=None):
"""Insert new environment with ip config and returns your id.
:param id_l3_group: Layer 3 Group ID.
:param id_logical_environment: Logical Environment ID.
:param id_division: Data Center Division ID.
:param id_filter: Filter identifier.
:param id_ip_config: IP Configuration ID.
:param link: Link.
:return: Following dictionary: {'ambiente': {'id': < id >}}
:raise ConfigEnvironmentDuplicateError: Error saving duplicate Environment Configuration.
:raise InvalidParameterError: Some parameter was invalid.
:raise GrupoL3NaoExisteError: Layer 3 Group not found.
:raise AmbienteLogicoNaoExisteError: Logical Environment not found.
:raise DivisaoDcNaoExisteError: Data Center Division not found.
:raise AmbienteDuplicadoError: Environment with this parameters already exists.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
environment_map = dict()
environment_map['id_grupo_l3'] = id_l3_group
environment_map['id_ambiente_logico'] = id_logical_environment
environment_map['id_divisao'] = id_division
environment_map['id_filter'] = id_filter
environment_map['id_ip_config'] = id_ip_config
environment_map['link'] = link
code, xml = self.submit(
{'ambiente': environment_map}, 'POST', 'ambiente/ipconfig/')
return self.response(code, xml) | [
"def",
"insert_with_ip_range",
"(",
"self",
",",
"id_l3_group",
",",
"id_logical_environment",
",",
"id_division",
",",
"id_ip_config",
",",
"link",
",",
"id_filter",
"=",
"None",
")",
":",
"environment_map",
"=",
"dict",
"(",
")",
"environment_map",
"[",
"'id_grupo_l3'",
"]",
"=",
"id_l3_group",
"environment_map",
"[",
"'id_ambiente_logico'",
"]",
"=",
"id_logical_environment",
"environment_map",
"[",
"'id_divisao'",
"]",
"=",
"id_division",
"environment_map",
"[",
"'id_filter'",
"]",
"=",
"id_filter",
"environment_map",
"[",
"'id_ip_config'",
"]",
"=",
"id_ip_config",
"environment_map",
"[",
"'link'",
"]",
"=",
"link",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'ambiente'",
":",
"environment_map",
"}",
",",
"'POST'",
",",
"'ambiente/ipconfig/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Insert new environment with ip config and returns your id.
:param id_l3_group: Layer 3 Group ID.
:param id_logical_environment: Logical Environment ID.
:param id_division: Data Center Division ID.
:param id_filter: Filter identifier.
:param id_ip_config: IP Configuration ID.
:param link: Link.
:return: Following dictionary: {'ambiente': {'id': < id >}}
:raise ConfigEnvironmentDuplicateError: Error saving duplicate Environment Configuration.
:raise InvalidParameterError: Some parameter was invalid.
:raise GrupoL3NaoExisteError: Layer 3 Group not found.
:raise AmbienteLogicoNaoExisteError: Logical Environment not found.
:raise DivisaoDcNaoExisteError: Data Center Division not found.
:raise AmbienteDuplicadoError: Environment with this parameters already exists.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Insert",
"new",
"environment",
"with",
"ip",
"config",
"and",
"returns",
"your",
"id",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L381-L421 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.add_ip_range | def add_ip_range(self, id_environment, id_ip_config):
"""Makes relationship of environment with ip config and returns your id.
:param id_environment: Environment ID.
:param id_ip_config: IP Configuration ID.
:return: Following dictionary:
{'config_do_ambiente': {'id_config_do_ambiente': < id_config_do_ambiente >}}
:raise InvalidParameterError: Some parameter was invalid.
:raise ConfigEnvironmentDuplicateError: Error saving duplicate Environment Configuration.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
environment_map = dict()
environment_map['id_environment'] = id_environment
environment_map['id_ip_config'] = id_ip_config
code, xml = self.submit(
{'ambiente': environment_map}, 'POST', 'ipconfig/')
return self.response(code, xml) | python | def add_ip_range(self, id_environment, id_ip_config):
"""Makes relationship of environment with ip config and returns your id.
:param id_environment: Environment ID.
:param id_ip_config: IP Configuration ID.
:return: Following dictionary:
{'config_do_ambiente': {'id_config_do_ambiente': < id_config_do_ambiente >}}
:raise InvalidParameterError: Some parameter was invalid.
:raise ConfigEnvironmentDuplicateError: Error saving duplicate Environment Configuration.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
environment_map = dict()
environment_map['id_environment'] = id_environment
environment_map['id_ip_config'] = id_ip_config
code, xml = self.submit(
{'ambiente': environment_map}, 'POST', 'ipconfig/')
return self.response(code, xml) | [
"def",
"add_ip_range",
"(",
"self",
",",
"id_environment",
",",
"id_ip_config",
")",
":",
"environment_map",
"=",
"dict",
"(",
")",
"environment_map",
"[",
"'id_environment'",
"]",
"=",
"id_environment",
"environment_map",
"[",
"'id_ip_config'",
"]",
"=",
"id_ip_config",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'ambiente'",
":",
"environment_map",
"}",
",",
"'POST'",
",",
"'ipconfig/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Makes relationship of environment with ip config and returns your id.
:param id_environment: Environment ID.
:param id_ip_config: IP Configuration ID.
:return: Following dictionary:
{'config_do_ambiente': {'id_config_do_ambiente': < id_config_do_ambiente >}}
:raise InvalidParameterError: Some parameter was invalid.
:raise ConfigEnvironmentDuplicateError: Error saving duplicate Environment Configuration.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Makes",
"relationship",
"of",
"environment",
"with",
"ip",
"config",
"and",
"returns",
"your",
"id",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L423-L446 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.alterar | def alterar(
self,
id_ambiente,
id_grupo_l3,
id_ambiente_logico,
id_divisao,
link,
id_filter=None,
acl_path=None,
ipv4_template=None,
ipv6_template=None,
min_num_vlan_1=None,
max_num_vlan_1=None,
min_num_vlan_2=None,
max_num_vlan_2=None,
vrf=None):
"""Altera os dados de um ambiente a partir do seu identificador.
:param id_ambiente: Identificador do ambiente.
:param id_grupo_l3: Identificador do grupo layer 3.
:param id_ambiente_logico: Identificador do ambiente lógico.
:param id_divisao: Identificador da divisão data center.
:param id_filter: Filter identifier.
:param link: Link
:param acl_path: Path where the ACL will be stored
:param ipv4_template: Template that will be used in Ipv6
:param ipv6_template: Template that will be used in Ipv4
:param min_num_vlan_1: Min 1 num vlan valid for this environment
:param max_num_vlan_1: Max 1 num vlan valid for this environment
:param min_num_vlan_2: Min 2 num vlan valid for this environment
:param max_num_vlan_2: Max 2 num vlan valid for this environment
:return: None
:raise InvalidParameterError: O identificador do ambiente, o identificador do grupo l3, o identificador do ambiente lógico, e/ou o identificador da divisão de data center são nulos ou inválidos.
:raise GrupoL3NaoExisteError: Grupo layer 3 não cadastrado.
:raise AmbienteLogicoNaoExisteError: Ambiente lógico não cadastrado.
:raise DivisaoDcNaoExisteError: Divisão data center não cadastrada.
:raise AmbienteDuplicadoError: Ambiente com o mesmo id_grupo_l3, id_ambiente_logico e id_divisao já cadastrado.
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
: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.
"""
if not is_valid_int_param(id_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'ambiente/' + str(id_ambiente) + '/'
ambiente_map = dict()
ambiente_map['id_grupo_l3'] = id_grupo_l3
ambiente_map['id_ambiente_logico'] = id_ambiente_logico
ambiente_map['id_divisao'] = id_divisao
ambiente_map['id_filter'] = id_filter
ambiente_map['link'] = link
ambiente_map['vrf'] = vrf
ambiente_map['acl_path'] = acl_path
ambiente_map['ipv4_template'] = ipv4_template
ambiente_map['ipv6_template'] = ipv6_template
ambiente_map['min_num_vlan_1'] = min_num_vlan_1
ambiente_map['max_num_vlan_1'] = max_num_vlan_1
ambiente_map['min_num_vlan_2'] = min_num_vlan_2
ambiente_map['max_num_vlan_2'] = max_num_vlan_2
code, xml = self.submit({'ambiente': ambiente_map}, 'PUT', url)
return self.response(code, xml) | python | def alterar(
self,
id_ambiente,
id_grupo_l3,
id_ambiente_logico,
id_divisao,
link,
id_filter=None,
acl_path=None,
ipv4_template=None,
ipv6_template=None,
min_num_vlan_1=None,
max_num_vlan_1=None,
min_num_vlan_2=None,
max_num_vlan_2=None,
vrf=None):
"""Altera os dados de um ambiente a partir do seu identificador.
:param id_ambiente: Identificador do ambiente.
:param id_grupo_l3: Identificador do grupo layer 3.
:param id_ambiente_logico: Identificador do ambiente lógico.
:param id_divisao: Identificador da divisão data center.
:param id_filter: Filter identifier.
:param link: Link
:param acl_path: Path where the ACL will be stored
:param ipv4_template: Template that will be used in Ipv6
:param ipv6_template: Template that will be used in Ipv4
:param min_num_vlan_1: Min 1 num vlan valid for this environment
:param max_num_vlan_1: Max 1 num vlan valid for this environment
:param min_num_vlan_2: Min 2 num vlan valid for this environment
:param max_num_vlan_2: Max 2 num vlan valid for this environment
:return: None
:raise InvalidParameterError: O identificador do ambiente, o identificador do grupo l3, o identificador do ambiente lógico, e/ou o identificador da divisão de data center são nulos ou inválidos.
:raise GrupoL3NaoExisteError: Grupo layer 3 não cadastrado.
:raise AmbienteLogicoNaoExisteError: Ambiente lógico não cadastrado.
:raise DivisaoDcNaoExisteError: Divisão data center não cadastrada.
:raise AmbienteDuplicadoError: Ambiente com o mesmo id_grupo_l3, id_ambiente_logico e id_divisao já cadastrado.
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
: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.
"""
if not is_valid_int_param(id_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'ambiente/' + str(id_ambiente) + '/'
ambiente_map = dict()
ambiente_map['id_grupo_l3'] = id_grupo_l3
ambiente_map['id_ambiente_logico'] = id_ambiente_logico
ambiente_map['id_divisao'] = id_divisao
ambiente_map['id_filter'] = id_filter
ambiente_map['link'] = link
ambiente_map['vrf'] = vrf
ambiente_map['acl_path'] = acl_path
ambiente_map['ipv4_template'] = ipv4_template
ambiente_map['ipv6_template'] = ipv6_template
ambiente_map['min_num_vlan_1'] = min_num_vlan_1
ambiente_map['max_num_vlan_1'] = max_num_vlan_1
ambiente_map['min_num_vlan_2'] = min_num_vlan_2
ambiente_map['max_num_vlan_2'] = max_num_vlan_2
code, xml = self.submit({'ambiente': ambiente_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"alterar",
"(",
"self",
",",
"id_ambiente",
",",
"id_grupo_l3",
",",
"id_ambiente_logico",
",",
"id_divisao",
",",
"link",
",",
"id_filter",
"=",
"None",
",",
"acl_path",
"=",
"None",
",",
"ipv4_template",
"=",
"None",
",",
"ipv6_template",
"=",
"None",
",",
"min_num_vlan_1",
"=",
"None",
",",
"max_num_vlan_1",
"=",
"None",
",",
"min_num_vlan_2",
"=",
"None",
",",
"max_num_vlan_2",
"=",
"None",
",",
"vrf",
"=",
"None",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_ambiente",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do ambiente é inválido ou não foi informado.')",
"",
"url",
"=",
"'ambiente/'",
"+",
"str",
"(",
"id_ambiente",
")",
"+",
"'/'",
"ambiente_map",
"=",
"dict",
"(",
")",
"ambiente_map",
"[",
"'id_grupo_l3'",
"]",
"=",
"id_grupo_l3",
"ambiente_map",
"[",
"'id_ambiente_logico'",
"]",
"=",
"id_ambiente_logico",
"ambiente_map",
"[",
"'id_divisao'",
"]",
"=",
"id_divisao",
"ambiente_map",
"[",
"'id_filter'",
"]",
"=",
"id_filter",
"ambiente_map",
"[",
"'link'",
"]",
"=",
"link",
"ambiente_map",
"[",
"'vrf'",
"]",
"=",
"vrf",
"ambiente_map",
"[",
"'acl_path'",
"]",
"=",
"acl_path",
"ambiente_map",
"[",
"'ipv4_template'",
"]",
"=",
"ipv4_template",
"ambiente_map",
"[",
"'ipv6_template'",
"]",
"=",
"ipv6_template",
"ambiente_map",
"[",
"'min_num_vlan_1'",
"]",
"=",
"min_num_vlan_1",
"ambiente_map",
"[",
"'max_num_vlan_1'",
"]",
"=",
"max_num_vlan_1",
"ambiente_map",
"[",
"'min_num_vlan_2'",
"]",
"=",
"min_num_vlan_2",
"ambiente_map",
"[",
"'max_num_vlan_2'",
"]",
"=",
"max_num_vlan_2",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'ambiente'",
":",
"ambiente_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Altera os dados de um ambiente a partir do seu identificador.
:param id_ambiente: Identificador do ambiente.
:param id_grupo_l3: Identificador do grupo layer 3.
:param id_ambiente_logico: Identificador do ambiente lógico.
:param id_divisao: Identificador da divisão data center.
:param id_filter: Filter identifier.
:param link: Link
:param acl_path: Path where the ACL will be stored
:param ipv4_template: Template that will be used in Ipv6
:param ipv6_template: Template that will be used in Ipv4
:param min_num_vlan_1: Min 1 num vlan valid for this environment
:param max_num_vlan_1: Max 1 num vlan valid for this environment
:param min_num_vlan_2: Min 2 num vlan valid for this environment
:param max_num_vlan_2: Max 2 num vlan valid for this environment
:return: None
:raise InvalidParameterError: O identificador do ambiente, o identificador do grupo l3, o identificador do ambiente lógico, e/ou o identificador da divisão de data center são nulos ou inválidos.
:raise GrupoL3NaoExisteError: Grupo layer 3 não cadastrado.
:raise AmbienteLogicoNaoExisteError: Ambiente lógico não cadastrado.
:raise DivisaoDcNaoExisteError: Divisão data center não cadastrada.
:raise AmbienteDuplicadoError: Ambiente com o mesmo id_grupo_l3, id_ambiente_logico e id_divisao já cadastrado.
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
: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. | [
"Altera",
"os",
"dados",
"de",
"um",
"ambiente",
"a",
"partir",
"do",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L448-L515 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.add_expect_string_healthcheck | def add_expect_string_healthcheck(self, expect_string):
"""Inserts a new healthckeck_expect with only expect_string.
:param expect_string: expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': {'id': < id >}}
:raise InvalidParameterError: The value of expect_string is invalid.
:raise HealthCheckExpectJaCadastradoError: There is already a healthcheck_expect registered with the same data.
:raise HealthCheckExpectNaoExisteError: Healthcheck_expect not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
healthcheck_map = dict()
healthcheck_map['expect_string'] = expect_string
url = 'healthcheckexpect/add/expect_string/'
code, xml = self.submit({'healthcheck': healthcheck_map}, 'POST', url)
return self.response(code, xml) | python | def add_expect_string_healthcheck(self, expect_string):
"""Inserts a new healthckeck_expect with only expect_string.
:param expect_string: expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': {'id': < id >}}
:raise InvalidParameterError: The value of expect_string is invalid.
:raise HealthCheckExpectJaCadastradoError: There is already a healthcheck_expect registered with the same data.
:raise HealthCheckExpectNaoExisteError: Healthcheck_expect not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
healthcheck_map = dict()
healthcheck_map['expect_string'] = expect_string
url = 'healthcheckexpect/add/expect_string/'
code, xml = self.submit({'healthcheck': healthcheck_map}, 'POST', url)
return self.response(code, xml) | [
"def",
"add_expect_string_healthcheck",
"(",
"self",
",",
"expect_string",
")",
":",
"healthcheck_map",
"=",
"dict",
"(",
")",
"healthcheck_map",
"[",
"'expect_string'",
"]",
"=",
"expect_string",
"url",
"=",
"'healthcheckexpect/add/expect_string/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'healthcheck'",
":",
"healthcheck_map",
"}",
",",
"'POST'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Inserts a new healthckeck_expect with only expect_string.
:param expect_string: expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': {'id': < id >}}
:raise InvalidParameterError: The value of expect_string is invalid.
:raise HealthCheckExpectJaCadastradoError: There is already a healthcheck_expect registered with the same data.
:raise HealthCheckExpectNaoExisteError: Healthcheck_expect not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Inserts",
"a",
"new",
"healthckeck_expect",
"with",
"only",
"expect_string",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L541-L567 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.listar_healtchcheck_expect_distinct | def listar_healtchcheck_expect_distinct(self):
"""Get all expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': [
'expect_string': < expect_string >,
... demais healthcheck_expects ...]}
:raise InvalidParameterError: Identifier is null and invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
url = 'healthcheckexpect/distinct/busca/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def listar_healtchcheck_expect_distinct(self):
"""Get all expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': [
'expect_string': < expect_string >,
... demais healthcheck_expects ...]}
:raise InvalidParameterError: Identifier is null and invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
url = 'healthcheckexpect/distinct/busca/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"listar_healtchcheck_expect_distinct",
"(",
"self",
")",
":",
"url",
"=",
"'healthcheckexpect/distinct/busca/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Get all expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': [
'expect_string': < expect_string >,
... demais healthcheck_expects ...]}
:raise InvalidParameterError: Identifier is null and invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Get",
"all",
"expect_string",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L569-L590 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.list_acl_path | def list_acl_path(self):
"""Get all distinct acl paths.
:return: Dictionary with the following structure:
::
{'acl_paths': [
< acl_path >,
... ]}
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
url = 'environment/acl_path/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def list_acl_path(self):
"""Get all distinct acl paths.
:return: Dictionary with the following structure:
::
{'acl_paths': [
< acl_path >,
... ]}
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
url = 'environment/acl_path/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"list_acl_path",
"(",
"self",
")",
":",
"url",
"=",
"'environment/acl_path/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Get all distinct acl paths.
:return: Dictionary with the following structure:
::
{'acl_paths': [
< acl_path >,
... ]}
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Get",
"all",
"distinct",
"acl",
"paths",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L592-L613 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.set_template | def set_template(self, id_environment, name, network):
"""Set template value. If id_environment = 0, set '' to all environments related with the template name.
:param id_environment: Environment Identifier.
:param name: Template Name.
:param network: IPv4 or IPv6.
:return: None
:raise InvalidParameterError: Invalid param.
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
: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.
"""
url = 'environment/set_template/' + str(id_environment) + '/'
environment_map = dict()
environment_map['name'] = name
environment_map['network'] = network
code, xml = self.submit({'environment': environment_map}, 'POST', url)
return self.response(code, xml) | python | def set_template(self, id_environment, name, network):
"""Set template value. If id_environment = 0, set '' to all environments related with the template name.
:param id_environment: Environment Identifier.
:param name: Template Name.
:param network: IPv4 or IPv6.
:return: None
:raise InvalidParameterError: Invalid param.
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
: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.
"""
url = 'environment/set_template/' + str(id_environment) + '/'
environment_map = dict()
environment_map['name'] = name
environment_map['network'] = network
code, xml = self.submit({'environment': environment_map}, 'POST', url)
return self.response(code, xml) | [
"def",
"set_template",
"(",
"self",
",",
"id_environment",
",",
"name",
",",
"network",
")",
":",
"url",
"=",
"'environment/set_template/'",
"+",
"str",
"(",
"id_environment",
")",
"+",
"'/'",
"environment_map",
"=",
"dict",
"(",
")",
"environment_map",
"[",
"'name'",
"]",
"=",
"name",
"environment_map",
"[",
"'network'",
"]",
"=",
"network",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'environment'",
":",
"environment_map",
"}",
",",
"'POST'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Set template value. If id_environment = 0, set '' to all environments related with the template name.
:param id_environment: Environment Identifier.
:param name: Template Name.
:param network: IPv4 or IPv6.
:return: None
:raise InvalidParameterError: Invalid param.
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
: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. | [
"Set",
"template",
"value",
".",
"If",
"id_environment",
"=",
"0",
"set",
"to",
"all",
"environments",
"related",
"with",
"the",
"template",
"name",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L615-L638 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.get_environment_template | def get_environment_template(self, name, network):
"""Get environments by template name
:param name: Template name.
:param network: IPv4 or IPv6.
:return: Following dictionary:
::
{'ambiente': [divisao_dc - ambiente_logico - grupo_l3, other envs...] }
:raise InvalidParameterError: Invalid param.
: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.
"""
url = 'environment/get_env_template/'
map_dict = dict()
map_dict['name'] = name
map_dict['network'] = network
code, xml = self.submit({'map': map_dict}, 'PUT', url)
return self.response(code, xml) | python | def get_environment_template(self, name, network):
"""Get environments by template name
:param name: Template name.
:param network: IPv4 or IPv6.
:return: Following dictionary:
::
{'ambiente': [divisao_dc - ambiente_logico - grupo_l3, other envs...] }
:raise InvalidParameterError: Invalid param.
: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.
"""
url = 'environment/get_env_template/'
map_dict = dict()
map_dict['name'] = name
map_dict['network'] = network
code, xml = self.submit({'map': map_dict}, 'PUT', url)
return self.response(code, xml) | [
"def",
"get_environment_template",
"(",
"self",
",",
"name",
",",
"network",
")",
":",
"url",
"=",
"'environment/get_env_template/'",
"map_dict",
"=",
"dict",
"(",
")",
"map_dict",
"[",
"'name'",
"]",
"=",
"name",
"map_dict",
"[",
"'network'",
"]",
"=",
"network",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'map'",
":",
"map_dict",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Get environments by template name
:param name: Template name.
:param network: IPv4 or IPv6.
:return: Following dictionary:
::
{'ambiente': [divisao_dc - ambiente_logico - grupo_l3, other envs...] }
:raise InvalidParameterError: Invalid param.
: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. | [
"Get",
"environments",
"by",
"template",
"name"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L640-L664 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.save_blocks | def save_blocks(self, id_env, blocks):
"""
Save blocks from environment
:param id_env: Environment id
:param blocks: Lists of blocks in order. Ex: ['content one', 'content two', ...]
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'environment/save_blocks/'
map_dict = dict()
map_dict['id_env'] = id_env
map_dict['blocks'] = blocks
code, xml = self.submit({'map': map_dict}, 'POST', url)
return self.response(code, xml) | python | def save_blocks(self, id_env, blocks):
"""
Save blocks from environment
:param id_env: Environment id
:param blocks: Lists of blocks in order. Ex: ['content one', 'content two', ...]
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'environment/save_blocks/'
map_dict = dict()
map_dict['id_env'] = id_env
map_dict['blocks'] = blocks
code, xml = self.submit({'map': map_dict}, 'POST', url)
return self.response(code, xml) | [
"def",
"save_blocks",
"(",
"self",
",",
"id_env",
",",
"blocks",
")",
":",
"url",
"=",
"'environment/save_blocks/'",
"map_dict",
"=",
"dict",
"(",
")",
"map_dict",
"[",
"'id_env'",
"]",
"=",
"id_env",
"map_dict",
"[",
"'blocks'",
"]",
"=",
"blocks",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'map'",
":",
"map_dict",
"}",
",",
"'POST'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Save blocks from environment
:param id_env: Environment id
:param blocks: Lists of blocks in order. Ex: ['content one', 'content two', ...]
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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. | [
"Save",
"blocks",
"from",
"environment"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L666-L691 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.get_rule_by_pk | def get_rule_by_pk(self, id_rule):
"""
Get a rule by its identifier
:param id_rule: Rule identifier.
:return: Seguinte estrutura
::
{ 'rule': {'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'custom': < custom > }}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/get_by_id/' + str(id_rule)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def get_rule_by_pk(self, id_rule):
"""
Get a rule by its identifier
:param id_rule: Rule identifier.
:return: Seguinte estrutura
::
{ 'rule': {'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'custom': < custom > }}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/get_by_id/' + str(id_rule)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"get_rule_by_pk",
"(",
"self",
",",
"id_rule",
")",
":",
"url",
"=",
"'rule/get_by_id/'",
"+",
"str",
"(",
"id_rule",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Get a rule by its identifier
:param id_rule: Rule identifier.
:return: Seguinte estrutura
::
{ 'rule': {'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'custom': < custom > }}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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. | [
"Get",
"a",
"rule",
"by",
"its",
"identifier"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L774-L798 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.save_rule | def save_rule(self, name, id_env, contents, blocks_id):
"""
Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0 if is as custom content. Ex: ['0', '5', '0' ...]
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/save/'
map_dict = dict()
map_dict['name'] = name
map_dict['id_env'] = id_env
map_dict['contents'] = contents
map_dict['blocks_id'] = blocks_id
code, xml = self.submit({'map': map_dict}, 'POST', url)
return self.response(code, xml) | python | def save_rule(self, name, id_env, contents, blocks_id):
"""
Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0 if is as custom content. Ex: ['0', '5', '0' ...]
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/save/'
map_dict = dict()
map_dict['name'] = name
map_dict['id_env'] = id_env
map_dict['contents'] = contents
map_dict['blocks_id'] = blocks_id
code, xml = self.submit({'map': map_dict}, 'POST', url)
return self.response(code, xml) | [
"def",
"save_rule",
"(",
"self",
",",
"name",
",",
"id_env",
",",
"contents",
",",
"blocks_id",
")",
":",
"url",
"=",
"'rule/save/'",
"map_dict",
"=",
"dict",
"(",
")",
"map_dict",
"[",
"'name'",
"]",
"=",
"name",
"map_dict",
"[",
"'id_env'",
"]",
"=",
"id_env",
"map_dict",
"[",
"'contents'",
"]",
"=",
"contents",
"map_dict",
"[",
"'blocks_id'",
"]",
"=",
"blocks_id",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'map'",
":",
"map_dict",
"}",
",",
"'POST'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0 if is as custom content. Ex: ['0', '5', '0' ...]
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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. | [
"Save",
"an",
"environment",
"rule"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L800-L829 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.update_rule | def update_rule(self, name, id_env, contents, blocks_id, id_rule):
"""
Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0 if is as custom content. Ex: ['0', '5', '0' ...]
:param id_rule: Rule id
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/update/'
map_dict = dict()
map_dict['name'] = name
map_dict['id_env'] = id_env
map_dict['contents'] = contents
map_dict['blocks_id'] = blocks_id
map_dict['id_rule'] = id_rule
try:
code, xml = self.submit({'map': map_dict}, 'PUT', url)
except Exception as e:
raise e
return self.response(code, xml) | python | def update_rule(self, name, id_env, contents, blocks_id, id_rule):
"""
Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0 if is as custom content. Ex: ['0', '5', '0' ...]
:param id_rule: Rule id
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/update/'
map_dict = dict()
map_dict['name'] = name
map_dict['id_env'] = id_env
map_dict['contents'] = contents
map_dict['blocks_id'] = blocks_id
map_dict['id_rule'] = id_rule
try:
code, xml = self.submit({'map': map_dict}, 'PUT', url)
except Exception as e:
raise e
return self.response(code, xml) | [
"def",
"update_rule",
"(",
"self",
",",
"name",
",",
"id_env",
",",
"contents",
",",
"blocks_id",
",",
"id_rule",
")",
":",
"url",
"=",
"'rule/update/'",
"map_dict",
"=",
"dict",
"(",
")",
"map_dict",
"[",
"'name'",
"]",
"=",
"name",
"map_dict",
"[",
"'id_env'",
"]",
"=",
"id_env",
"map_dict",
"[",
"'contents'",
"]",
"=",
"contents",
"map_dict",
"[",
"'blocks_id'",
"]",
"=",
"blocks_id",
"map_dict",
"[",
"'id_rule'",
"]",
"=",
"id_rule",
"try",
":",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'map'",
":",
"map_dict",
"}",
",",
"'PUT'",
",",
"url",
")",
"except",
"Exception",
"as",
"e",
":",
"raise",
"e",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0 if is as custom content. Ex: ['0', '5', '0' ...]
:param id_rule: Rule id
:return: None
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise InvalidValueError: Invalid parameter.
:raise UserNotAuthorizedError: Permissão negada.
: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. | [
"Save",
"an",
"environment",
"rule"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L831-L865 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.get_all_rules | def get_all_rules(self, id_env):
"""Save an environment rule
:param id_env: Environment id
:return: Estrutura:
::
{ 'rules': [{'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'custom': < custom > },... ]}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/all/' + str(id_env)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['rules']) | python | def get_all_rules(self, id_env):
"""Save an environment rule
:param id_env: Environment id
:return: Estrutura:
::
{ 'rules': [{'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'custom': < custom > },... ]}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise UserNotAuthorizedError: Permissão negada.
: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.
"""
url = 'rule/all/' + str(id_env)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['rules']) | [
"def",
"get_all_rules",
"(",
"self",
",",
"id_env",
")",
":",
"url",
"=",
"'rule/all/'",
"+",
"str",
"(",
"id_env",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
",",
"[",
"'rules'",
"]",
")"
] | Save an environment rule
:param id_env: Environment id
:return: Estrutura:
::
{ 'rules': [{'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'custom': < custom > },... ]}
:raise AmbienteNaoExisteError: Ambiente não cadastrado.
:raise UserNotAuthorizedError: Permissão negada.
: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. | [
"Save",
"an",
"environment",
"rule"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L888-L911 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.configuration_save | def configuration_save(
self,
id_environment,
network,
prefix,
ip_version,
network_type):
"""
Add new prefix configuration
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:param network: Network Ipv4 or Ipv6.
:param prefix: Prefix 0-32 to Ipv4 or 0-128 to Ipv6.
:param ip_version: v4 to IPv4 or v6 to IPv6
:param network_type: type network
:return: Following dictionary:
::
{'network':{'id_environment': <id_environment>,
'id_vlan': <id_vlan>,
'network_type': <network_type>,
'network': <network>,
'prefix': <prefix>} }
:raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered.
:raise InvalidValueError: Invalid Id for environment or network or network_type or prefix.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response.
"""
network_map = dict()
network_map['id_environment'] = id_environment
network_map['network'] = network
network_map['prefix'] = prefix
network_map['ip_version'] = ip_version
network_map['network_type'] = network_type
code, xml = self.submit(
{'ambiente': network_map}, 'POST', 'environment/configuration/save/')
return self.response(code, xml) | python | def configuration_save(
self,
id_environment,
network,
prefix,
ip_version,
network_type):
"""
Add new prefix configuration
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:param network: Network Ipv4 or Ipv6.
:param prefix: Prefix 0-32 to Ipv4 or 0-128 to Ipv6.
:param ip_version: v4 to IPv4 or v6 to IPv6
:param network_type: type network
:return: Following dictionary:
::
{'network':{'id_environment': <id_environment>,
'id_vlan': <id_vlan>,
'network_type': <network_type>,
'network': <network>,
'prefix': <prefix>} }
:raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered.
:raise InvalidValueError: Invalid Id for environment or network or network_type or prefix.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response.
"""
network_map = dict()
network_map['id_environment'] = id_environment
network_map['network'] = network
network_map['prefix'] = prefix
network_map['ip_version'] = ip_version
network_map['network_type'] = network_type
code, xml = self.submit(
{'ambiente': network_map}, 'POST', 'environment/configuration/save/')
return self.response(code, xml) | [
"def",
"configuration_save",
"(",
"self",
",",
"id_environment",
",",
"network",
",",
"prefix",
",",
"ip_version",
",",
"network_type",
")",
":",
"network_map",
"=",
"dict",
"(",
")",
"network_map",
"[",
"'id_environment'",
"]",
"=",
"id_environment",
"network_map",
"[",
"'network'",
"]",
"=",
"network",
"network_map",
"[",
"'prefix'",
"]",
"=",
"prefix",
"network_map",
"[",
"'ip_version'",
"]",
"=",
"ip_version",
"network_map",
"[",
"'network_type'",
"]",
"=",
"network_type",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'ambiente'",
":",
"network_map",
"}",
",",
"'POST'",
",",
"'environment/configuration/save/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Add new prefix configuration
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:param network: Network Ipv4 or Ipv6.
:param prefix: Prefix 0-32 to Ipv4 or 0-128 to Ipv6.
:param ip_version: v4 to IPv4 or v6 to IPv6
:param network_type: type network
:return: Following dictionary:
::
{'network':{'id_environment': <id_environment>,
'id_vlan': <id_vlan>,
'network_type': <network_type>,
'network': <network>,
'prefix': <prefix>} }
:raise ConfigEnvironmentInvalidError: Invalid Environment Configuration or not registered.
:raise InvalidValueError: Invalid Id for environment or network or network_type or prefix.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Add",
"new",
"prefix",
"configuration"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L913-L955 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.configuration_list_all | def configuration_list_all(self, environment_id):
"""
List all prefix configurations by environment in DB
:return: Following dictionary:
::
{'lists_configuration': [{
'id': <id_ipconfig>,
'subnet': <subnet>,
'type': <type>,
'new_prefix': <new_prefix>,
}, ... ]}
:raise InvalidValueError: Invalid ID for Environment.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response.
"""
data = dict()
data["environment_id"] = environment_id
url = ("environment/configuration/list/%(environment_id)s/" % data)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, force_list=['lists_configuration']) | python | def configuration_list_all(self, environment_id):
"""
List all prefix configurations by environment in DB
:return: Following dictionary:
::
{'lists_configuration': [{
'id': <id_ipconfig>,
'subnet': <subnet>,
'type': <type>,
'new_prefix': <new_prefix>,
}, ... ]}
:raise InvalidValueError: Invalid ID for Environment.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response.
"""
data = dict()
data["environment_id"] = environment_id
url = ("environment/configuration/list/%(environment_id)s/" % data)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, force_list=['lists_configuration']) | [
"def",
"configuration_list_all",
"(",
"self",
",",
"environment_id",
")",
":",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"\"environment_id\"",
"]",
"=",
"environment_id",
"url",
"=",
"(",
"\"environment/configuration/list/%(environment_id)s/\"",
"%",
"data",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
",",
"force_list",
"=",
"[",
"'lists_configuration'",
"]",
")"
] | List all prefix configurations by environment in DB
:return: Following dictionary:
::
{'lists_configuration': [{
'id': <id_ipconfig>,
'subnet': <subnet>,
'type': <type>,
'new_prefix': <new_prefix>,
}, ... ]}
:raise InvalidValueError: Invalid ID for Environment.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response. | [
"List",
"all",
"prefix",
"configurations",
"by",
"environment",
"in",
"DB"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L957-L986 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.configuration_remove | def configuration_remove(self, environment_id, configuration_id):
"""
Remove Prefix Configuration
:return: None
:raise InvalidValueError: Invalid Id for Environment or IpConfig.
:raise IPConfigNotFoundError: Ipconfig not resgistred.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response.
"""
data = dict()
data["configuration_id"] = configuration_id
data["environment_id"] = environment_id
url = (
"environment/configuration/remove/%(environment_id)s/%(configuration_id)s/" %
data)
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def configuration_remove(self, environment_id, configuration_id):
"""
Remove Prefix Configuration
:return: None
:raise InvalidValueError: Invalid Id for Environment or IpConfig.
:raise IPConfigNotFoundError: Ipconfig not resgistred.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response.
"""
data = dict()
data["configuration_id"] = configuration_id
data["environment_id"] = environment_id
url = (
"environment/configuration/remove/%(environment_id)s/%(configuration_id)s/" %
data)
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"configuration_remove",
"(",
"self",
",",
"environment_id",
",",
"configuration_id",
")",
":",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"\"configuration_id\"",
"]",
"=",
"configuration_id",
"data",
"[",
"\"environment_id\"",
"]",
"=",
"environment_id",
"url",
"=",
"(",
"\"environment/configuration/remove/%(environment_id)s/%(configuration_id)s/\"",
"%",
"data",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove Prefix Configuration
:return: None
:raise InvalidValueError: Invalid Id for Environment or IpConfig.
:raise IPConfigNotFoundError: Ipconfig not resgistred.
:raise AmbienteNotFoundError: Environment not registered.
:raise DataBaseError: Failed into networkapi access data base.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Prefix",
"Configuration"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L988-L1013 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.associate | def associate(self, environment_id, environment_vip_id):
"""Associate a news Environment on Environment VIP and returns its identifier.
:param environment_id: Identifier of the Environment. Integer value and greater than zero.
:param environment_vip_id: Identifier of the Environment VIP. Integer value and greater than zero.
:return: Following dictionary:
::
{'environment_environment_vip': {'id': < id >}}
:raise InvalidParameterError: The value of environment_id or environment_vip_id is invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_id):
raise InvalidParameterError(
u'The identifier of Environment VIP is invalid or was not informed.')
if not is_valid_int_param(environment_vip_id):
raise InvalidParameterError(
u'The identifier of Environment is invalid or was not informed.')
environment_environment_vip_map = dict()
environment_environment_vip_map['environment_id'] = environment_id
environment_environment_vip_map['environment_vip_id'] = environment_vip_id
url = 'environment/{}/environmentvip/{}/'.format(environment_id, environment_vip_id)
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml) | python | def associate(self, environment_id, environment_vip_id):
"""Associate a news Environment on Environment VIP and returns its identifier.
:param environment_id: Identifier of the Environment. Integer value and greater than zero.
:param environment_vip_id: Identifier of the Environment VIP. Integer value and greater than zero.
:return: Following dictionary:
::
{'environment_environment_vip': {'id': < id >}}
:raise InvalidParameterError: The value of environment_id or environment_vip_id is invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_id):
raise InvalidParameterError(
u'The identifier of Environment VIP is invalid or was not informed.')
if not is_valid_int_param(environment_vip_id):
raise InvalidParameterError(
u'The identifier of Environment is invalid or was not informed.')
environment_environment_vip_map = dict()
environment_environment_vip_map['environment_id'] = environment_id
environment_environment_vip_map['environment_vip_id'] = environment_vip_id
url = 'environment/{}/environmentvip/{}/'.format(environment_id, environment_vip_id)
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml) | [
"def",
"associate",
"(",
"self",
",",
"environment_id",
",",
"environment_vip_id",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"environment_id",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Environment VIP is invalid or was not informed.'",
")",
"if",
"not",
"is_valid_int_param",
"(",
"environment_vip_id",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Environment is invalid or was not informed.'",
")",
"environment_environment_vip_map",
"=",
"dict",
"(",
")",
"environment_environment_vip_map",
"[",
"'environment_id'",
"]",
"=",
"environment_id",
"environment_environment_vip_map",
"[",
"'environment_vip_id'",
"]",
"=",
"environment_vip_id",
"url",
"=",
"'environment/{}/environmentvip/{}/'",
".",
"format",
"(",
"environment_id",
",",
"environment_vip_id",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Associate a news Environment on Environment VIP and returns its identifier.
:param environment_id: Identifier of the Environment. Integer value and greater than zero.
:param environment_vip_id: Identifier of the Environment VIP. Integer value and greater than zero.
:return: Following dictionary:
::
{'environment_environment_vip': {'id': < id >}}
:raise InvalidParameterError: The value of environment_id or environment_vip_id is invalid.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Associate",
"a",
"news",
"Environment",
"on",
"Environment",
"VIP",
"and",
"returns",
"its",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L1015-L1048 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Ambiente.py | Ambiente.get_related_environment_list | def get_related_environment_list(self, environment_vip_id):
"""Get all Environment by Environment Vip.
:return: Following dictionary:
::
{'ambiente': [{ 'id': <id_environment>,
'grupo_l3': <id_group_l3>,
'grupo_l3_name': <name_group_l3>,
'ambiente_logico': <id_logical_environment>,
'ambiente_logico_name': <name_ambiente_logico>,
'divisao_dc': <id_dc_division>,
'divisao_dc_name': <name_divisao_dc>,
'filter': <id_filter>,
'filter_name': <filter_name>,
'link': <link> }, ... ]}
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
url = 'environment/environmentvip/{}/'.format(environment_vip_id)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['environment_related_list']) | python | def get_related_environment_list(self, environment_vip_id):
"""Get all Environment by Environment Vip.
:return: Following dictionary:
::
{'ambiente': [{ 'id': <id_environment>,
'grupo_l3': <id_group_l3>,
'grupo_l3_name': <name_group_l3>,
'ambiente_logico': <id_logical_environment>,
'ambiente_logico_name': <name_ambiente_logico>,
'divisao_dc': <id_dc_division>,
'divisao_dc_name': <name_divisao_dc>,
'filter': <id_filter>,
'filter_name': <filter_name>,
'link': <link> }, ... ]}
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
url = 'environment/environmentvip/{}/'.format(environment_vip_id)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['environment_related_list']) | [
"def",
"get_related_environment_list",
"(",
"self",
",",
"environment_vip_id",
")",
":",
"url",
"=",
"'environment/environmentvip/{}/'",
".",
"format",
"(",
"environment_vip_id",
")",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
",",
"[",
"'environment_related_list'",
"]",
")"
] | Get all Environment by Environment Vip.
:return: Following dictionary:
::
{'ambiente': [{ 'id': <id_environment>,
'grupo_l3': <id_group_l3>,
'grupo_l3_name': <name_group_l3>,
'ambiente_logico': <id_logical_environment>,
'ambiente_logico_name': <name_ambiente_logico>,
'divisao_dc': <id_dc_division>,
'divisao_dc_name': <name_divisao_dc>,
'filter': <id_filter>,
'filter_name': <filter_name>,
'link': <link> }, ... ]}
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response. | [
"Get",
"all",
"Environment",
"by",
"Environment",
"Vip",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ambiente.py#L1085-L1113 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiEquipment.py | ApiEquipment.get_equipment | def get_equipment(self, **kwargs):
"""
Return list environments related with environment vip
"""
uri = 'api/v3/equipment/'
uri = self.prepare_url(uri, kwargs)
return super(ApiEquipment, self).get(uri) | python | def get_equipment(self, **kwargs):
"""
Return list environments related with environment vip
"""
uri = 'api/v3/equipment/'
uri = self.prepare_url(uri, kwargs)
return super(ApiEquipment, self).get(uri) | [
"def",
"get_equipment",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"'api/v3/equipment/'",
"uri",
"=",
"self",
".",
"prepare_url",
"(",
"uri",
",",
"kwargs",
")",
"return",
"super",
"(",
"ApiEquipment",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | Return list environments related with environment vip | [
"Return",
"list",
"environments",
"related",
"with",
"environment",
"vip"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiEquipment.py#L36-L44 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiEquipment.py | ApiEquipment.search | def search(self, **kwargs):
"""
Method to search equipments based on extends search.
:param search: Dict containing QuerySets to find equipments.
: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 equipments
"""
return super(ApiEquipment, self).get(self.prepare_url('api/v3/equipment/',
kwargs)) | python | def search(self, **kwargs):
"""
Method to search equipments based on extends search.
:param search: Dict containing QuerySets to find equipments.
: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 equipments
"""
return super(ApiEquipment, self).get(self.prepare_url('api/v3/equipment/',
kwargs)) | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"ApiEquipment",
",",
"self",
")",
".",
"get",
"(",
"self",
".",
"prepare_url",
"(",
"'api/v3/equipment/'",
",",
"kwargs",
")",
")"
] | Method to search equipments based on extends search.
:param search: Dict containing QuerySets to find equipments.
: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 equipments | [
"Method",
"to",
"search",
"equipments",
"based",
"on",
"extends",
"search",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiEquipment.py#L46-L59 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiEquipment.py | ApiEquipment.delete | def delete(self, ids):
"""
Method to delete equipments by their id's
:param ids: Identifiers of equipments
:return: None
"""
url = build_uri_with_ids('api/v3/equipment/%s/', ids)
return super(ApiEquipment, self).delete(url) | python | def delete(self, ids):
"""
Method to delete equipments by their id's
:param ids: Identifiers of equipments
:return: None
"""
url = build_uri_with_ids('api/v3/equipment/%s/', ids)
return super(ApiEquipment, self).delete(url) | [
"def",
"delete",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/equipment/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiEquipment",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to delete equipments by their id's
:param ids: Identifiers of equipments
:return: None | [
"Method",
"to",
"delete",
"equipments",
"by",
"their",
"id",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiEquipment.py#L75-L83 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiEquipment.py | ApiEquipment.create | def create(self, equipments):
"""
Method to create equipments
:param equipments: List containing equipments desired to be created on database
:return: None
"""
data = {'equipments': equipments}
return super(ApiEquipment, self).post('api/v3/equipment/', data) | python | def create(self, equipments):
"""
Method to create equipments
:param equipments: List containing equipments desired to be created on database
:return: None
"""
data = {'equipments': equipments}
return super(ApiEquipment, self).post('api/v3/equipment/', data) | [
"def",
"create",
"(",
"self",
",",
"equipments",
")",
":",
"data",
"=",
"{",
"'equipments'",
":",
"equipments",
"}",
"return",
"super",
"(",
"ApiEquipment",
",",
"self",
")",
".",
"post",
"(",
"'api/v3/equipment/'",
",",
"data",
")"
] | Method to create equipments
:param equipments: List containing equipments desired to be created on database
:return: None | [
"Method",
"to",
"create",
"equipments"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiEquipment.py#L99-L108 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiPoolDeploy.py | ApiPoolDeploy.delete | def delete(self, ids):
"""
Method to undeploy pool's by their ids
:param ids: Identifiers of deployed pool's
:return: Empty Dict
"""
url = build_uri_with_ids('api/v3/pool/deploy/%s/', ids)
return super(ApiPoolDeploy, self).delete(url) | python | def delete(self, ids):
"""
Method to undeploy pool's by their ids
:param ids: Identifiers of deployed pool's
:return: Empty Dict
"""
url = build_uri_with_ids('api/v3/pool/deploy/%s/', ids)
return super(ApiPoolDeploy, self).delete(url) | [
"def",
"delete",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/pool/deploy/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiPoolDeploy",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to undeploy pool's by their ids
:param ids: Identifiers of deployed pool's
:return: Empty Dict | [
"Method",
"to",
"undeploy",
"pool",
"s",
"by",
"their",
"ids"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPoolDeploy.py#L36-L45 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiPoolDeploy.py | ApiPoolDeploy.create | def create(self, ids):
"""
Method to deploy pool's
:param pools: Identifiers of pool's desired to be deployed
:return: Empty Dict
"""
url = build_uri_with_ids('api/v3/pool/deploy/%s/', ids)
return super(ApiPoolDeploy, self).post(url) | python | def create(self, ids):
"""
Method to deploy pool's
:param pools: Identifiers of pool's desired to be deployed
:return: Empty Dict
"""
url = build_uri_with_ids('api/v3/pool/deploy/%s/', ids)
return super(ApiPoolDeploy, self).post(url) | [
"def",
"create",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/pool/deploy/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiPoolDeploy",
",",
"self",
")",
".",
"post",
"(",
"url",
")"
] | Method to deploy pool's
:param pools: Identifiers of pool's desired to be deployed
:return: Empty Dict | [
"Method",
"to",
"deploy",
"pool",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiPoolDeploy.py#L62-L71 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Vip.py | Vip.edit_reals | def edit_reals(
self,
id_vip,
method_bal,
reals,
reals_prioritys,
reals_weights,
alter_priority=0):
"""Execute the script 'gerador_vips' several times with options -real, -add and -del to adjust vip request reals.
:param id_vip: Identifier of the VIP. Integer value and greater than zero.
:param method_bal: method_bal.
:param reals: List of reals. Ex: [{'real_name':'Teste1', 'real_ip':'10.10.10.1'},{'real_name':'Teste2', 'real_ip':'10.10.10.2'}]
:param reals_prioritys: List of reals_priority. Ex: ['1','5','3'].
:param reals_weights: List of reals_weight. Ex: ['1','5','3'].
:param alter_priority: 1 if priority has changed and 0 if hasn't changed.
:return: None
:raise VipNaoExisteError: Request VIP not registered.
:raise InvalidParameterError: Identifier of the request is invalid or null VIP.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
:raise EnvironmentVipError: The combination of finality, client and environment is invalid.
:raise InvalidTimeoutValueError: The value of timeout is invalid.
:raise InvalidBalMethodValueError: The value of method_bal is invalid.
:raise InvalidCacheValueError: The value of cache is invalid.
:raise InvalidPersistenceValueError: The value of persistence is invalid.
:raise InvalidPriorityValueError: One of the priority values is invalid.
:raise EquipamentoNaoExisteError: The equipment associated with this Vip Request doesn't exist.
:raise IpEquipmentError: Association between equipment and ip of this Vip Request doesn't exist.
:raise IpError: IP not registered.
:raise RealServerPriorityError: Vip Request priority list has an error.
:raise RealServerWeightError: Vip Request weight list has an error.
:raise RealServerPortError: Vip Request port list has an error.
:raise RealParameterValueError: Vip Request real server parameter list has an error.
:raise RealServerScriptError: Vip Request real server script execution error.
"""
if not is_valid_int_param(id_vip):
raise InvalidParameterError(
u'The identifier of vip is invalid or was not informed.')
vip_map = dict()
vip_map['vip_id'] = id_vip
# vip_map['metodo_bal'] = method_bal
vip_map['reals'] = {'real': reals}
vip_map['reals_prioritys'] = {'reals_priority': reals_prioritys}
vip_map['reals_weights'] = {'reals_weight': reals_weights}
vip_map['alter_priority'] = alter_priority
url = 'vip/real/edit/'
code, xml = self.submit({'vip': vip_map}, 'PUT', url)
return self.response(code, xml) | python | def edit_reals(
self,
id_vip,
method_bal,
reals,
reals_prioritys,
reals_weights,
alter_priority=0):
"""Execute the script 'gerador_vips' several times with options -real, -add and -del to adjust vip request reals.
:param id_vip: Identifier of the VIP. Integer value and greater than zero.
:param method_bal: method_bal.
:param reals: List of reals. Ex: [{'real_name':'Teste1', 'real_ip':'10.10.10.1'},{'real_name':'Teste2', 'real_ip':'10.10.10.2'}]
:param reals_prioritys: List of reals_priority. Ex: ['1','5','3'].
:param reals_weights: List of reals_weight. Ex: ['1','5','3'].
:param alter_priority: 1 if priority has changed and 0 if hasn't changed.
:return: None
:raise VipNaoExisteError: Request VIP not registered.
:raise InvalidParameterError: Identifier of the request is invalid or null VIP.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
:raise EnvironmentVipError: The combination of finality, client and environment is invalid.
:raise InvalidTimeoutValueError: The value of timeout is invalid.
:raise InvalidBalMethodValueError: The value of method_bal is invalid.
:raise InvalidCacheValueError: The value of cache is invalid.
:raise InvalidPersistenceValueError: The value of persistence is invalid.
:raise InvalidPriorityValueError: One of the priority values is invalid.
:raise EquipamentoNaoExisteError: The equipment associated with this Vip Request doesn't exist.
:raise IpEquipmentError: Association between equipment and ip of this Vip Request doesn't exist.
:raise IpError: IP not registered.
:raise RealServerPriorityError: Vip Request priority list has an error.
:raise RealServerWeightError: Vip Request weight list has an error.
:raise RealServerPortError: Vip Request port list has an error.
:raise RealParameterValueError: Vip Request real server parameter list has an error.
:raise RealServerScriptError: Vip Request real server script execution error.
"""
if not is_valid_int_param(id_vip):
raise InvalidParameterError(
u'The identifier of vip is invalid or was not informed.')
vip_map = dict()
vip_map['vip_id'] = id_vip
# vip_map['metodo_bal'] = method_bal
vip_map['reals'] = {'real': reals}
vip_map['reals_prioritys'] = {'reals_priority': reals_prioritys}
vip_map['reals_weights'] = {'reals_weight': reals_weights}
vip_map['alter_priority'] = alter_priority
url = 'vip/real/edit/'
code, xml = self.submit({'vip': vip_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"edit_reals",
"(",
"self",
",",
"id_vip",
",",
"method_bal",
",",
"reals",
",",
"reals_prioritys",
",",
"reals_weights",
",",
"alter_priority",
"=",
"0",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_vip",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of vip is invalid or was not informed.'",
")",
"vip_map",
"=",
"dict",
"(",
")",
"vip_map",
"[",
"'vip_id'",
"]",
"=",
"id_vip",
"# vip_map['metodo_bal'] = method_bal",
"vip_map",
"[",
"'reals'",
"]",
"=",
"{",
"'real'",
":",
"reals",
"}",
"vip_map",
"[",
"'reals_prioritys'",
"]",
"=",
"{",
"'reals_priority'",
":",
"reals_prioritys",
"}",
"vip_map",
"[",
"'reals_weights'",
"]",
"=",
"{",
"'reals_weight'",
":",
"reals_weights",
"}",
"vip_map",
"[",
"'alter_priority'",
"]",
"=",
"alter_priority",
"url",
"=",
"'vip/real/edit/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'vip'",
":",
"vip_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Execute the script 'gerador_vips' several times with options -real, -add and -del to adjust vip request reals.
:param id_vip: Identifier of the VIP. Integer value and greater than zero.
:param method_bal: method_bal.
:param reals: List of reals. Ex: [{'real_name':'Teste1', 'real_ip':'10.10.10.1'},{'real_name':'Teste2', 'real_ip':'10.10.10.2'}]
:param reals_prioritys: List of reals_priority. Ex: ['1','5','3'].
:param reals_weights: List of reals_weight. Ex: ['1','5','3'].
:param alter_priority: 1 if priority has changed and 0 if hasn't changed.
:return: None
:raise VipNaoExisteError: Request VIP not registered.
:raise InvalidParameterError: Identifier of the request is invalid or null VIP.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
:raise EnvironmentVipError: The combination of finality, client and environment is invalid.
:raise InvalidTimeoutValueError: The value of timeout is invalid.
:raise InvalidBalMethodValueError: The value of method_bal is invalid.
:raise InvalidCacheValueError: The value of cache is invalid.
:raise InvalidPersistenceValueError: The value of persistence is invalid.
:raise InvalidPriorityValueError: One of the priority values is invalid.
:raise EquipamentoNaoExisteError: The equipment associated with this Vip Request doesn't exist.
:raise IpEquipmentError: Association between equipment and ip of this Vip Request doesn't exist.
:raise IpError: IP not registered.
:raise RealServerPriorityError: Vip Request priority list has an error.
:raise RealServerWeightError: Vip Request weight list has an error.
:raise RealServerPortError: Vip Request port list has an error.
:raise RealParameterValueError: Vip Request real server parameter list has an error.
:raise RealServerScriptError: Vip Request real server script execution error. | [
"Execute",
"the",
"script",
"gerador_vips",
"several",
"times",
"with",
"options",
"-",
"real",
"-",
"add",
"and",
"-",
"del",
"to",
"adjust",
"vip",
"request",
"reals",
".",
":",
"param",
"id_vip",
":",
"Identifier",
"of",
"the",
"VIP",
".",
"Integer",
"value",
"and",
"greater",
"than",
"zero",
".",
":",
"param",
"method_bal",
":",
"method_bal",
".",
":",
"param",
"reals",
":",
"List",
"of",
"reals",
".",
"Ex",
":",
"[",
"{",
"real_name",
":",
"Teste1",
"real_ip",
":",
"10",
".",
"10",
".",
"10",
".",
"1",
"}",
"{",
"real_name",
":",
"Teste2",
"real_ip",
":",
"10",
".",
"10",
".",
"10",
".",
"2",
"}",
"]",
":",
"param",
"reals_prioritys",
":",
"List",
"of",
"reals_priority",
".",
"Ex",
":",
"[",
"1",
"5",
"3",
"]",
".",
":",
"param",
"reals_weights",
":",
"List",
"of",
"reals_weight",
".",
"Ex",
":",
"[",
"1",
"5",
"3",
"]",
".",
":",
"param",
"alter_priority",
":",
"1",
"if",
"priority",
"has",
"changed",
"and",
"0",
"if",
"hasn",
"t",
"changed",
".",
":",
"return",
":",
"None",
":",
"raise",
"VipNaoExisteError",
":",
"Request",
"VIP",
"not",
"registered",
".",
":",
"raise",
"InvalidParameterError",
":",
"Identifier",
"of",
"the",
"request",
"is",
"invalid",
"or",
"null",
"VIP",
".",
":",
"raise",
"DataBaseError",
":",
"Networkapi",
"failed",
"to",
"access",
"the",
"database",
".",
":",
"raise",
"XMLError",
":",
"Networkapi",
"failed",
"to",
"generate",
"the",
"XML",
"response",
".",
":",
"raise",
"EnvironmentVipError",
":",
"The",
"combination",
"of",
"finality",
"client",
"and",
"environment",
"is",
"invalid",
".",
":",
"raise",
"InvalidTimeoutValueError",
":",
"The",
"value",
"of",
"timeout",
"is",
"invalid",
".",
":",
"raise",
"InvalidBalMethodValueError",
":",
"The",
"value",
"of",
"method_bal",
"is",
"invalid",
".",
":",
"raise",
"InvalidCacheValueError",
":",
"The",
"value",
"of",
"cache",
"is",
"invalid",
".",
":",
"raise",
"InvalidPersistenceValueError",
":",
"The",
"value",
"of",
"persistence",
"is",
"invalid",
".",
":",
"raise",
"InvalidPriorityValueError",
":",
"One",
"of",
"the",
"priority",
"values",
"is",
"invalid",
".",
":",
"raise",
"EquipamentoNaoExisteError",
":",
"The",
"equipment",
"associated",
"with",
"this",
"Vip",
"Request",
"doesn",
"t",
"exist",
".",
":",
"raise",
"IpEquipmentError",
":",
"Association",
"between",
"equipment",
"and",
"ip",
"of",
"this",
"Vip",
"Request",
"doesn",
"t",
"exist",
".",
":",
"raise",
"IpError",
":",
"IP",
"not",
"registered",
".",
":",
"raise",
"RealServerPriorityError",
":",
"Vip",
"Request",
"priority",
"list",
"has",
"an",
"error",
".",
":",
"raise",
"RealServerWeightError",
":",
"Vip",
"Request",
"weight",
"list",
"has",
"an",
"error",
".",
":",
"raise",
"RealServerPortError",
":",
"Vip",
"Request",
"port",
"list",
"has",
"an",
"error",
".",
":",
"raise",
"RealParameterValueError",
":",
"Vip",
"Request",
"real",
"server",
"parameter",
"list",
"has",
"an",
"error",
".",
":",
"raise",
"RealServerScriptError",
":",
"Vip",
"Request",
"real",
"server",
"script",
"execution",
"error",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Vip.py#L31-L83 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Marca.py | Marca.inserir | def inserir(self, name):
"""Inserts a new Brand and returns its identifier
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: Dictionary with the following structure:
::
{'marca': {'id': < id_brand >}}
:raise InvalidParameterError: Name is null and invalid.
:raise NomeMarcaDuplicadoError: There is already a registered Brand with the value of name.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
brand_map = dict()
brand_map['name'] = name
code, xml = self.submit({'brand': brand_map}, 'POST', 'brand/')
return self.response(code, xml) | python | def inserir(self, name):
"""Inserts a new Brand and returns its identifier
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: Dictionary with the following structure:
::
{'marca': {'id': < id_brand >}}
:raise InvalidParameterError: Name is null and invalid.
:raise NomeMarcaDuplicadoError: There is already a registered Brand with the value of name.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
brand_map = dict()
brand_map['name'] = name
code, xml = self.submit({'brand': brand_map}, 'POST', 'brand/')
return self.response(code, xml) | [
"def",
"inserir",
"(",
"self",
",",
"name",
")",
":",
"brand_map",
"=",
"dict",
"(",
")",
"brand_map",
"[",
"'name'",
"]",
"=",
"name",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'brand'",
":",
"brand_map",
"}",
",",
"'POST'",
",",
"'brand/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Inserts a new Brand and returns its identifier
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: Dictionary with the following structure:
::
{'marca': {'id': < id_brand >}}
:raise InvalidParameterError: Name is null and invalid.
:raise NomeMarcaDuplicadoError: There is already a registered Brand with the value of name.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Inserts",
"a",
"new",
"Brand",
"and",
"returns",
"its",
"identifier"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Marca.py#L50-L71 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Marca.py | Marca.alterar | def alterar(self, id_brand, name):
"""Change Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: None
:raise InvalidParameterError: The identifier of Brand or name is null and invalid.
:raise NomeMarcaDuplicadoError: There is already a registered Brand with the value of name.
: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 = 'brand/' + str(id_brand) + '/'
brand_map = dict()
brand_map['name'] = name
code, xml = self.submit({'brand': brand_map}, 'PUT', url)
return self.response(code, xml) | python | def alterar(self, id_brand, name):
"""Change Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: None
:raise InvalidParameterError: The identifier of Brand or name is null and invalid.
:raise NomeMarcaDuplicadoError: There is already a registered Brand with the value of name.
: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 = 'brand/' + str(id_brand) + '/'
brand_map = dict()
brand_map['name'] = name
code, xml = self.submit({'brand': brand_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"alterar",
"(",
"self",
",",
"id_brand",
",",
"name",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_brand",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Brand is invalid or was not informed.'",
")",
"url",
"=",
"'brand/'",
"+",
"str",
"(",
"id_brand",
")",
"+",
"'/'",
"brand_map",
"=",
"dict",
"(",
")",
"brand_map",
"[",
"'name'",
"]",
"=",
"name",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'brand'",
":",
"brand_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Change Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: None
:raise InvalidParameterError: The identifier of Brand or name is null and invalid.
:raise NomeMarcaDuplicadoError: There is already a registered Brand with the value of name.
:raise MarcaNaoExisteError: Brand not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Change",
"Brand",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Marca.py#L73-L99 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Marca.py | Marca.remover | def remover(self, id_brand):
"""Remove Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Brand is null and invalid.
:raise MarcaNaoExisteError: Brand not registered.
:raise MarcaError: The brand is associated with a model.
: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 = 'brand/' + str(id_brand) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def remover(self, id_brand):
"""Remove Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Brand is null and invalid.
:raise MarcaNaoExisteError: Brand not registered.
:raise MarcaError: The brand is associated with a model.
: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 = 'brand/' + str(id_brand) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"remover",
"(",
"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",
"=",
"'brand/'",
"+",
"str",
"(",
"id_brand",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Brand is null and invalid.
:raise MarcaNaoExisteError: Brand not registered.
:raise MarcaError: The brand is associated with a model.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Brand",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Marca.py#L101-L123 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVlan.py | ApiVlan.acl_remove_draft | def acl_remove_draft(self, id_vlan, type_acl):
"""
Remove Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise InvalidIdVlanException: Invalid id for Vlan.
:raise NetworkAPIException: Failed to access the data source.
"""
parameters = dict(id_vlan=id_vlan, type_acl=type_acl)
uri = 'api/vlan/acl/remove/draft/%(id_vlan)s/%(type_acl)s/' % parameters
return super(ApiVlan, self).get(uri) | python | def acl_remove_draft(self, id_vlan, type_acl):
"""
Remove Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise InvalidIdVlanException: Invalid id for Vlan.
:raise NetworkAPIException: Failed to access the data source.
"""
parameters = dict(id_vlan=id_vlan, type_acl=type_acl)
uri = 'api/vlan/acl/remove/draft/%(id_vlan)s/%(type_acl)s/' % parameters
return super(ApiVlan, self).get(uri) | [
"def",
"acl_remove_draft",
"(",
"self",
",",
"id_vlan",
",",
"type_acl",
")",
":",
"parameters",
"=",
"dict",
"(",
"id_vlan",
"=",
"id_vlan",
",",
"type_acl",
"=",
"type_acl",
")",
"uri",
"=",
"'api/vlan/acl/remove/draft/%(id_vlan)s/%(type_acl)s/'",
"%",
"parameters",
"return",
"super",
"(",
"ApiVlan",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | Remove Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise InvalidIdVlanException: Invalid id for Vlan.
:raise NetworkAPIException: Failed to access the data source. | [
"Remove",
"Acl",
"draft",
"by",
"type"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVlan.py#L36-L54 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVlan.py | ApiVlan.acl_save_draft | def acl_save_draft(self, id_vlan, type_acl, content_draft):
"""
Save Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise InvalidIdVlanException: Invalid id for Vlan.
:raise NetworkAPIException: Failed to access the data source.
"""
parameters = dict(id_vlan=id_vlan, type_acl=type_acl)
data = dict(content_draft=content_draft)
uri = 'api/vlan/acl/save/draft/%(id_vlan)s/%(type_acl)s/' % parameters
return super(ApiVlan, self).post(uri, data=data) | python | def acl_save_draft(self, id_vlan, type_acl, content_draft):
"""
Save Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise InvalidIdVlanException: Invalid id for Vlan.
:raise NetworkAPIException: Failed to access the data source.
"""
parameters = dict(id_vlan=id_vlan, type_acl=type_acl)
data = dict(content_draft=content_draft)
uri = 'api/vlan/acl/save/draft/%(id_vlan)s/%(type_acl)s/' % parameters
return super(ApiVlan, self).post(uri, data=data) | [
"def",
"acl_save_draft",
"(",
"self",
",",
"id_vlan",
",",
"type_acl",
",",
"content_draft",
")",
":",
"parameters",
"=",
"dict",
"(",
"id_vlan",
"=",
"id_vlan",
",",
"type_acl",
"=",
"type_acl",
")",
"data",
"=",
"dict",
"(",
"content_draft",
"=",
"content_draft",
")",
"uri",
"=",
"'api/vlan/acl/save/draft/%(id_vlan)s/%(type_acl)s/'",
"%",
"parameters",
"return",
"super",
"(",
"ApiVlan",
",",
"self",
")",
".",
"post",
"(",
"uri",
",",
"data",
"=",
"data",
")"
] | Save Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise InvalidIdVlanException: Invalid id for Vlan.
:raise NetworkAPIException: Failed to access the data source. | [
"Save",
"Acl",
"draft",
"by",
"type"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVlan.py#L56-L76 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVlan.py | ApiVlan.search | def search(self, **kwargs):
"""
Method to search vlan's based on extends search.
:param search: Dict containing QuerySets to find vlan'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 vlan's
"""
return super(ApiVlan, self).get(self.prepare_url('api/v3/vlan/',
kwargs)) | python | def search(self, **kwargs):
"""
Method to search vlan's based on extends search.
:param search: Dict containing QuerySets to find vlan'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 vlan's
"""
return super(ApiVlan, self).get(self.prepare_url('api/v3/vlan/',
kwargs)) | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"ApiVlan",
",",
"self",
")",
".",
"get",
"(",
"self",
".",
"prepare_url",
"(",
"'api/v3/vlan/'",
",",
"kwargs",
")",
")"
] | Method to search vlan's based on extends search.
:param search: Dict containing QuerySets to find vlan'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 vlan's | [
"Method",
"to",
"search",
"vlan",
"s",
"based",
"on",
"extends",
"search",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVlan.py#L78-L91 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVlan.py | ApiVlan.delete | def delete(self, ids):
"""
Method to delete vlan's by their ids
:param ids: Identifiers of vlan's
:return: None
"""
url = build_uri_with_ids('api/v3/vlan/%s/', ids)
return super(ApiVlan, self).delete(url) | python | def delete(self, ids):
"""
Method to delete vlan's by their ids
:param ids: Identifiers of vlan's
:return: None
"""
url = build_uri_with_ids('api/v3/vlan/%s/', ids)
return super(ApiVlan, self).delete(url) | [
"def",
"delete",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/vlan/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiVlan",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to delete vlan's by their ids
:param ids: Identifiers of vlan's
:return: None | [
"Method",
"to",
"delete",
"vlan",
"s",
"by",
"their",
"ids"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVlan.py#L108-L117 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVlan.py | ApiVlan.update | def update(self, vlans):
"""
Method to update vlan's
:param vlans: List containing vlan's desired to updated
:return: None
"""
data = {'vlans': vlans}
vlans_ids = [str(vlan.get('id')) for vlan in vlans]
return super(ApiVlan, self).put('api/v3/vlan/%s/' %
';'.join(vlans_ids), data) | python | def update(self, vlans):
"""
Method to update vlan's
:param vlans: List containing vlan's desired to updated
:return: None
"""
data = {'vlans': vlans}
vlans_ids = [str(vlan.get('id')) for vlan in vlans]
return super(ApiVlan, self).put('api/v3/vlan/%s/' %
';'.join(vlans_ids), data) | [
"def",
"update",
"(",
"self",
",",
"vlans",
")",
":",
"data",
"=",
"{",
"'vlans'",
":",
"vlans",
"}",
"vlans_ids",
"=",
"[",
"str",
"(",
"vlan",
".",
"get",
"(",
"'id'",
")",
")",
"for",
"vlan",
"in",
"vlans",
"]",
"return",
"super",
"(",
"ApiVlan",
",",
"self",
")",
".",
"put",
"(",
"'api/v3/vlan/%s/'",
"%",
"';'",
".",
"join",
"(",
"vlans_ids",
")",
",",
"data",
")"
] | Method to update vlan's
:param vlans: List containing vlan's desired to updated
:return: None | [
"Method",
"to",
"update",
"vlan",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVlan.py#L119-L131 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVlan.py | ApiVlan.create | def create(self, vlans):
"""
Method to create vlan's
:param vlans: List containing vlan's desired to be created on database
:return: None
"""
data = {'vlans': vlans}
return super(ApiVlan, self).post('api/v3/vlan/', data) | python | def create(self, vlans):
"""
Method to create vlan's
:param vlans: List containing vlan's desired to be created on database
:return: None
"""
data = {'vlans': vlans}
return super(ApiVlan, self).post('api/v3/vlan/', data) | [
"def",
"create",
"(",
"self",
",",
"vlans",
")",
":",
"data",
"=",
"{",
"'vlans'",
":",
"vlans",
"}",
"return",
"super",
"(",
"ApiVlan",
",",
"self",
")",
".",
"post",
"(",
"'api/v3/vlan/'",
",",
"data",
")"
] | Method to create vlan's
:param vlans: List containing vlan's desired to be created on database
:return: None | [
"Method",
"to",
"create",
"vlan",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVlan.py#L133-L142 |
globocom/GloboNetworkAPI-client-python | networkapiclient/utils.py | is_valid_int_param | def is_valid_int_param(param):
"""Verifica se o parâmetro é um valor inteiro válido.
:param param: Valor para ser validado.
:return: True se o parâmetro tem um valor inteiro válido, ou False, caso contrário.
"""
if param is None:
return False
try:
param = int(param)
if param < 0:
return False
except (TypeError, ValueError):
return False
return True | python | def is_valid_int_param(param):
"""Verifica se o parâmetro é um valor inteiro válido.
:param param: Valor para ser validado.
:return: True se o parâmetro tem um valor inteiro válido, ou False, caso contrário.
"""
if param is None:
return False
try:
param = int(param)
if param < 0:
return False
except (TypeError, ValueError):
return False
return True | [
"def",
"is_valid_int_param",
"(",
"param",
")",
":",
"if",
"param",
"is",
"None",
":",
"return",
"False",
"try",
":",
"param",
"=",
"int",
"(",
"param",
")",
"if",
"param",
"<",
"0",
":",
"return",
"False",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"return",
"False",
"return",
"True"
] | Verifica se o parâmetro é um valor inteiro válido.
:param param: Valor para ser validado.
:return: True se o parâmetro tem um valor inteiro válido, ou False, caso contrário. | [
"Verifica",
"se",
"o",
"parâmetro",
"é",
"um",
"valor",
"inteiro",
"válido",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/utils.py#L21-L36 |
globocom/GloboNetworkAPI-client-python | networkapiclient/utils.py | is_valid_ip | def is_valid_ip(address):
"""Verifica se address é um endereço ip válido.
O valor é considerado válido se tiver no formato XXX.XXX.XXX.XXX, onde X é um valor entre 0 e 9.
:param address: Endereço IP.
:return: True se o parâmetro é um IP válido, ou False, caso contrário.
"""
if address is None:
return False
pattern = r'\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b'
return re.match(pattern, address) | python | def is_valid_ip(address):
"""Verifica se address é um endereço ip válido.
O valor é considerado válido se tiver no formato XXX.XXX.XXX.XXX, onde X é um valor entre 0 e 9.
:param address: Endereço IP.
:return: True se o parâmetro é um IP válido, ou False, caso contrário.
"""
if address is None:
return False
pattern = r'\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b'
return re.match(pattern, address) | [
"def",
"is_valid_ip",
"(",
"address",
")",
":",
"if",
"address",
"is",
"None",
":",
"return",
"False",
"pattern",
"=",
"r'\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b'",
"return",
"re",
".",
"match",
"(",
"pattern",
",",
"address",
")"
] | Verifica se address é um endereço ip válido.
O valor é considerado válido se tiver no formato XXX.XXX.XXX.XXX, onde X é um valor entre 0 e 9.
:param address: Endereço IP.
:return: True se o parâmetro é um IP válido, ou False, caso contrário. | [
"Verifica",
"se",
"address",
"é",
"um",
"endereço",
"ip",
"válido",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/utils.py#L39-L51 |
globocom/GloboNetworkAPI-client-python | networkapiclient/utils.py | is_valid_version_ip | def is_valid_version_ip(param):
"""Checks if the parameter is a valid ip version value.
:param param: Value to be validated.
:return: True if the parameter has a valid ip version value, or False otherwise.
"""
if param is None:
return False
if param == IP_VERSION.IPv4[0] or param == IP_VERSION.IPv6[0]:
return True
return False | python | def is_valid_version_ip(param):
"""Checks if the parameter is a valid ip version value.
:param param: Value to be validated.
:return: True if the parameter has a valid ip version value, or False otherwise.
"""
if param is None:
return False
if param == IP_VERSION.IPv4[0] or param == IP_VERSION.IPv6[0]:
return True
return False | [
"def",
"is_valid_version_ip",
"(",
"param",
")",
":",
"if",
"param",
"is",
"None",
":",
"return",
"False",
"if",
"param",
"==",
"IP_VERSION",
".",
"IPv4",
"[",
"0",
"]",
"or",
"param",
"==",
"IP_VERSION",
".",
"IPv6",
"[",
"0",
"]",
":",
"return",
"True",
"return",
"False"
] | Checks if the parameter is a valid ip version value.
:param param: Value to be validated.
:return: True if the parameter has a valid ip version value, or False otherwise. | [
"Checks",
"if",
"the",
"parameter",
"is",
"a",
"valid",
"ip",
"version",
"value",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/utils.py#L77-L90 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.option_vip_by_environmentvip | def option_vip_by_environmentvip(self, environment_vip_id):
"""
List Option Vip by Environment Vip
param environment_vip_id: Id of Environment Vip
"""
uri = 'api/v3/option-vip/environment-vip/%s/' % environment_vip_id
return super(ApiVipRequest, self).get(uri) | python | def option_vip_by_environmentvip(self, environment_vip_id):
"""
List Option Vip by Environment Vip
param environment_vip_id: Id of Environment Vip
"""
uri = 'api/v3/option-vip/environment-vip/%s/' % environment_vip_id
return super(ApiVipRequest, self).get(uri) | [
"def",
"option_vip_by_environmentvip",
"(",
"self",
",",
"environment_vip_id",
")",
":",
"uri",
"=",
"'api/v3/option-vip/environment-vip/%s/'",
"%",
"environment_vip_id",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | List Option Vip by Environment Vip
param environment_vip_id: Id of Environment Vip | [
"List",
"Option",
"Vip",
"by",
"Environment",
"Vip"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L51-L60 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.get_vip_request_details | def get_vip_request_details(self, vip_request_id):
"""
Method to get details of vip request
param vip_request_id: vip_request id
"""
uri = 'api/v3/vip-request/details/%s/' % vip_request_id
return super(ApiVipRequest, self).get(uri) | python | def get_vip_request_details(self, vip_request_id):
"""
Method to get details of vip request
param vip_request_id: vip_request id
"""
uri = 'api/v3/vip-request/details/%s/' % vip_request_id
return super(ApiVipRequest, self).get(uri) | [
"def",
"get_vip_request_details",
"(",
"self",
",",
"vip_request_id",
")",
":",
"uri",
"=",
"'api/v3/vip-request/details/%s/'",
"%",
"vip_request_id",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | Method to get details of vip request
param vip_request_id: vip_request id | [
"Method",
"to",
"get",
"details",
"of",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L62-L70 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.get_vip_request | def get_vip_request(self, vip_request_id):
"""
Method to get vip request
param vip_request_id: vip_request id
"""
uri = 'api/v3/vip-request/%s/' % vip_request_id
return super(ApiVipRequest, self).get(uri) | python | def get_vip_request(self, vip_request_id):
"""
Method to get vip request
param vip_request_id: vip_request id
"""
uri = 'api/v3/vip-request/%s/' % vip_request_id
return super(ApiVipRequest, self).get(uri) | [
"def",
"get_vip_request",
"(",
"self",
",",
"vip_request_id",
")",
":",
"uri",
"=",
"'api/v3/vip-request/%s/'",
"%",
"vip_request_id",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | Method to get vip request
param vip_request_id: vip_request id | [
"Method",
"to",
"get",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L83-L91 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.search_vip_request | def search_vip_request(self, search):
"""
Method to list vip request
param search: search
"""
uri = 'api/v3/vip-request/?%s' % urllib.urlencode({'search': search})
return super(ApiVipRequest, self).get(uri) | python | def search_vip_request(self, search):
"""
Method to list vip request
param search: search
"""
uri = 'api/v3/vip-request/?%s' % urllib.urlencode({'search': search})
return super(ApiVipRequest, self).get(uri) | [
"def",
"search_vip_request",
"(",
"self",
",",
"search",
")",
":",
"uri",
"=",
"'api/v3/vip-request/?%s'",
"%",
"urllib",
".",
"urlencode",
"(",
"{",
"'search'",
":",
"search",
"}",
")",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"get",
"(",
"uri",
")"
] | Method to list vip request
param search: search | [
"Method",
"to",
"list",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L93-L101 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.save_vip_request | def save_vip_request(self, vip_request):
"""
Method to save vip request
param vip_request: vip_request object
"""
uri = 'api/v3/vip-request/'
data = dict()
data['vips'] = list()
data['vips'].append(vip_request)
return super(ApiVipRequest, self).post(uri, data) | python | def save_vip_request(self, vip_request):
"""
Method to save vip request
param vip_request: vip_request object
"""
uri = 'api/v3/vip-request/'
data = dict()
data['vips'] = list()
data['vips'].append(vip_request)
return super(ApiVipRequest, self).post(uri, data) | [
"def",
"save_vip_request",
"(",
"self",
",",
"vip_request",
")",
":",
"uri",
"=",
"'api/v3/vip-request/'",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'vips'",
"]",
"=",
"list",
"(",
")",
"data",
"[",
"'vips'",
"]",
".",
"append",
"(",
"vip_request",
")",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"post",
"(",
"uri",
",",
"data",
")"
] | Method to save vip request
param vip_request: vip_request object | [
"Method",
"to",
"save",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L103-L115 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.update_vip_request | def update_vip_request(self, vip_request, vip_request_id):
"""
Method to update vip request
param vip_request: vip_request object
param vip_request_id: vip_request id
"""
uri = 'api/v3/vip-request/%s/' % vip_request_id
data = dict()
data['vips'] = list()
data['vips'].append(vip_request)
return super(ApiVipRequest, self).put(uri, data) | python | def update_vip_request(self, vip_request, vip_request_id):
"""
Method to update vip request
param vip_request: vip_request object
param vip_request_id: vip_request id
"""
uri = 'api/v3/vip-request/%s/' % vip_request_id
data = dict()
data['vips'] = list()
data['vips'].append(vip_request)
return super(ApiVipRequest, self).put(uri, data) | [
"def",
"update_vip_request",
"(",
"self",
",",
"vip_request",
",",
"vip_request_id",
")",
":",
"uri",
"=",
"'api/v3/vip-request/%s/'",
"%",
"vip_request_id",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'vips'",
"]",
"=",
"list",
"(",
")",
"data",
"[",
"'vips'",
"]",
".",
"append",
"(",
"vip_request",
")",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"put",
"(",
"uri",
",",
"data",
")"
] | Method to update vip request
param vip_request: vip_request object
param vip_request_id: vip_request id | [
"Method",
"to",
"update",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L117-L130 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.delete_vip_request | def delete_vip_request(self, vip_request_ids):
"""
Method to delete vip request
param vip_request_ids: vip_request ids
"""
uri = 'api/v3/vip-request/%s/' % vip_request_ids
return super(ApiVipRequest, self).delete(uri) | python | def delete_vip_request(self, vip_request_ids):
"""
Method to delete vip request
param vip_request_ids: vip_request ids
"""
uri = 'api/v3/vip-request/%s/' % vip_request_ids
return super(ApiVipRequest, self).delete(uri) | [
"def",
"delete_vip_request",
"(",
"self",
",",
"vip_request_ids",
")",
":",
"uri",
"=",
"'api/v3/vip-request/%s/'",
"%",
"vip_request_ids",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"delete",
"(",
"uri",
")"
] | Method to delete vip request
param vip_request_ids: vip_request ids | [
"Method",
"to",
"delete",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L132-L140 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.create_vip | def create_vip(self, vip_request_ids):
"""
Method to create vip request
param vip_request_ids: vip_request ids
"""
uri = 'api/v3/vip-request/deploy/%s/' % vip_request_ids
return super(ApiVipRequest, self).post(uri) | python | def create_vip(self, vip_request_ids):
"""
Method to create vip request
param vip_request_ids: vip_request ids
"""
uri = 'api/v3/vip-request/deploy/%s/' % vip_request_ids
return super(ApiVipRequest, self).post(uri) | [
"def",
"create_vip",
"(",
"self",
",",
"vip_request_ids",
")",
":",
"uri",
"=",
"'api/v3/vip-request/deploy/%s/'",
"%",
"vip_request_ids",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"post",
"(",
"uri",
")"
] | Method to create vip request
param vip_request_ids: vip_request ids | [
"Method",
"to",
"create",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L142-L150 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.remove_vip | def remove_vip(self, vip_request_ids):
"""
Method to delete vip request
param vip_request_ids: vip_request ids
"""
uri = 'api/v3/vip-request/deploy/%s/' % vip_request_ids
return super(ApiVipRequest, self).delete(uri) | python | def remove_vip(self, vip_request_ids):
"""
Method to delete vip request
param vip_request_ids: vip_request ids
"""
uri = 'api/v3/vip-request/deploy/%s/' % vip_request_ids
return super(ApiVipRequest, self).delete(uri) | [
"def",
"remove_vip",
"(",
"self",
",",
"vip_request_ids",
")",
":",
"uri",
"=",
"'api/v3/vip-request/deploy/%s/'",
"%",
"vip_request_ids",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"delete",
"(",
"uri",
")"
] | Method to delete vip request
param vip_request_ids: vip_request ids | [
"Method",
"to",
"delete",
"vip",
"request"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L167-L175 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.search | def search(self, **kwargs):
"""
Method to search vip's based on extends search.
:param search: Dict containing QuerySets to find vip'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 vip's
"""
return super(ApiVipRequest, self).get(self.prepare_url('api/v3/vip-request/',
kwargs)) | python | def search(self, **kwargs):
"""
Method to search vip's based on extends search.
:param search: Dict containing QuerySets to find vip'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 vip's
"""
return super(ApiVipRequest, self).get(self.prepare_url('api/v3/vip-request/',
kwargs)) | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"get",
"(",
"self",
".",
"prepare_url",
"(",
"'api/v3/vip-request/'",
",",
"kwargs",
")",
")"
] | Method to search vip's based on extends search.
:param search: Dict containing QuerySets to find vip'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 vip's | [
"Method",
"to",
"search",
"vip",
"s",
"based",
"on",
"extends",
"search",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L177-L190 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.delete | def delete(self, ids):
"""
Method to delete vip's by their id's
:param ids: Identifiers of vip's
:return: None
"""
url = build_uri_with_ids('api/v3/vip-request/%s/', ids)
return super(ApiVipRequest, self).delete(url) | python | def delete(self, ids):
"""
Method to delete vip's by their id's
:param ids: Identifiers of vip's
:return: None
"""
url = build_uri_with_ids('api/v3/vip-request/%s/', ids)
return super(ApiVipRequest, self).delete(url) | [
"def",
"delete",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/vip-request/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to delete vip's by their id's
:param ids: Identifiers of vip's
:return: None | [
"Method",
"to",
"delete",
"vip",
"s",
"by",
"their",
"id",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L207-L216 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.update | def update(self, vips):
"""
Method to update vip's
:param vips: List containing vip's desired to updated
:return: None
"""
data = {'vips': vips}
vips_ids = [str(vip.get('id')) for vip in vips]
return super(ApiVipRequest, self).put('api/v3/vip-request/%s/' %
';'.join(vips_ids), data) | python | def update(self, vips):
"""
Method to update vip's
:param vips: List containing vip's desired to updated
:return: None
"""
data = {'vips': vips}
vips_ids = [str(vip.get('id')) for vip in vips]
return super(ApiVipRequest, self).put('api/v3/vip-request/%s/' %
';'.join(vips_ids), data) | [
"def",
"update",
"(",
"self",
",",
"vips",
")",
":",
"data",
"=",
"{",
"'vips'",
":",
"vips",
"}",
"vips_ids",
"=",
"[",
"str",
"(",
"vip",
".",
"get",
"(",
"'id'",
")",
")",
"for",
"vip",
"in",
"vips",
"]",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"put",
"(",
"'api/v3/vip-request/%s/'",
"%",
"';'",
".",
"join",
"(",
"vips_ids",
")",
",",
"data",
")"
] | Method to update vip's
:param vips: List containing vip's desired to updated
:return: None | [
"Method",
"to",
"update",
"vip",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L218-L230 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.create | def create(self, vips):
"""
Method to create vip's
:param vips: List containing vip's desired to be created on database
:return: None
"""
data = {'vips': vips}
return super(ApiVipRequest, self).post('api/v3/vip-request/', data) | python | def create(self, vips):
"""
Method to create vip's
:param vips: List containing vip's desired to be created on database
:return: None
"""
data = {'vips': vips}
return super(ApiVipRequest, self).post('api/v3/vip-request/', data) | [
"def",
"create",
"(",
"self",
",",
"vips",
")",
":",
"data",
"=",
"{",
"'vips'",
":",
"vips",
"}",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"post",
"(",
"'api/v3/vip-request/'",
",",
"data",
")"
] | Method to create vip's
:param vips: List containing vip's desired to be created on database
:return: None | [
"Method",
"to",
"create",
"vip",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L232-L241 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.deploy | def deploy(self, ids):
"""
Method to deploy vip's
:param vips: List containing vip's desired to be deployed on equipment
:return: None
"""
url = build_uri_with_ids('api/v3/vip-request/deploy/%s/', ids)
return super(ApiVipRequest, self).post(url) | python | def deploy(self, ids):
"""
Method to deploy vip's
:param vips: List containing vip's desired to be deployed on equipment
:return: None
"""
url = build_uri_with_ids('api/v3/vip-request/deploy/%s/', ids)
return super(ApiVipRequest, self).post(url) | [
"def",
"deploy",
"(",
"self",
",",
"ids",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/vip-request/deploy/%s/'",
",",
"ids",
")",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"post",
"(",
"url",
")"
] | Method to deploy vip's
:param vips: List containing vip's desired to be deployed on equipment
:return: None | [
"Method",
"to",
"deploy",
"vip",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L243-L252 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ApiVipRequest.py | ApiVipRequest.undeploy | def undeploy(self, ids, clean_up=0):
"""
Method to undeploy vip's
:param vips: List containing vip's desired to be undeployed on equipment
:return: None
"""
url = build_uri_with_ids('api/v3/vip-request/deploy/%s/?cleanup=%s', ids, clean_up)
return super(ApiVipRequest, self).delete(url) | python | def undeploy(self, ids, clean_up=0):
"""
Method to undeploy vip's
:param vips: List containing vip's desired to be undeployed on equipment
:return: None
"""
url = build_uri_with_ids('api/v3/vip-request/deploy/%s/?cleanup=%s', ids, clean_up)
return super(ApiVipRequest, self).delete(url) | [
"def",
"undeploy",
"(",
"self",
",",
"ids",
",",
"clean_up",
"=",
"0",
")",
":",
"url",
"=",
"build_uri_with_ids",
"(",
"'api/v3/vip-request/deploy/%s/?cleanup=%s'",
",",
"ids",
",",
"clean_up",
")",
"return",
"super",
"(",
"ApiVipRequest",
",",
"self",
")",
".",
"delete",
"(",
"url",
")"
] | Method to undeploy vip's
:param vips: List containing vip's desired to be undeployed on equipment
:return: None | [
"Method",
"to",
"undeploy",
"vip",
"s"
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiVipRequest.py#L254-L263 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.add | def add(self, tipo_opcao, nome_opcao):
"""Inserts a new Option Pool 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:
::
{'id': < id > , 'type':<type>, 'name':<name>}
: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.
"""
#optionpool_map = dict()
#optionpool_map['type'] = tipo_opcao
#optionpool_map['name'] = nome_opcao
url='api/pools/options/save/'
return self.post(url, {'type': tipo_opcao, "name":nome_opcao }) | python | def add(self, tipo_opcao, nome_opcao):
"""Inserts a new Option Pool 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:
::
{'id': < id > , 'type':<type>, 'name':<name>}
: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.
"""
#optionpool_map = dict()
#optionpool_map['type'] = tipo_opcao
#optionpool_map['name'] = nome_opcao
url='api/pools/options/save/'
return self.post(url, {'type': tipo_opcao, "name":nome_opcao }) | [
"def",
"add",
"(",
"self",
",",
"tipo_opcao",
",",
"nome_opcao",
")",
":",
"#optionpool_map = dict()",
"#optionpool_map['type'] = tipo_opcao",
"#optionpool_map['name'] = nome_opcao",
"url",
"=",
"'api/pools/options/save/'",
"return",
"self",
".",
"post",
"(",
"url",
",",
"{",
"'type'",
":",
"tipo_opcao",
",",
"\"name\"",
":",
"nome_opcao",
"}",
")"
] | Inserts a new Option Pool 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:
::
{'id': < id > , 'type':<type>, 'name':<name>}
: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",
"Pool",
"and",
"returns",
"its",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L40-L62 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.modify | def modify(self, id_option_pool, tipo_opcao, nome_opcao):
"""Change Option Pool from by id.
:param id_option_pool: Identifier of the Option Pool. 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 Pool identifier is null or invalid.
:raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid.
:raise optionpoolNotFoundError: Option pool 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_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
#optionpool_map = dict()
#optionpool_map['type'] = tipo_opcao
#optionpool_map['name'] = nome_opcao_txt
url = 'api/pools/options/' + str(id_option_pool) + '/'
return self.put(url,{'type': tipo_opcao, "name":nome_opcao } ) | python | def modify(self, id_option_pool, tipo_opcao, nome_opcao):
"""Change Option Pool from by id.
:param id_option_pool: Identifier of the Option Pool. 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 Pool identifier is null or invalid.
:raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid.
:raise optionpoolNotFoundError: Option pool 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_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
#optionpool_map = dict()
#optionpool_map['type'] = tipo_opcao
#optionpool_map['name'] = nome_opcao_txt
url = 'api/pools/options/' + str(id_option_pool) + '/'
return self.put(url,{'type': tipo_opcao, "name":nome_opcao } ) | [
"def",
"modify",
"(",
"self",
",",
"id_option_pool",
",",
"tipo_opcao",
",",
"nome_opcao",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_option_pool",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Option Pool is invalid or was not informed.'",
")",
"#optionpool_map = dict()",
"#optionpool_map['type'] = tipo_opcao",
"#optionpool_map['name'] = nome_opcao_txt",
"url",
"=",
"'api/pools/options/'",
"+",
"str",
"(",
"id_option_pool",
")",
"+",
"'/'",
"return",
"self",
".",
"put",
"(",
"url",
",",
"{",
"'type'",
":",
"tipo_opcao",
",",
"\"name\"",
":",
"nome_opcao",
"}",
")"
] | Change Option Pool from by id.
:param id_option_pool: Identifier of the Option Pool. 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 Pool identifier is null or invalid.
:raise InvalidParameterError: The value of tipo_opcao or nome_opcao_txt is invalid.
:raise optionpoolNotFoundError: Option pool not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Change",
"Option",
"Pool",
"from",
"by",
"id",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L65-L91 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.remove | def remove(self, id_option_pool):
"""Remove Option pool by identifier and all Environment related .
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Option Pool identifier is null and invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise optionpoolError: Option Pool associated with Pool.
: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_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
url = 'api/pools/options/' + str(id_option_pool) + '/'
return self.delete(url) | python | def remove(self, id_option_pool):
"""Remove Option pool by identifier and all Environment related .
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Option Pool identifier is null and invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise optionpoolError: Option Pool associated with Pool.
: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_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
url = 'api/pools/options/' + str(id_option_pool) + '/'
return self.delete(url) | [
"def",
"remove",
"(",
"self",
",",
"id_option_pool",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_option_pool",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Option Pool is invalid or was not informed.'",
")",
"url",
"=",
"'api/pools/options/'",
"+",
"str",
"(",
"id_option_pool",
")",
"+",
"'/'",
"return",
"self",
".",
"delete",
"(",
"url",
")"
] | Remove Option pool by identifier and all Environment related .
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Option Pool identifier is null and invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise optionpoolError: Option Pool associated with Pool.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Option",
"pool",
"by",
"identifier",
"and",
"all",
"Environment",
"related",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L93-L113 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.get_option_pool | def get_option_pool(self, id_option_pool):
"""Search Option Pool by id.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: Following dictionary:
::
{‘id’: < id_option_pool >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}
:raise InvalidParameterError: Option Pool identifier is null and invalid.
:raise optionpoolNotFoundError: Option Pool 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_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
url = 'api/pools/options/' + str(id_option_pool) + '/'
return self.get(url) | python | def get_option_pool(self, id_option_pool):
"""Search Option Pool by id.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: Following dictionary:
::
{‘id’: < id_option_pool >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}
:raise InvalidParameterError: Option Pool identifier is null and invalid.
:raise optionpoolNotFoundError: Option Pool 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_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
url = 'api/pools/options/' + str(id_option_pool) + '/'
return self.get(url) | [
"def",
"get_option_pool",
"(",
"self",
",",
"id_option_pool",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_option_pool",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Option Pool is invalid or was not informed.'",
")",
"url",
"=",
"'api/pools/options/'",
"+",
"str",
"(",
"id_option_pool",
")",
"+",
"'/'",
"return",
"self",
".",
"get",
"(",
"url",
")"
] | Search Option Pool by id.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: Following dictionary:
::
{‘id’: < id_option_pool >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}
:raise InvalidParameterError: Option Pool identifier is null and invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Search",
"Option",
"Pool",
"by",
"id",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L115-L140 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.get_all_option_pool | def get_all_option_pool(self, option_type=None):
"""Get all Option Pool.
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}, ... other option pool ...] }
:raise optionpoolNotFoundError: Option Pool not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
if option_type:
url = 'api/pools/options/?type='+option_type
else:
url = 'api/pools/options/'
return self.get(url) | python | def get_all_option_pool(self, option_type=None):
"""Get all Option Pool.
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}, ... other option pool ...] }
:raise optionpoolNotFoundError: Option Pool not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
if option_type:
url = 'api/pools/options/?type='+option_type
else:
url = 'api/pools/options/'
return self.get(url) | [
"def",
"get_all_option_pool",
"(",
"self",
",",
"option_type",
"=",
"None",
")",
":",
"if",
"option_type",
":",
"url",
"=",
"'api/pools/options/?type='",
"+",
"option_type",
"else",
":",
"url",
"=",
"'api/pools/options/'",
"return",
"self",
".",
"get",
"(",
"url",
")"
] | Get all Option Pool.
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}, ... other option pool ...] }
:raise optionpoolNotFoundError: Option Pool not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response. | [
"Get",
"all",
"Option",
"Pool",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L142-L163 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.get_all_environment_option_pool | def get_all_environment_option_pool(self, id_environment=None, option_id=None, option_type=None):
"""Get all Option VIP by Environment .
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
etc to option pools ...] }
:raise EnvironmentVipNotFoundError: Environment Pool not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
url='api/pools/environment_options/'
if id_environment:
if option_id:
if option_type:
url = url + "?environment_id=" + str(id_environment)+ "&option_id=" + str(option_id) + "&option_type=" + option_type
else:
url = url + "?environment_id=" + str(id_environment)+ "&option_id=" + str(option_id)
else:
if option_type:
url = url + "?environment_id=" + str(id_environment) + "&option_type=" + option_type
else:
url = url + "?environment_id=" + str(id_environment)
elif option_id:
if option_type:
url = url + "?option_id=" + str(option_id) + "&option_type=" + option_type
else:
url = url + "?option_id=" + str(option_id)
elif option_type:
url = url + "?option_type=" + option_type
return self.get(url) | python | def get_all_environment_option_pool(self, id_environment=None, option_id=None, option_type=None):
"""Get all Option VIP by Environment .
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
etc to option pools ...] }
:raise EnvironmentVipNotFoundError: Environment Pool not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response.
"""
url='api/pools/environment_options/'
if id_environment:
if option_id:
if option_type:
url = url + "?environment_id=" + str(id_environment)+ "&option_id=" + str(option_id) + "&option_type=" + option_type
else:
url = url + "?environment_id=" + str(id_environment)+ "&option_id=" + str(option_id)
else:
if option_type:
url = url + "?environment_id=" + str(id_environment) + "&option_type=" + option_type
else:
url = url + "?environment_id=" + str(id_environment)
elif option_id:
if option_type:
url = url + "?option_id=" + str(option_id) + "&option_type=" + option_type
else:
url = url + "?option_id=" + str(option_id)
elif option_type:
url = url + "?option_type=" + option_type
return self.get(url) | [
"def",
"get_all_environment_option_pool",
"(",
"self",
",",
"id_environment",
"=",
"None",
",",
"option_id",
"=",
"None",
",",
"option_type",
"=",
"None",
")",
":",
"url",
"=",
"'api/pools/environment_options/'",
"if",
"id_environment",
":",
"if",
"option_id",
":",
"if",
"option_type",
":",
"url",
"=",
"url",
"+",
"\"?environment_id=\"",
"+",
"str",
"(",
"id_environment",
")",
"+",
"\"&option_id=\"",
"+",
"str",
"(",
"option_id",
")",
"+",
"\"&option_type=\"",
"+",
"option_type",
"else",
":",
"url",
"=",
"url",
"+",
"\"?environment_id=\"",
"+",
"str",
"(",
"id_environment",
")",
"+",
"\"&option_id=\"",
"+",
"str",
"(",
"option_id",
")",
"else",
":",
"if",
"option_type",
":",
"url",
"=",
"url",
"+",
"\"?environment_id=\"",
"+",
"str",
"(",
"id_environment",
")",
"+",
"\"&option_type=\"",
"+",
"option_type",
"else",
":",
"url",
"=",
"url",
"+",
"\"?environment_id=\"",
"+",
"str",
"(",
"id_environment",
")",
"elif",
"option_id",
":",
"if",
"option_type",
":",
"url",
"=",
"url",
"+",
"\"?option_id=\"",
"+",
"str",
"(",
"option_id",
")",
"+",
"\"&option_type=\"",
"+",
"option_type",
"else",
":",
"url",
"=",
"url",
"+",
"\"?option_id=\"",
"+",
"str",
"(",
"option_id",
")",
"elif",
"option_type",
":",
"url",
"=",
"url",
"+",
"\"?option_type=\"",
"+",
"option_type",
"return",
"self",
".",
"get",
"(",
"url",
")"
] | Get all Option VIP by Environment .
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
etc to option pools ...] }
:raise EnvironmentVipNotFoundError: Environment Pool not registered.
:raise DataBaseError: Can't connect to networkapi database.
:raise XMLError: Failed to generate the XML response. | [
"Get",
"all",
"Option",
"VIP",
"by",
"Environment",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L165-L208 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.associate_environment_option_pool | def associate_environment_option_pool(self, id_option_pool, id_environment):
"""Create a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment . Integer value and greater than zero.
:return: Dictionary with the following structure:
{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
}
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment Pool not registered.
:raise optionpoolError: Option Pool is already associated with the environment pool.
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_option_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
if not is_valid_int_param(id_environment):
raise InvalidParameterError(
u'The identifier of Environment Pool is invalid or was not informed.')
url= 'api/pools/environment_options/save/'
return self.post(url, {'option_id': id_option_pool,"environment_id":id_environment }) | python | def associate_environment_option_pool(self, id_option_pool, id_environment):
"""Create a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment . Integer value and greater than zero.
:return: Dictionary with the following structure:
{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
}
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment Pool not registered.
:raise optionpoolError: Option Pool is already associated with the environment pool.
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_option_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
if not is_valid_int_param(id_environment):
raise InvalidParameterError(
u'The identifier of Environment Pool is invalid or was not informed.')
url= 'api/pools/environment_options/save/'
return self.post(url, {'option_id': id_option_pool,"environment_id":id_environment }) | [
"def",
"associate_environment_option_pool",
"(",
"self",
",",
"id_option_pool",
",",
"id_environment",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_option_pool",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Option Pool is invalid or was not informed.'",
")",
"if",
"not",
"is_valid_int_param",
"(",
"id_environment",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Environment Pool is invalid or was not informed.'",
")",
"url",
"=",
"'api/pools/environment_options/save/'",
"return",
"self",
".",
"post",
"(",
"url",
",",
"{",
"'option_id'",
":",
"id_option_pool",
",",
"\"environment_id\"",
":",
"id_environment",
"}",
")"
] | Create a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment . Integer value and greater than zero.
:return: Dictionary with the following structure:
{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
}
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment Pool not registered.
:raise optionpoolError: Option Pool is already associated with the environment pool.
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Create",
"a",
"relationship",
"of",
"optionpool",
"with",
"Environment",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L211-L250 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.disassociate_environment_option_pool | def disassociate_environment_option_pool(self, environment_option_id):
"""Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: { 'id': < environment_option_id> }
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Environment Pool is invalid or was not informed.')
url = 'api/pools/environment_options/' + str(environment_option_id) + '/'
return self.delete(url) | python | def disassociate_environment_option_pool(self, environment_option_id):
"""Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: { 'id': < environment_option_id> }
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Environment Pool is invalid or was not informed.')
url = 'api/pools/environment_options/' + str(environment_option_id) + '/'
return self.delete(url) | [
"def",
"disassociate_environment_option_pool",
"(",
"self",
",",
"environment_option_id",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"environment_option_id",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Option Pool is invalid or was not informed.'",
")",
"if",
"not",
"is_valid_int_param",
"(",
"environment_option_id",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Environment Pool is invalid or was not informed.'",
")",
"url",
"=",
"'api/pools/environment_options/'",
"+",
"str",
"(",
"environment_option_id",
")",
"+",
"'/'",
"return",
"self",
".",
"delete",
"(",
"url",
")"
] | Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: { 'id': < environment_option_id> }
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"a",
"relationship",
"of",
"optionpool",
"with",
"Environment",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L279-L306 |
globocom/GloboNetworkAPI-client-python | networkapiclient/OptionPool.py | OptionPool.modify_environment_option_pool | def modify_environment_option_pool(self, environment_option_id, id_option_pool,id_environment ):
"""Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
}
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Environment Option Pool is invalid or was not informed.')
#optionpool_map = dict()
#optionpool_map['option'] = option_id
#optionpool_map['environment'] = environment_id
url = 'api/pools/environment_options/' + str(environment_option_id) + '/'
return self.put(url, {'option_id': id_option_pool,"environment_id":id_environment }) | python | def modify_environment_option_pool(self, environment_option_id, id_option_pool,id_environment ):
"""Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
}
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Environment Option Pool is invalid or was not informed.')
#optionpool_map = dict()
#optionpool_map['option'] = option_id
#optionpool_map['environment'] = environment_id
url = 'api/pools/environment_options/' + str(environment_option_id) + '/'
return self.put(url, {'option_id': id_option_pool,"environment_id":id_environment }) | [
"def",
"modify_environment_option_pool",
"(",
"self",
",",
"environment_option_id",
",",
"id_option_pool",
",",
"id_environment",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"environment_option_id",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Environment Option Pool is invalid or was not informed.'",
")",
"#optionpool_map = dict()",
"#optionpool_map['option'] = option_id",
"#optionpool_map['environment'] = environment_id",
"url",
"=",
"'api/pools/environment_options/'",
"+",
"str",
"(",
"environment_option_id",
")",
"+",
"'/'",
"return",
"self",
".",
"put",
"(",
"url",
",",
"{",
"'option_id'",
":",
"id_option_pool",
",",
"\"environment_id\"",
":",
"id_environment",
"}",
")"
] | Remove a relationship of optionpool with Environment.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param id_environment: Identifier of the Environment Pool. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{‘id’: < id >,
option: {
'id': <id>
'type':<type>
'name':<name> }
environment: {
'id':<id>
.... all environment info }
}
:raise InvalidParameterError: Option Pool/Environment Pool identifier is null and/or invalid.
:raise optionpoolNotFoundError: Option Pool not registered.
:raise EnvironmentVipNotFoundError: Environment VIP not registered.
:raise optionpoolError: Option pool is not associated with the environment pool
:raise UserNotAuthorizedError: User does not have authorization to make this association.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"a",
"relationship",
"of",
"optionpool",
"with",
"Environment",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/OptionPool.py#L309-L349 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Filter.py | Filter.add | def add(self, name, description):
"""Inserts a new Filter and returns its identifier.
:param name: Name. String with a maximum of 100 characters and respect [a-zA-Z\_-]
:param description: Description. String with a maximum of 200 characters and respect [a-zA-Z\_-]
:return: Following dictionary:
::
{'filter': {'id': < id >}}
:raise InvalidParameterError: The value of name or description is invalid.
:raise FilterDuplicateError: A filter named by name already exists.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
filter_map = dict()
filter_map['name'] = name
filter_map['description'] = description
code, xml = self.submit({'filter': filter_map}, 'POST', 'filter/')
return self.response(code, xml) | python | def add(self, name, description):
"""Inserts a new Filter and returns its identifier.
:param name: Name. String with a maximum of 100 characters and respect [a-zA-Z\_-]
:param description: Description. String with a maximum of 200 characters and respect [a-zA-Z\_-]
:return: Following dictionary:
::
{'filter': {'id': < id >}}
:raise InvalidParameterError: The value of name or description is invalid.
:raise FilterDuplicateError: A filter named by name already exists.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
filter_map = dict()
filter_map['name'] = name
filter_map['description'] = description
code, xml = self.submit({'filter': filter_map}, 'POST', 'filter/')
return self.response(code, xml) | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"description",
")",
":",
"filter_map",
"=",
"dict",
"(",
")",
"filter_map",
"[",
"'name'",
"]",
"=",
"name",
"filter_map",
"[",
"'description'",
"]",
"=",
"description",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'filter'",
":",
"filter_map",
"}",
",",
"'POST'",
",",
"'filter/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Inserts a new Filter and returns its identifier.
:param name: Name. String with a maximum of 100 characters and respect [a-zA-Z\_-]
:param description: Description. String with a maximum of 200 characters and respect [a-zA-Z\_-]
:return: Following dictionary:
::
{'filter': {'id': < id >}}
:raise InvalidParameterError: The value of name or description is invalid.
:raise FilterDuplicateError: A filter named by name already exists.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Inserts",
"a",
"new",
"Filter",
"and",
"returns",
"its",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Filter.py#L59-L82 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Filter.py | Filter.alter | def alter(self, id_filter, name, description):
"""Change Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:param name: Name. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:param description: Description. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:return: None
:raise InvalidParameterError: Filter identifier is null and invalid.
:raise InvalidParameterError: The value of name or description is invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
filter_map = dict()
filter_map['name'] = name
filter_map['description'] = description
url = 'filter/' + str(id_filter) + '/'
code, xml = self.submit({'filter': filter_map}, 'PUT', url)
return self.response(code, xml) | python | def alter(self, id_filter, name, description):
"""Change Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:param name: Name. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:param description: Description. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:return: None
:raise InvalidParameterError: Filter identifier is null and invalid.
:raise InvalidParameterError: The value of name or description is invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
filter_map = dict()
filter_map['name'] = name
filter_map['description'] = description
url = 'filter/' + str(id_filter) + '/'
code, xml = self.submit({'filter': filter_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"alter",
"(",
"self",
",",
"id_filter",
",",
"name",
",",
"description",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_filter",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Filter is invalid or was not informed.'",
")",
"filter_map",
"=",
"dict",
"(",
")",
"filter_map",
"[",
"'name'",
"]",
"=",
"name",
"filter_map",
"[",
"'description'",
"]",
"=",
"description",
"url",
"=",
"'filter/'",
"+",
"str",
"(",
"id_filter",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'filter'",
":",
"filter_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Change Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:param name: Name. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:param description: Description. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:return: None
:raise InvalidParameterError: Filter identifier is null and invalid.
:raise InvalidParameterError: The value of name or description is invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Change",
"Filter",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Filter.py#L84-L112 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Filter.py | Filter.remove | def remove(self, id_filter):
"""Remove Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Filter identifier is null and invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
url = 'filter/' + str(id_filter) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def remove(self, id_filter):
"""Remove Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Filter identifier is null and invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
url = 'filter/' + str(id_filter) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"remove",
"(",
"self",
",",
"id_filter",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_filter",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Filter is invalid or was not informed.'",
")",
"url",
"=",
"'filter/'",
"+",
"str",
"(",
"id_filter",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Filter identifier is null and invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Filter",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Filter.py#L114-L135 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Filter.py | Filter.get | def get(self, id_filter):
"""Get filter by id.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{‘filter’: {‘id’: < id >,
‘name’: < name >,
‘description’: < description >}}
:raise InvalidParameterError: The value of id_filter is invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
url = 'filter/get/' + str(id_filter) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def get(self, id_filter):
"""Get filter by id.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{‘filter’: {‘id’: < id >,
‘name’: < name >,
‘description’: < description >}}
:raise InvalidParameterError: The value of id_filter is invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
url = 'filter/get/' + str(id_filter) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"get",
"(",
"self",
",",
"id_filter",
")",
":",
"url",
"=",
"'filter/get/'",
"+",
"str",
"(",
"id_filter",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Get filter by id.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{‘filter’: {‘id’: < id >,
‘name’: < name >,
‘description’: < description >}}
:raise InvalidParameterError: The value of id_filter is invalid.
:raise FilterNotFoundError: Filter not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Get",
"filter",
"by",
"id",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Filter.py#L137-L159 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Filter.py | Filter.associate | def associate(self, et_id, id_filter):
"""Create a relationship between Filter and TipoEquipamento.
:param et_id: Identifier of TipoEquipamento. Integer value and greater than zero.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{'equiptype_filter_xref': {'id': < id_equiptype_filter_xref >} }
:raise InvalidParameterError: TipoEquipamento/Filter identifier is null and/or invalid.
:raise TipoEquipamentoNaoExisteError: TipoEquipamento not registered.
:raise FilterNotFoundError: Filter not registered.
:raise FilterEqTypeAssociationError: TipoEquipamento and Filter already associated.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(et_id):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
url = 'filter/' + str(id_filter) + '/equiptype/' + str(et_id) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml) | python | def associate(self, et_id, id_filter):
"""Create a relationship between Filter and TipoEquipamento.
:param et_id: Identifier of TipoEquipamento. Integer value and greater than zero.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{'equiptype_filter_xref': {'id': < id_equiptype_filter_xref >} }
:raise InvalidParameterError: TipoEquipamento/Filter identifier is null and/or invalid.
:raise TipoEquipamentoNaoExisteError: TipoEquipamento not registered.
:raise FilterNotFoundError: Filter not registered.
:raise FilterEqTypeAssociationError: TipoEquipamento and Filter already associated.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(et_id):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
url = 'filter/' + str(id_filter) + '/equiptype/' + str(et_id) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml) | [
"def",
"associate",
"(",
"self",
",",
"et_id",
",",
"id_filter",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"et_id",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of TipoEquipamento is invalid or was not informed.'",
")",
"if",
"not",
"is_valid_int_param",
"(",
"id_filter",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Filter is invalid or was not informed.'",
")",
"url",
"=",
"'filter/'",
"+",
"str",
"(",
"id_filter",
")",
"+",
"'/equiptype/'",
"+",
"str",
"(",
"et_id",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Create a relationship between Filter and TipoEquipamento.
:param et_id: Identifier of TipoEquipamento. Integer value and greater than zero.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{'equiptype_filter_xref': {'id': < id_equiptype_filter_xref >} }
:raise InvalidParameterError: TipoEquipamento/Filter identifier is null and/or invalid.
:raise TipoEquipamentoNaoExisteError: TipoEquipamento not registered.
:raise FilterNotFoundError: Filter not registered.
:raise FilterEqTypeAssociationError: TipoEquipamento and Filter already associated.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Create",
"a",
"relationship",
"between",
"Filter",
"and",
"TipoEquipamento",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Filter.py#L161-L193 |
globocom/GloboNetworkAPI-client-python | networkapiclient/Filter.py | Filter.dissociate | def dissociate(self, id_filter, id_eq_type):
"""Removes relationship between Filter and TipoEquipamento.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:param id_eq_type: Identifier of TipoEquipamento. Integer value, greater than zero.
:return: None
:raise FilterNotFoundError: Filter not registered.
:raise TipoEquipamentoNotFoundError: TipoEquipamento not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
if not is_valid_int_param(id_eq_type):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
url = 'filter/' + \
str(id_filter) + '/dissociate/' + str(id_eq_type) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml) | python | def dissociate(self, id_filter, id_eq_type):
"""Removes relationship between Filter and TipoEquipamento.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:param id_eq_type: Identifier of TipoEquipamento. Integer value, greater than zero.
:return: None
:raise FilterNotFoundError: Filter not registered.
:raise TipoEquipamentoNotFoundError: TipoEquipamento not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
if not is_valid_int_param(id_eq_type):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
url = 'filter/' + \
str(id_filter) + '/dissociate/' + str(id_eq_type) + '/'
code, xml = self.submit(None, 'PUT', url)
return self.response(code, xml) | [
"def",
"dissociate",
"(",
"self",
",",
"id_filter",
",",
"id_eq_type",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_filter",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Filter is invalid or was not informed.'",
")",
"if",
"not",
"is_valid_int_param",
"(",
"id_eq_type",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of TipoEquipamento is invalid or was not informed.'",
")",
"url",
"=",
"'filter/'",
"+",
"str",
"(",
"id_filter",
")",
"+",
"'/dissociate/'",
"+",
"str",
"(",
"id_eq_type",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Removes relationship between Filter and TipoEquipamento.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:param id_eq_type: Identifier of TipoEquipamento. Integer value, greater than zero.
:return: None
:raise FilterNotFoundError: Filter not registered.
:raise TipoEquipamentoNotFoundError: TipoEquipamento not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Removes",
"relationship",
"between",
"Filter",
"and",
"TipoEquipamento",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Filter.py#L195-L222 |
globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoEquipamento.py | GrupoEquipamento.search | def search(self, id_egroup):
"""Search Group Equipament from by the identifier.
:param id_egroup: Identifier of the Group Equipament. Integer value and greater than zero.
:return: Following dictionary:
::
{‘group_equipament’: {‘id’: < id_egrupo >,
‘nome’: < nome >} }
:raise InvalidParameterError: Group Equipament identifier is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipament 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_egroup):
raise InvalidParameterError(
u'The identifier of Group Equipament is invalid or was not informed.')
url = 'egroup/' + str(id_egroup) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def search(self, id_egroup):
"""Search Group Equipament from by the identifier.
:param id_egroup: Identifier of the Group Equipament. Integer value and greater than zero.
:return: Following dictionary:
::
{‘group_equipament’: {‘id’: < id_egrupo >,
‘nome’: < nome >} }
:raise InvalidParameterError: Group Equipament identifier is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipament 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_egroup):
raise InvalidParameterError(
u'The identifier of Group Equipament is invalid or was not informed.')
url = 'egroup/' + str(id_egroup) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"search",
"(",
"self",
",",
"id_egroup",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_egroup",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Group Equipament is invalid or was not informed.'",
")",
"url",
"=",
"'egroup/'",
"+",
"str",
"(",
"id_egroup",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Search Group Equipament from by the identifier.
:param id_egroup: Identifier of the Group Equipament. Integer value and greater than zero.
:return: Following dictionary:
::
{‘group_equipament’: {‘id’: < id_egrupo >,
‘nome’: < nome >} }
:raise InvalidParameterError: Group Equipament identifier is null and invalid.
:raise GrupoEquipamentoNaoExisteError: Group Equipament not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Search",
"Group",
"Equipament",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoEquipamento.py#L38-L64 |
globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoEquipamento.py | GrupoEquipamento.inserir | def inserir(self, nome):
"""Insere um novo grupo de equipamento e retorna o seu identificador.
:param nome: Nome do grupo de equipamento.
:return: Dicionário com a seguinte estrutura: {'grupo': {'id': < id >}}
:raise InvalidParameterError: Nome do grupo é nulo ou vazio.
:raise NomeGrupoEquipamentoDuplicadoError: Nome do grupo de equipmaneto duplicado.
: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.
"""
egrupo_map = dict()
egrupo_map['nome'] = nome
code, xml = self.submit({'grupo': egrupo_map}, 'POST', 'egrupo/')
return self.response(code, xml) | python | def inserir(self, nome):
"""Insere um novo grupo de equipamento e retorna o seu identificador.
:param nome: Nome do grupo de equipamento.
:return: Dicionário com a seguinte estrutura: {'grupo': {'id': < id >}}
:raise InvalidParameterError: Nome do grupo é nulo ou vazio.
:raise NomeGrupoEquipamentoDuplicadoError: Nome do grupo de equipmaneto duplicado.
: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.
"""
egrupo_map = dict()
egrupo_map['nome'] = nome
code, xml = self.submit({'grupo': egrupo_map}, 'POST', 'egrupo/')
return self.response(code, xml) | [
"def",
"inserir",
"(",
"self",
",",
"nome",
")",
":",
"egrupo_map",
"=",
"dict",
"(",
")",
"egrupo_map",
"[",
"'nome'",
"]",
"=",
"nome",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'grupo'",
":",
"egrupo_map",
"}",
",",
"'POST'",
",",
"'egrupo/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Insere um novo grupo de equipamento e retorna o seu identificador.
:param nome: Nome do grupo de equipamento.
:return: Dicionário com a seguinte estrutura: {'grupo': {'id': < id >}}
:raise InvalidParameterError: Nome do grupo é nulo ou vazio.
:raise NomeGrupoEquipamentoDuplicadoError: Nome do grupo de equipmaneto duplicado.
: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. | [
"Insere",
"um",
"novo",
"grupo",
"de",
"equipamento",
"e",
"retorna",
"o",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoEquipamento.py#L111-L128 |
globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoEquipamento.py | GrupoEquipamento.alterar | def alterar(self, id_egrupo, nome):
"""Altera os dados de um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param nome: Nome do grupo de equipamento.
:return: None
:raise InvalidParameterError: O identificador e/ou o nome do grupo são nulos ou inválidos.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise NomeGrupoEquipamentoDuplicadoError: Nome do grupo de equipamento duplicado.
: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.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
url = 'egrupo/' + str(id_egrupo) + '/'
egrupo_map = dict()
egrupo_map['nome'] = nome
code, xml = self.submit({'grupo': egrupo_map}, 'PUT', url)
return self.response(code, xml) | python | def alterar(self, id_egrupo, nome):
"""Altera os dados de um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param nome: Nome do grupo de equipamento.
:return: None
:raise InvalidParameterError: O identificador e/ou o nome do grupo são nulos ou inválidos.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise NomeGrupoEquipamentoDuplicadoError: Nome do grupo de equipamento duplicado.
: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.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
url = 'egrupo/' + str(id_egrupo) + '/'
egrupo_map = dict()
egrupo_map['nome'] = nome
code, xml = self.submit({'grupo': egrupo_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"alterar",
"(",
"self",
",",
"id_egrupo",
",",
"nome",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_egrupo",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do grupo de equipamento é inválido ou não foi informado.')",
"",
"url",
"=",
"'egrupo/'",
"+",
"str",
"(",
"id_egrupo",
")",
"+",
"'/'",
"egrupo_map",
"=",
"dict",
"(",
")",
"egrupo_map",
"[",
"'nome'",
"]",
"=",
"nome",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'grupo'",
":",
"egrupo_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Altera os dados de um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param nome: Nome do grupo de equipamento.
:return: None
:raise InvalidParameterError: O identificador e/ou o nome do grupo são nulos ou inválidos.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise NomeGrupoEquipamentoDuplicadoError: Nome do grupo de equipamento duplicado.
: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. | [
"Altera",
"os",
"dados",
"de",
"um",
"grupo",
"de",
"equipamento",
"a",
"partir",
"do",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoEquipamento.py#L130-L155 |
globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoEquipamento.py | GrupoEquipamento.remover | def remover(self, id_egrupo):
"""Remove um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:return: None
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise GroupDontRemoveError:
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
url = 'egrupo/' + str(id_egrupo) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def remover(self, id_egrupo):
"""Remove um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:return: None
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise GroupDontRemoveError:
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
url = 'egrupo/' + str(id_egrupo) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"remover",
"(",
"self",
",",
"id_egrupo",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_egrupo",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do grupo de equipamento é inválido ou não foi informado.')",
"",
"url",
"=",
"'egrupo/'",
"+",
"str",
"(",
"id_egrupo",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:return: None
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise GroupDontRemoveError:
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta. | [
"Remove",
"um",
"grupo",
"de",
"equipamento",
"a",
"partir",
"do",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoEquipamento.py#L157-L178 |
globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoEquipamento.py | GrupoEquipamento.associa_equipamento | def associa_equipamento(self, id_equip, id_grupo_equipamento):
"""Associa um equipamento a um grupo.
:param id_equip: 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_equip
code, xml = self.submit(
{'equipamento_grupo': equip_map}, 'POST', 'equipamentogrupo/associa/')
return self.response(code, xml) | python | def associa_equipamento(self, id_equip, id_grupo_equipamento):
"""Associa um equipamento a um grupo.
:param id_equip: 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_equip
code, xml = self.submit(
{'equipamento_grupo': equip_map}, 'POST', 'equipamentogrupo/associa/')
return self.response(code, xml) | [
"def",
"associa_equipamento",
"(",
"self",
",",
"id_equip",
",",
"id_grupo_equipamento",
")",
":",
"equip_map",
"=",
"dict",
"(",
")",
"equip_map",
"[",
"'id_grupo'",
"]",
"=",
"id_grupo_equipamento",
"equip_map",
"[",
"'id_equipamento'",
"]",
"=",
"id_equip",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'equipamento_grupo'",
":",
"equip_map",
"}",
",",
"'POST'",
",",
"'equipamentogrupo/associa/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Associa um equipamento a um grupo.
:param id_equip: 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/GrupoEquipamento.py#L180-L204 |
globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoEquipamento.py | GrupoEquipamento.remove | def remove(self, id_equipamento, id_egrupo):
"""Remove a associacao de um grupo de equipamento com um equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param id_equipamento: Identificador do equipamento.
:return: None
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
url = 'egrupo/equipamento/' + \
str(id_equipamento) + '/egrupo/' + str(id_egrupo) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def remove(self, id_equipamento, id_egrupo):
"""Remove a associacao de um grupo de equipamento com um equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param id_equipamento: Identificador do equipamento.
:return: None
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta.
"""
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
url = 'egrupo/equipamento/' + \
str(id_equipamento) + '/egrupo/' + str(id_egrupo) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"remove",
"(",
"self",
",",
"id_equipamento",
",",
"id_egrupo",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_egrupo",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do grupo de equipamento é inválido ou não foi informado.')",
"",
"if",
"not",
"is_valid_int_param",
"(",
"id_equipamento",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'O identificador do equipamento é inválido ou não foi informado.')",
"",
"url",
"=",
"'egrupo/equipamento/'",
"+",
"str",
"(",
"id_equipamento",
")",
"+",
"'/egrupo/'",
"+",
"str",
"(",
"id_egrupo",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove a associacao de um grupo de equipamento com um equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:param id_equipamento: Identificador do equipamento.
:return: None
:raise EquipamentoNaoExisteError: Equipamento não cadastrado.
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O identificador do grupo é nulo ou inválido.
:raise DataBaseError: Falha na networkapi ao acessar o banco de dados.
:raise XMLError: Falha na networkapi ao gerar o XML de resposta. | [
"Remove",
"a",
"associacao",
"de",
"um",
"grupo",
"de",
"equipamento",
"com",
"um",
"equipamento",
"a",
"partir",
"do",
"seu",
"identificador",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/GrupoEquipamento.py#L206-L234 |
globocom/GloboNetworkAPI-client-python | networkapiclient/AmbienteLogico.py | AmbienteLogico.inserir | def inserir(self, name):
"""Inserts a new Logical Environment and returns its identifier.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'logical_environment': {'id': < id_logical_environment >}}
:raise InvalidParameterError: Name is null and invalid.
:raise NomeAmbienteLogicoDuplicadoError: There is already a registered Logical Environment with the value of name.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
logical_environment_map = dict()
logical_environment_map['name'] = name
code, xml = self.submit(
{'logical_environment': logical_environment_map}, 'POST', 'logicalenvironment/')
return self.response(code, xml) | python | def inserir(self, name):
"""Inserts a new Logical Environment and returns its identifier.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'logical_environment': {'id': < id_logical_environment >}}
:raise InvalidParameterError: Name is null and invalid.
:raise NomeAmbienteLogicoDuplicadoError: There is already a registered Logical Environment with the value of name.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
logical_environment_map = dict()
logical_environment_map['name'] = name
code, xml = self.submit(
{'logical_environment': logical_environment_map}, 'POST', 'logicalenvironment/')
return self.response(code, xml) | [
"def",
"inserir",
"(",
"self",
",",
"name",
")",
":",
"logical_environment_map",
"=",
"dict",
"(",
")",
"logical_environment_map",
"[",
"'name'",
"]",
"=",
"name",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'logical_environment'",
":",
"logical_environment_map",
"}",
",",
"'POST'",
",",
"'logicalenvironment/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Inserts a new Logical Environment and returns its identifier.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'logical_environment': {'id': < id_logical_environment >}}
:raise InvalidParameterError: Name is null and invalid.
:raise NomeAmbienteLogicoDuplicadoError: There is already a registered Logical Environment with the value of name.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Inserts",
"a",
"new",
"Logical",
"Environment",
"and",
"returns",
"its",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/AmbienteLogico.py#L58-L81 |
globocom/GloboNetworkAPI-client-python | networkapiclient/AmbienteLogico.py | AmbienteLogico.alterar | def alterar(self, id_logicalenvironment, name):
"""Change Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 characters
:return: None
:raise InvalidParameterError: The identifier of Logical Environment or name is null and invalid.
:raise NomeAmbienteLogicoDuplicadoError: There is already a registered Logical Environment with the value of name.
:raise AmbienteLogicoNaoExisteError: Logical Environment 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_logicalenvironment):
raise InvalidParameterError(
u'The identifier of Logical Environment is invalid or was not informed.')
url = 'logicalenvironment/' + str(id_logicalenvironment) + '/'
logical_environment_map = dict()
logical_environment_map['name'] = name
code, xml = self.submit(
{'logical_environment': logical_environment_map}, 'PUT', url)
return self.response(code, xml) | python | def alterar(self, id_logicalenvironment, name):
"""Change Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 characters
:return: None
:raise InvalidParameterError: The identifier of Logical Environment or name is null and invalid.
:raise NomeAmbienteLogicoDuplicadoError: There is already a registered Logical Environment with the value of name.
:raise AmbienteLogicoNaoExisteError: Logical Environment 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_logicalenvironment):
raise InvalidParameterError(
u'The identifier of Logical Environment is invalid or was not informed.')
url = 'logicalenvironment/' + str(id_logicalenvironment) + '/'
logical_environment_map = dict()
logical_environment_map['name'] = name
code, xml = self.submit(
{'logical_environment': logical_environment_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"alterar",
"(",
"self",
",",
"id_logicalenvironment",
",",
"name",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_logicalenvironment",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Logical Environment is invalid or was not informed.'",
")",
"url",
"=",
"'logicalenvironment/'",
"+",
"str",
"(",
"id_logicalenvironment",
")",
"+",
"'/'",
"logical_environment_map",
"=",
"dict",
"(",
")",
"logical_environment_map",
"[",
"'name'",
"]",
"=",
"name",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'logical_environment'",
":",
"logical_environment_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Change Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 characters
:return: None
:raise InvalidParameterError: The identifier of Logical Environment or name is null and invalid.
:raise NomeAmbienteLogicoDuplicadoError: There is already a registered Logical Environment with the value of name.
:raise AmbienteLogicoNaoExisteError: Logical Environment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Change",
"Logical",
"Environment",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/AmbienteLogico.py#L83-L110 |
globocom/GloboNetworkAPI-client-python | networkapiclient/AmbienteLogico.py | AmbienteLogico.remover | def remover(self, id_logicalenvironment):
"""Remove Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Logical Environment is null and invalid.
:raise AmbienteLogicoNaoExisteError: Logical Environment 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_logicalenvironment):
raise InvalidParameterError(
u'The identifier of Logical Environment is invalid or was not informed.')
url = 'logicalenvironment/' + str(id_logicalenvironment) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def remover(self, id_logicalenvironment):
"""Remove Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Logical Environment is null and invalid.
:raise AmbienteLogicoNaoExisteError: Logical Environment 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_logicalenvironment):
raise InvalidParameterError(
u'The identifier of Logical Environment is invalid or was not informed.')
url = 'logicalenvironment/' + str(id_logicalenvironment) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"remover",
"(",
"self",
",",
"id_logicalenvironment",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_logicalenvironment",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Logical Environment is invalid or was not informed.'",
")",
"url",
"=",
"'logicalenvironment/'",
"+",
"str",
"(",
"id_logicalenvironment",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Logical Environment is null and invalid.
:raise AmbienteLogicoNaoExisteError: Logical Environment not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Logical",
"Environment",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/AmbienteLogico.py#L112-L133 |
globocom/GloboNetworkAPI-client-python | networkapiclient/exception.py | ErrorHandler.handle | def handle(cls, code, description):
'''Recebe o código e a descrição do erro da networkAPI e lança a exceção correspondente.
:param code: Código de erro retornado pela networkAPI.
:param description: Descrição do erro.
:return: None
'''
if code is None:
raise NetworkAPIClientError(description)
if int(code) in cls.errors:
raise cls.errors[int(code)](description)
else:
raise NetworkAPIClientError(description) | python | def handle(cls, code, description):
'''Recebe o código e a descrição do erro da networkAPI e lança a exceção correspondente.
:param code: Código de erro retornado pela networkAPI.
:param description: Descrição do erro.
:return: None
'''
if code is None:
raise NetworkAPIClientError(description)
if int(code) in cls.errors:
raise cls.errors[int(code)](description)
else:
raise NetworkAPIClientError(description) | [
"def",
"handle",
"(",
"cls",
",",
"code",
",",
"description",
")",
":",
"if",
"code",
"is",
"None",
":",
"raise",
"NetworkAPIClientError",
"(",
"description",
")",
"if",
"int",
"(",
"code",
")",
"in",
"cls",
".",
"errors",
":",
"raise",
"cls",
".",
"errors",
"[",
"int",
"(",
"code",
")",
"]",
"(",
"description",
")",
"else",
":",
"raise",
"NetworkAPIClientError",
"(",
"description",
")"
] | Recebe o código e a descrição do erro da networkAPI e lança a exceção correspondente.
:param code: Código de erro retornado pela networkAPI.
:param description: Descrição do erro.
:return: None | [
"Recebe",
"o",
"código",
"e",
"a",
"descrição",
"do",
"erro",
"da",
"networkAPI",
"e",
"lança",
"a",
"exceção",
"correspondente",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/exception.py#L1109-L1123 |
globocom/GloboNetworkAPI-client-python | networkapiclient/PermissaoAdministrativa.py | PermissaoAdministrativa.list_by_group | def list_by_group(self, id_ugroup):
"""Search Administrative Permission by Group User by identifier.
:param id_ugroup: Identifier of the Group User. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'perms': [{'ugrupo': < ugrupo_id >, 'permission': { 'function' < function >, 'id': < id > },
'id': < id >, 'escrita': < escrita >,
'leitura': < leitura >}, ... ] }
:raise InvalidParameterError: Group User is null and invalid.
:raise UGrupoNotFoundError: Group User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if id_ugroup is None:
raise InvalidParameterError(
u'The identifier of Group User is invalid or was not informed.')
url = 'aperms/group/' + str(id_ugroup) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def list_by_group(self, id_ugroup):
"""Search Administrative Permission by Group User by identifier.
:param id_ugroup: Identifier of the Group User. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'perms': [{'ugrupo': < ugrupo_id >, 'permission': { 'function' < function >, 'id': < id > },
'id': < id >, 'escrita': < escrita >,
'leitura': < leitura >}, ... ] }
:raise InvalidParameterError: Group User is null and invalid.
:raise UGrupoNotFoundError: Group User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
if id_ugroup is None:
raise InvalidParameterError(
u'The identifier of Group User is invalid or was not informed.')
url = 'aperms/group/' + str(id_ugroup) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"list_by_group",
"(",
"self",
",",
"id_ugroup",
")",
":",
"if",
"id_ugroup",
"is",
"None",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Group User is invalid or was not informed.'",
")",
"url",
"=",
"'aperms/group/'",
"+",
"str",
"(",
"id_ugroup",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Search Administrative Permission by Group User by identifier.
:param id_ugroup: Identifier of the Group User. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'perms': [{'ugrupo': < ugrupo_id >, 'permission': { 'function' < function >, 'id': < id > },
'id': < id >, 'escrita': < escrita >,
'leitura': < leitura >}, ... ] }
:raise InvalidParameterError: Group User is null and invalid.
:raise UGrupoNotFoundError: Group User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Search",
"Administrative",
"Permission",
"by",
"Group",
"User",
"by",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/PermissaoAdministrativa.py#L38-L65 |
globocom/GloboNetworkAPI-client-python | networkapiclient/PermissaoAdministrativa.py | PermissaoAdministrativa.search | def search(self, id_perm):
"""Search Administrative Permission from by the identifier.
:param id_perm: Identifier of the Administrative Permission. Integer value and greater than zero.
:return: Following dictionary:
::
{'perm': {'ugrupo': < ugrupo_id >,
'permission': < permission_id >, 'id': < id >,
'escrita': < escrita >, 'leitura': < leitura >}}
:raise InvalidParameterError: Group User identifier is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission 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_perm):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/get/' + str(id_perm) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | python | def search(self, id_perm):
"""Search Administrative Permission from by the identifier.
:param id_perm: Identifier of the Administrative Permission. Integer value and greater than zero.
:return: Following dictionary:
::
{'perm': {'ugrupo': < ugrupo_id >,
'permission': < permission_id >, 'id': < id >,
'escrita': < escrita >, 'leitura': < leitura >}}
:raise InvalidParameterError: Group User identifier is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission 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_perm):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/get/' + str(id_perm) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | [
"def",
"search",
"(",
"self",
",",
"id_perm",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_perm",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Administrative Permission is invalid or was not informed.'",
")",
"url",
"=",
"'aperms/get/'",
"+",
"str",
"(",
"id_perm",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'GET'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Search Administrative Permission from by the identifier.
:param id_perm: Identifier of the Administrative Permission. Integer value and greater than zero.
:return: Following dictionary:
::
{'perm': {'ugrupo': < ugrupo_id >,
'permission': < permission_id >, 'id': < id >,
'escrita': < escrita >, 'leitura': < leitura >}}
:raise InvalidParameterError: Group User identifier is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Search",
"Administrative",
"Permission",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/PermissaoAdministrativa.py#L67-L94 |
globocom/GloboNetworkAPI-client-python | networkapiclient/PermissaoAdministrativa.py | PermissaoAdministrativa.inserir | def inserir(self, id_permission, read, write, id_group):
"""Inserts a new Administrative Permission and returns its identifier.
:param id_permission: Identifier of the Permission. Integer value and greater than zero.
:param read: Read. 0 or 1
:param write: Write. 0 or 1
:param id_group: Identifier of the Group of User. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'perm': {'id': < id_perm >}}
:raise InvalidParameterError: The identifier of Administrative Permission, identifier of Group of User, read or write is null and invalid.
:raise ValorIndicacaoPermissaoInvalidoError: The value of read or write is null and invalid.
:raise PermissaoAdministrativaDuplicadaError: Function already registered for the user group.
:raise GrupoUsuarioNaoExisteError: Group of User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
perms_map = dict()
perms_map['id_permission'] = id_permission
perms_map['read'] = read
perms_map['write'] = write
perms_map['id_group'] = id_group
code, xml = self.submit(
{'administrative_permission': perms_map}, 'POST', 'aperms/')
return self.response(code, xml) | python | def inserir(self, id_permission, read, write, id_group):
"""Inserts a new Administrative Permission and returns its identifier.
:param id_permission: Identifier of the Permission. Integer value and greater than zero.
:param read: Read. 0 or 1
:param write: Write. 0 or 1
:param id_group: Identifier of the Group of User. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'perm': {'id': < id_perm >}}
:raise InvalidParameterError: The identifier of Administrative Permission, identifier of Group of User, read or write is null and invalid.
:raise ValorIndicacaoPermissaoInvalidoError: The value of read or write is null and invalid.
:raise PermissaoAdministrativaDuplicadaError: Function already registered for the user group.
:raise GrupoUsuarioNaoExisteError: Group of User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response.
"""
perms_map = dict()
perms_map['id_permission'] = id_permission
perms_map['read'] = read
perms_map['write'] = write
perms_map['id_group'] = id_group
code, xml = self.submit(
{'administrative_permission': perms_map}, 'POST', 'aperms/')
return self.response(code, xml) | [
"def",
"inserir",
"(",
"self",
",",
"id_permission",
",",
"read",
",",
"write",
",",
"id_group",
")",
":",
"perms_map",
"=",
"dict",
"(",
")",
"perms_map",
"[",
"'id_permission'",
"]",
"=",
"id_permission",
"perms_map",
"[",
"'read'",
"]",
"=",
"read",
"perms_map",
"[",
"'write'",
"]",
"=",
"write",
"perms_map",
"[",
"'id_group'",
"]",
"=",
"id_group",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'administrative_permission'",
":",
"perms_map",
"}",
",",
"'POST'",
",",
"'aperms/'",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Inserts a new Administrative Permission and returns its identifier.
:param id_permission: Identifier of the Permission. Integer value and greater than zero.
:param read: Read. 0 or 1
:param write: Write. 0 or 1
:param id_group: Identifier of the Group of User. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'perm': {'id': < id_perm >}}
:raise InvalidParameterError: The identifier of Administrative Permission, identifier of Group of User, read or write is null and invalid.
:raise ValorIndicacaoPermissaoInvalidoError: The value of read or write is null and invalid.
:raise PermissaoAdministrativaDuplicadaError: Function already registered for the user group.
:raise GrupoUsuarioNaoExisteError: Group of User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Inserts",
"a",
"new",
"Administrative",
"Permission",
"and",
"returns",
"its",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/PermissaoAdministrativa.py#L117-L147 |
globocom/GloboNetworkAPI-client-python | networkapiclient/PermissaoAdministrativa.py | PermissaoAdministrativa.alterar | def alterar(self, id_perm, id_permission, read, write, id_group):
"""Change Administrative Permission from by the identifier.
:param id_perm: Identifier of the Administrative Permission. Integer value and greater than zero.
:param id_permission: Identifier of the Permission. Integer value and greater than zero.
:param read: Read. 0 or 1
:param write: Write. 0 or 1
:param id_group: Identifier of the Group of User. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Administrative Permission, identifier of Permission, identifier of Group of User, read or write is null and invalid.
:raise ValorIndicacaoPermissaoInvalidoError: The value of read or write is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission not registered.
:raise GrupoUsuarioNaoExisteError: Group of 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_perm):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/' + str(id_perm) + '/'
perms_map = dict()
perms_map['id_perm'] = id_perm
perms_map['id_permission'] = id_permission
perms_map['read'] = read
perms_map['write'] = write
perms_map['id_group'] = id_group
code, xml = self.submit(
{'administrative_permission': perms_map}, 'PUT', url)
return self.response(code, xml) | python | def alterar(self, id_perm, id_permission, read, write, id_group):
"""Change Administrative Permission from by the identifier.
:param id_perm: Identifier of the Administrative Permission. Integer value and greater than zero.
:param id_permission: Identifier of the Permission. Integer value and greater than zero.
:param read: Read. 0 or 1
:param write: Write. 0 or 1
:param id_group: Identifier of the Group of User. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Administrative Permission, identifier of Permission, identifier of Group of User, read or write is null and invalid.
:raise ValorIndicacaoPermissaoInvalidoError: The value of read or write is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission not registered.
:raise GrupoUsuarioNaoExisteError: Group of 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_perm):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/' + str(id_perm) + '/'
perms_map = dict()
perms_map['id_perm'] = id_perm
perms_map['id_permission'] = id_permission
perms_map['read'] = read
perms_map['write'] = write
perms_map['id_group'] = id_group
code, xml = self.submit(
{'administrative_permission': perms_map}, 'PUT', url)
return self.response(code, xml) | [
"def",
"alterar",
"(",
"self",
",",
"id_perm",
",",
"id_permission",
",",
"read",
",",
"write",
",",
"id_group",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_perm",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Administrative Permission is invalid or was not informed.'",
")",
"url",
"=",
"'aperms/'",
"+",
"str",
"(",
"id_perm",
")",
"+",
"'/'",
"perms_map",
"=",
"dict",
"(",
")",
"perms_map",
"[",
"'id_perm'",
"]",
"=",
"id_perm",
"perms_map",
"[",
"'id_permission'",
"]",
"=",
"id_permission",
"perms_map",
"[",
"'read'",
"]",
"=",
"read",
"perms_map",
"[",
"'write'",
"]",
"=",
"write",
"perms_map",
"[",
"'id_group'",
"]",
"=",
"id_group",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"{",
"'administrative_permission'",
":",
"perms_map",
"}",
",",
"'PUT'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Change Administrative Permission from by the identifier.
:param id_perm: Identifier of the Administrative Permission. Integer value and greater than zero.
:param id_permission: Identifier of the Permission. Integer value and greater than zero.
:param read: Read. 0 or 1
:param write: Write. 0 or 1
:param id_group: Identifier of the Group of User. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Administrative Permission, identifier of Permission, identifier of Group of User, read or write is null and invalid.
:raise ValorIndicacaoPermissaoInvalidoError: The value of read or write is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission not registered.
:raise GrupoUsuarioNaoExisteError: Group of User not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Change",
"Administrative",
"Permission",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/PermissaoAdministrativa.py#L149-L183 |
globocom/GloboNetworkAPI-client-python | networkapiclient/PermissaoAdministrativa.py | PermissaoAdministrativa.remover | def remover(self, id_perms):
"""Remove Administrative Permission from by the identifier.
:param id_perms: Identifier of the Administrative Permission. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Administrative Permission is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission 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_perms):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/' + str(id_perms) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | python | def remover(self, id_perms):
"""Remove Administrative Permission from by the identifier.
:param id_perms: Identifier of the Administrative Permission. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Administrative Permission is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission 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_perms):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/' + str(id_perms) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) | [
"def",
"remover",
"(",
"self",
",",
"id_perms",
")",
":",
"if",
"not",
"is_valid_int_param",
"(",
"id_perms",
")",
":",
"raise",
"InvalidParameterError",
"(",
"u'The identifier of Administrative Permission is invalid or was not informed.'",
")",
"url",
"=",
"'aperms/'",
"+",
"str",
"(",
"id_perms",
")",
"+",
"'/'",
"code",
",",
"xml",
"=",
"self",
".",
"submit",
"(",
"None",
",",
"'DELETE'",
",",
"url",
")",
"return",
"self",
".",
"response",
"(",
"code",
",",
"xml",
")"
] | Remove Administrative Permission from by the identifier.
:param id_perms: Identifier of the Administrative Permission. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Administrative Permission is null and invalid.
:raise PermissaoAdministrativaNaoExisteError: Administrative Permission not registered.
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XML response. | [
"Remove",
"Administrative",
"Permission",
"from",
"by",
"the",
"identifier",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/PermissaoAdministrativa.py#L185-L205 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ClientFactory.py | ClientFactory.create_ambiente | def create_ambiente(self):
"""Get an instance of ambiente services facade."""
return Ambiente(
self.networkapi_url,
self.user,
self.password,
self.user_ldap) | python | def create_ambiente(self):
"""Get an instance of ambiente services facade."""
return Ambiente(
self.networkapi_url,
self.user,
self.password,
self.user_ldap) | [
"def",
"create_ambiente",
"(",
"self",
")",
":",
"return",
"Ambiente",
"(",
"self",
".",
"networkapi_url",
",",
"self",
".",
"user",
",",
"self",
".",
"password",
",",
"self",
".",
"user_ldap",
")"
] | Get an instance of ambiente services facade. | [
"Get",
"an",
"instance",
"of",
"ambiente",
"services",
"facade",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ClientFactory.py#L100-L106 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ClientFactory.py | ClientFactory.create_ambiente_logico | def create_ambiente_logico(self):
"""Get an instance of ambiente_logico services facade."""
return AmbienteLogico(
self.networkapi_url,
self.user,
self.password,
self.user_ldap) | python | def create_ambiente_logico(self):
"""Get an instance of ambiente_logico services facade."""
return AmbienteLogico(
self.networkapi_url,
self.user,
self.password,
self.user_ldap) | [
"def",
"create_ambiente_logico",
"(",
"self",
")",
":",
"return",
"AmbienteLogico",
"(",
"self",
".",
"networkapi_url",
",",
"self",
".",
"user",
",",
"self",
".",
"password",
",",
"self",
".",
"user_ldap",
")"
] | Get an instance of ambiente_logico services facade. | [
"Get",
"an",
"instance",
"of",
"ambiente_logico",
"services",
"facade",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ClientFactory.py#L108-L114 |
globocom/GloboNetworkAPI-client-python | networkapiclient/ClientFactory.py | ClientFactory.create_api_environment_vip | def create_api_environment_vip(self):
"""Get an instance of Api Environment Vip services facade."""
return ApiEnvironmentVip(
self.networkapi_url,
self.user,
self.password,
self.user_ldap) | python | def create_api_environment_vip(self):
"""Get an instance of Api Environment Vip services facade."""
return ApiEnvironmentVip(
self.networkapi_url,
self.user,
self.password,
self.user_ldap) | [
"def",
"create_api_environment_vip",
"(",
"self",
")",
":",
"return",
"ApiEnvironmentVip",
"(",
"self",
".",
"networkapi_url",
",",
"self",
".",
"user",
",",
"self",
".",
"password",
",",
"self",
".",
"user_ldap",
")"
] | Get an instance of Api Environment Vip services facade. | [
"Get",
"an",
"instance",
"of",
"Api",
"Environment",
"Vip",
"services",
"facade",
"."
] | train | https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ClientFactory.py#L116-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.