text_prompt stringlengths 157 13.1k | code_prompt stringlengths 7 19.8k ⌀ |
|---|---|
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_environment(self, environment):
""" Method to create environment """ |
uri = 'api/v3/environment/'
data = dict()
data['environments'] = list()
data['environments'].append(environment)
return super(ApiEnvironment, self).post(uri, data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update_environment(self, environment, environment_ids):
""" Method to update environment :param environment_ids: Ids of Environment """ |
uri = 'api/v3/environment/%s/' % environment_ids
data = dict()
data['environments'] = list()
data['environments'].append(environment)
return super(ApiEnvironment, self).put(uri, data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete_environment(self, environment_ids):
""" Method to delete environment :param environment_ids: Ids of Environment """ |
uri = 'api/v3/environment/%s/' % environment_ids
return super(ApiEnvironment, self).delete(uri) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def search(self, **kwargs):
""" Method to search environments based on extends search. :param search: Dict containing QuerySets to find environments. :param incl... |
return super(ApiEnvironment, self).get(self.prepare_url('api/v3/environment/',
kwargs)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete(self, ids):
""" Method to delete environments by their id's :param ids: Identifiers of environments :return: None """ |
url = build_uri_with_ids('api/v3/environment/%s/', ids)
return super(ApiEnvironment, self).delete(url) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, environments):
""" Method to update environments :param environments: List containing environments desired to updated :return: None """ |
data = {'environments': environments}
environments_ids = [str(env.get('id')) for env in environments]
return super(ApiEnvironment, self).put('api/v3/environment/%s/' %
';'.join(environments_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create(self, environments):
""" Method to create environments :param environments: Dict containing environments desired to be created on database :return: No... |
data = {'environments': environments}
return super(ApiEnvironment, self).post('api/v3/environment/', data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def search(self, **kwargs):
""" Method to search asns based on extends search. :param search: Dict containing QuerySets to find asns. :param include: Array conta... |
return super(ApiV4As, self).get(self.prepare_url(
'api/v4/as/', kwargs)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete(self, ids):
""" Method to delete asns by their id's :param ids: Identifiers of asns :return: None """ |
url = build_uri_with_ids('api/v4/as/%s/', ids)
return super(ApiV4As, self).delete(url) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, asns):
""" Method to update asns :param asns: List containing asns desired to updated :return: None """ |
data = {'asns': asns}
asns_ids = [str(env.get('id')) for env in asns]
return super(ApiV4As, self).put('api/v4/as/%s/' %
';'.join(asns_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create(self, asns):
""" Method to create asns :param asns: List containing asns desired to be created on database :return: None """ |
data = {'asns': asns}
return super(ApiV4As, self).post('api/v4/as/', data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, equipments):
""" Method to update equipments :param equipments: List containing equipments desired to updated :return: None """ |
data = {'equipments': equipments}
equipments_ids = [str(env.get('id')) for env in equipments]
return super(ApiV4Equipment, self).put('api/v4/equipment/%s/' %
';'.join(equipments_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def inserir(self, id_script_type, script, model, description):
"""Inserts a new Script and returns its identifier. :param id_script_type: Identifier of the Scrip... |
script_map = dict()
script_map['id_script_type'] = id_script_type
script_map['script'] = script
script_map['model'] = model
script_map['description'] = description
code, xml = self.submit({'script': script_map}, 'POST', 'script/')
return self.response(code, xml... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alterar(self, id_script, id_script_type, script, description, model=None):
"""Change Script from by the identifier. :param id_script: Identifier of the Scrip... |
if not is_valid_int_param(id_script):
raise InvalidParameterError(u'The identifier of Script is invalid or was not informed.')
script_map = dict()
script_map['id_script_type'] = id_script_type
script_map['script'] = script
script_map['model'] = model
script_... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remover(self, id_script):
"""Remove Script from by the identifier. :param id_script: Identifier of the Script. Integer value and greater than zero. :return: ... |
if not is_valid_int_param(id_script):
raise InvalidParameterError(
u'The identifier of Script is invalid or was not informed.')
url = 'script/' + str(id_script) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def listar_por_tipo(self, id_script_type):
"""List all Script by Script Type. :param id_script_type: Identifier of the Script Type. Integer value and greater tha... |
if not is_valid_int_param(id_script_type):
raise InvalidParameterError(
u'The identifier of Script Type is invalid or was not informed.')
url = 'script/scripttype/' + str(id_script_type) + '/'
code, map = self.submit(None, 'GET', url)
key = 'script'
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def listar_por_equipamento(self, id_equipment):
"""List all Script related Equipment. :param id_equipment: Identifier of the Equipment. Integer value and greater... |
if not is_valid_int_param(id_equipment):
raise InvalidParameterError(
u'The identifier of Equipment is invalid or was not informed.')
url = 'script/equipment/' + str(id_equipment) + '/'
code, map = self.submit(None, 'GET', url)
key = 'script'
retur... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_rule_by_id(self, rule_id):
"""Get rule by indentifier. :param rule_id: Rule identifier :return: Dictionary with the following structure: :: {'rule': {'en... |
url = "rule/get_by_id/" + str(rule_id)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['rule_contents', 'rule_blocks']) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_networks(self, ids, id_vlan):
"""Set column 'active = 1' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: N... |
network_map = dict()
network_map['ids'] = ids
network_map['id_vlan'] = id_vlan
code, xml = self.submit(
{'network': network_map}, 'PUT', 'network/create/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_network(self, network, id_vlan, id_network_type, id_environment_vip=None, cluster_unit=None):
""" Add new network :param network: IPV4 or IPV6 (ex.: "10.... |
network_map = dict()
network_map['network'] = network
network_map['id_vlan'] = id_vlan
network_map['id_network_type'] = id_network_type
network_map['id_environment_vip'] = id_environment_vip
network_map['cluster_unit'] = cluster_unit
code, xml = self.submit(
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def edit_network(self, id_network, ip_type, id_net_type, id_env_vip=None, cluster_unit=None):
""" Edit a network 4 or 6 :param id_network: Identifier of the Netw... |
net_map = dict()
net_map['id_network'] = id_network
net_map['ip_type'] = ip_type
net_map['id_net_type'] = id_net_type
net_map['id_env_vip'] = id_env_vip
net_map['cluster_unit'] = cluster_unit
code, xml = self.submit({'net': net_map}, 'POST', 'network/edit/')
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def deallocate_network_ipv4(self, id_network_ipv4):
""" Deallocate all relationships between NetworkIPv4. :param id_network_ipv4: ID for NetworkIPv4 :return: Not... |
if not is_valid_int_param(id_network_ipv4):
raise InvalidParameterError(
u'The identifier of NetworkIPv4 is invalid or was not informed.')
url = 'network/ipv4/' + str(id_network_ipv4) + '/deallocate/'
code, xml = self.submit(None, 'DELETE', url)
return se... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def deallocate_network_ipv6(self, id_network_ipv6):
""" Deallocate all relationships between NetworkIPv6. :param id_network_ipv6: ID for NetworkIPv6 :return: Not... |
if not is_valid_int_param(id_network_ipv6):
raise InvalidParameterError(
u'The identifier of NetworkIPv6 is invalid or was not informed.')
url = 'network/ipv6/' + str(id_network_ipv6) + '/deallocate/'
code, xml = self.submit(None, 'DELETE', url)
return se... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remove_networks(self, ids):
""" Set column 'active = 0' in tables redeipv4 and redeipv6] :param ids: ID for NetworkIPv4 and/or NetworkIPv6 :return: Nothing :... |
network_map = dict()
network_map['ids'] = ids
code, xml = self.submit(
{'network': network_map}, 'PUT', 'network/remove/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list(self, networkipv6=None, ipv6=None):
"""List all DHCPRelayIPv6. :param: networkipv6: networkipv6 id - list all dhcprelay filtering by networkipv6 id ipv6... |
uri = 'api/dhcprelayv6/?'
if networkipv6:
uri += 'networkipv6=%s&' % networkipv6
if ipv6:
uri += 'ipv6=%s' % ipv6
return self.get(uri) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, ipv6s):
""" Method to update ipv6's :param ipv6s: List containing ipv6's desired to updated :return: None """ |
data = {'ips': ipv6s}
ipv6s_ids = [str(ipv6.get('id')) for ipv6 in ipv6s]
return super(ApiIPv6, self).put('api/v3/ipv6/%s/' %
';'.join(ipv6s_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, ipv4s):
""" Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None """ |
data = {'ips': ipv4s}
ipv4s_ids = [str(ipv4.get('id')) for ipv4 in ipv4s]
return super(ApiIPv4, self).put('api/v3/ipv4/%s/' %
';'.join(ipv4s_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def search(self, **kwargs):
""" Method to search object group permissions general based on extends search. :param search: Dict containing QuerySets to find objec... |
return super(ApiObjectGroupPermissionGeneral, self).get(self.prepare_url('api/v3/object-group-perm-general/',
kwargs)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete(self, ids):
""" Method to delete object group permissions general by their ids :param ids: Identifiers of object group permissions general :return: No... |
url = build_uri_with_ids('api/v3/object-group-perm-general/%s/', ids)
return super(ApiObjectGroupPermissionGeneral, self).delete(url) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, ogpgs):
""" Method to update object group permissions general :param ogpgs: List containing object group permissions general desired to updated ... |
data = {'ogpgs': ogpgs}
ogpgs_ids = [str(ogpg.get('id')) for ogpg in ogpgs]
return super(ApiObjectGroupPermissionGeneral, self).put('api/v3/object-group-perm-general/%s/' %
';'.join(ogpgs_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create(self, ogpgs):
""" Method to create object group permissions general :param ogpgs: List containing vrf desired to be created on database :return: None ... |
data = {'ogpgs': ogpgs}
return super(ApiObjectGroupPermissionGeneral, self).post('api/v3/object-group-perm-general/', data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add(self, tipo_opcao, nome_opcao_txt):
"""Inserts a new Option VIP and returns its identifier. :param tipo_opcao: Type. String with a maximum of 50 character... |
optionvip_map = dict()
optionvip_map['tipo_opcao'] = tipo_opcao
optionvip_map['nome_opcao_txt'] = nome_opcao_txt
code, xml = self.submit(
{'option_vip': optionvip_map}, 'POST', 'optionvip/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alter(self, id_option_vip, tipo_opcao, nome_opcao_txt):
"""Change Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Inte... |
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(
u'The identifier of Option VIP is invalid or was not informed.')
optionvip_map = dict()
optionvip_map['tipo_opcao'] = tipo_opcao
optionvip_map['nome_opcao_txt'] = nome_opcao_txt
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remove(self, id_option_vip):
"""Remove Option VIP from by the identifier. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than ... |
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(
u'The identifier of Option VIP is invalid or was not informed.')
url = 'optionvip/' + str(id_option_vip) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, x... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_option_vip(self, id_environment_vip):
"""Get all Option VIP by Environment Vip. :return: Dictionary with the following structure: :: {‘option_vip’: [{‘id... |
url = 'optionvip/environmentvip/' + str(id_environment_vip) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['option_vip']) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def associate(self, id_option_vip, id_environment_vip):
"""Create a relationship of OptionVip with EnvironmentVip. :param id_option_vip: Identifier of the Option... |
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(
u'The identifier of Option VIP is invalid or was not informed.')
if not is_valid_int_param(id_environment_vip):
raise InvalidParameterError(
u'The identifier of Environment V... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def buscar_timeout_opcvip(self, id_ambiente_vip):
"""Buscar nome_opcao_txt das Opcoes VIp quando tipo_opcao = 'Timeout' pelo environmentvip_id :return: Dictionar... |
if not is_valid_int_param(id_ambiente_vip):
raise InvalidParameterError(
u'The identifier of environment-vip is invalid or was not informed.')
url = 'environment-vip/get/timeout/' + str(id_ambiente_vip) + '/'
code, xml = self.submit(None, 'GET', url)
retu... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def listar_por_marca(self, id_brand):
"""List all Model by Brand. :param id_brand: Identifier of the Brand. Integer value and greater than zero. :return: Diction... |
if not is_valid_int_param(id_brand):
raise InvalidParameterError(
u'The identifier of Brand is invalid or was not informed.')
url = 'model/brand/' + str(id_brand) + '/'
code, map = self.submit(None, 'GET', url)
key = 'model'
return get_list_map(se... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def inserir(self, id_brand, name):
"""Inserts a new Model and returns its identifier :param id_brand: Identifier of the Brand. Integer value and greater than zer... |
model_map = dict()
model_map['name'] = name
model_map['id_brand'] = id_brand
code, xml = self.submit({'model': model_map}, 'POST', 'model/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alterar(self, id_model, id_brand, name):
"""Change Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zer... |
if not is_valid_int_param(id_model):
raise InvalidParameterError(
u'The identifier of Model is invalid or was not informed.')
model_map = dict()
model_map['name'] = name
model_map['id_brand'] = id_brand
url = 'model/' + str(id_model) + '/'
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remover(self, id_model):
"""Remove Model from by the identifier. :param id_model: Identifier of the Model. Integer value and greater than zero. :return: None... |
if not is_valid_int_param(id_model):
raise InvalidParameterError(
u'The identifier of Model is invalid or was not informed.')
url = 'model/' + str(id_model) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def listar_por_equipamento(self, id_equipamento):
"""List all interfaces of an equipment. :param id_equipamento: Equipment identifier. :return: Dictionary with t... |
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'Equipment id is invalid or was not informed.')
url = 'interface/equipamento/' + str(id_equipamento) + '/'
code, map = self.submit(None, 'GET', url)
key = 'interface'
return g... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_by_id(self, id_interface):
"""Get an interface by id. :param id_interface: Interface identifier. :return: Following dictionary: :: {'interface': {'id': <... |
if not is_valid_int_param(id_interface):
raise InvalidParameterError(
u'Interface id is invalid or was not informed.')
url = 'interface/' + str(id_interface) + '/get/'
code, map = self.submit(None, 'GET', url)
return self.response(code, map) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def inserir( self, nome, protegida, descricao, id_ligacao_front, id_ligacao_back, id_equipamento, tipo=None, vlan=None):
"""Insert new interface for an equipment... |
interface_map = dict()
interface_map['nome'] = nome
interface_map['protegida'] = protegida
interface_map['descricao'] = descricao
interface_map['id_ligacao_front'] = id_ligacao_front
interface_map['id_ligacao_back'] = id_ligacao_back
interface_map['id_equipamento... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alterar( self, id_interface, nome, protegida, descricao, id_ligacao_front, id_ligacao_back, tipo=None, vlan=None):
"""Edit an interface by its identifier. Eq... |
if not is_valid_int_param(id_interface):
raise InvalidParameterError(
u'Interface id is invalid or was not informed.')
url = 'interface/' + str(id_interface) + '/'
interface_map = dict()
interface_map['nome'] = nome
interface_map['protegida'] = prot... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remover(self, id_interface):
"""Remove an interface by its identifier. :param id_interface: Interface identifier. :return: None :raise InterfaceNaoExisteErro... |
if not is_valid_int_param(id_interface):
raise InvalidParameterError(
u'Interface id is invalid or was not informed.')
url = 'interface/' + str(id_interface) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list_connections(self, nome_interface, id_equipamento):
"""List interfaces linked to back and front of specified interface. :param nome_interface: Interface ... |
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'Equipment identifier is none or was not informed.')
if (nome_interface is None) or (nome_interface == ''):
raise InvalidParameterError(u'Interface name was not informed.')
# Tempo... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list_all(self):
"""List all Permission. :return: Dictionary with the following structure: :: :raise DataBaseError: Networkapi failed to access the database. ... |
code, map = self.submit(None, 'GET', 'perms/all/')
key = 'perms'
return get_list_map(self.response(code, map, [key]), key) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list_with_usergroup(self):
"""List all users and their user groups. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: D... |
url = 'usuario/get/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_by_user_ldap(self, user_name):
"""Get user by the ldap name. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dict... |
url = 'user/get/ldap/' + str(user_name) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def inserir(self, user, pwd, name, email, user_ldap):
"""Inserts a new User and returns its identifier. The user will be created with active status. :param user:... |
user_map = dict()
user_map['user'] = user
user_map['password'] = pwd
user_map['name'] = name
user_map['email'] = email
user_map['user_ldap'] = user_ldap
code, xml = self.submit({'user': user_map}, 'POST', 'user/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alterar(self, id_user, user, password, nome, ativo, email, user_ldap):
"""Change User from by the identifier. :param id_user: Identifier of the User. Integer... |
if not is_valid_int_param(id_user):
raise InvalidParameterError(
u'The identifier of User is invalid or was not informed.')
url = 'user/' + str(id_user) + '/'
user_map = dict()
user_map['user'] = user
user_map['password'] = password
user_map... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def listar(self):
"""List all access types. :return: Dictionary with structure: :: {‘tipo_acesso’: [{‘id’: < id >, :raise DataBaseError: Networkapi failed to acc... |
code, map = self.submit(None, 'GET', 'tipoacesso/')
key = 'tipo_acesso'
return get_list_map(self.response(code, map, [key]), key) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def inserir(self, protocolo):
"""Insert new access type and returns its identifier. :param protocolo: Protocol. :return: Dictionary with structure: {‘tipo_acesso... |
tipo_acesso_map = dict()
tipo_acesso_map['protocolo'] = protocolo
code, xml = self.submit(
{'tipo_acesso': tipo_acesso_map}, 'POST', 'tipoacesso/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alterar(self, id_tipo_acesso, protocolo):
"""Edit access type by its identifier. :param id_tipo_acesso: Access type identifier. :param protocolo: Protocol. :... |
if not is_valid_int_param(id_tipo_acesso):
raise InvalidParameterError(
u'Access type id is invalid or was not informed.')
tipo_acesso_map = dict()
tipo_acesso_map['protocolo'] = protocolo
url = 'tipoacesso/' + str(id_tipo_acesso) + '/'
code, xml =... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remover(self, id_tipo_acesso):
"""Removes access type by its identifier. :param id_tipo_acesso: Access type identifier. :return: None :raise TipoAcessoError:... |
if not is_valid_int_param(id_tipo_acesso):
raise InvalidParameterError(
u'Access type id is invalid or was not informed.')
url = 'tipoacesso/' + str(id_tipo_acesso) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def inserir(self, type, description):
"""Inserts a new Script Type and returns its identifier. :param type: Script Type type. String with a minimum 3 and maximum... |
script_type_map = dict()
script_type_map['type'] = type
script_type_map['description'] = description
code, xml = self.submit(
{'script_type': script_type_map}, 'POST', 'scripttype/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def alterar(self, id_script_type, type, description):
"""Change Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer... |
if not is_valid_int_param(id_script_type):
raise InvalidParameterError(
u'The identifier of Script Type is invalid or was not informed.')
script_type_map = dict()
script_type_map['type'] = type
script_type_map['description'] = description
url = 'scr... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remover(self, id_script_type):
"""Remove Script Type from by the identifier. :param id_script_type: Identifier of the Script Type. Integer value and greater ... |
if not is_valid_int_param(id_script_type):
raise InvalidParameterError(
u'The identifier of Script Type is invalid or was not informed.')
url = 'scripttype/' + str(id_script_type) + '/'
code, xml = self.submit(None, 'DELETE', url)
return self.response(code... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def search(self, **kwargs):
""" Method to search pool's based on extends search. :param search: Dict containing QuerySets to find pool's. :param include: Array c... |
return super(ApiPool, self).get(self.prepare_url('api/v3/pool/',
kwargs)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete(self, ids):
""" Method to delete pool's by their ids :param ids: Identifiers of pool's :return: None """ |
url = build_uri_with_ids('api/v3/pool/%s/', ids)
return super(ApiPool, self).delete(url) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def update(self, pools):
""" Method to update pool's :param pools: List containing pool's desired to updated :return: None """ |
data = {'server_pools': pools}
pools_ids = [str(pool.get('id'))
for pool in pools]
return super(ApiPool, self).put('api/v3/pool/%s/' %
';'.join(pools_ids), data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create(self, pools):
""" Method to create pool's :param pools: List containing pool's desired to be created on database :return: None """ |
data = {'server_pools': pools}
return super(ApiPool, self).post('api/v3/pool/', data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_real_related(self, id_equip):
""" Find reals related with equipment :param id_equip: Identifier of equipment :return: Following dictionary: :: {'vips': [... |
url = 'equipamento/get_real_related/' + str(id_equip) + '/'
code, xml = self.submit(None, 'GET', url)
data = self.response(code, xml)
return data |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def edit(self, id_equip, nome, id_tipo_equipamento, id_modelo, maintenance=None):
"""Change Equipment from by the identifier. :param id_equip: Identifier of the ... |
equip_map = dict()
equip_map['id_equip'] = id_equip
equip_map['id_tipo_equipamento'] = id_tipo_equipamento
equip_map['id_modelo'] = id_modelo
equip_map['nome'] = nome
if maintenance is not None:
equip_map['maintenance'] = maintenance
url = 'equipame... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def associate_ipv6(self, id_equip, id_ipv6):
"""Associates an IPv6 to a equipament. :param id_equip: Identifier of the equipment. Integer value and greater than ... |
if not is_valid_int_param(id_equip):
raise InvalidParameterError(
u'The identifier of equipment is invalid or was not informed.')
if not is_valid_int_param(id_ipv6):
raise InvalidParameterError(
u'The identifier of ip is invalid or was not infor... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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.ge... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 I... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 a... |
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
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_expect_string_healthcheck(self, expect_string):
"""Inserts a new healthckeck_expect with only expect_string. :param expect_string: expect_string. :return... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def listar_healtchcheck_expect_distinct(self):
"""Get all expect_string. :return: Dictionary with the following structure: :: {'healthcheck_expect': [ 'expect_st... |
url = 'healthcheckexpect/distinct/busca/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list_acl_path(self):
"""Get all distinct acl paths. :return: Dictionary with the following structure: :: {'acl_paths': [ < acl_path >, :raise DataBaseError: ... |
url = 'environment/acl_path/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_template(self, id_environment, name, network):
"""Set template value. If id_environment = 0, set '' to all environments related with the template name. :... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_environment_template(self, name, network):
"""Get environments by template name :param name: Template name. :param network: IPv4 or IPv6. :return: Follow... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def configuration_save( self, id_environment, network, prefix, ip_version, network_type):
""" Add new prefix configuration :param id_environment: Identifier of t... |
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'... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def configuration_list_all(self, environment_id):
""" List all prefix configurations by environment in DB :return: Following dictionary: :: {'lists_configuration... |
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']) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def configuration_remove(self, environment_id, configuration_id):
""" Remove Prefix Configuration :return: None :raise InvalidValueError: Invalid Id for Environm... |
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 ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def associate(self, environment_id, environment_vip_id):
"""Associate a news Environment on Environment VIP and returns its identifier. :param environment_id: 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 Environm... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_related_environment_list(self, environment_vip_id):
"""Get all Environment by Environment Vip. :return: Following dictionary: :: {'ambiente': [{ 'id': <i... |
url = 'environment/environmentvip/{}/'.format(environment_vip_id)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['environment_related_list']) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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... |
brand_map = dict()
brand_map['name'] = name
code, xml = self.submit({'brand': brand_map}, 'POST', 'brand/')
return self.response(code, xml) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 ... |
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_... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 :ra... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 :retur... |
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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 c... |
return super(ApiVlan, self).get(self.prepare_url('api/v3/vlan/',
kwargs)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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... |
if param is None:
return False
if param == IP_VERSION.IPv4[0] or param == IP_VERSION.IPv6[0]:
return True
return False |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
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_reque... |
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) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.