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_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)
<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 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))
<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 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)
<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, 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)
<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, 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)
<SYSTEM_TASK:> Solve the following problem using Python, implementing the functions described below, one line at a time <END_TASK> <USER_TASK:> Description: 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)
<SYSTEM_TASK:> Solve the following problem using Python, implementing the functions described below, one line at a time <END_TASK> <USER_TASK:> Description: 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)
<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): """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 })
<SYSTEM_TASK:> Solve the following problem using Python, implementing the functions described below, one line at a time <END_TASK> <USER_TASK:> Description: 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 } )
<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_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)
<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_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)
<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_all_option_pool(self, option_type=None): """Get all Option Pool. :return: Dictionary with the following structure: :: {[{‘id’: < id >, ‘type’: < tipo_opcao >, :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)
<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_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> :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)
<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_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> } :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 })
<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, 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)
<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_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)
<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_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)
<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(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)
<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, 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)
<SYSTEM_TASK:> Solve the following problem using Python, implementing the functions described below, one line at a time <END_TASK> <USER_TASK:> Description: 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)
<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, 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)
<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 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)
<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_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)
<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_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)
<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_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 >, :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)
<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, 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)
<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_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)
<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_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)
<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_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)
<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_ambiente(self): """Get an instance of ambiente services facade."""
return Ambiente( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_ambiente_logico(self): """Get an instance of ambiente_logico services facade."""
return AmbienteLogico( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_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)
<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_api_environment(self): """Get an instance of Api Environment services facade."""
return ApiEnvironment( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_v4_as(self): """Get an instance of Api As services facade."""
return ApiV4As( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_v4_virtual_interface(self): """Get an instance of Api Virtual Interface services facade."""
return ApiV4VirtualInterface( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_v4_neighbor(self): """Get an instance of Api Neighbor services facade."""
return ApiV4Neighbor( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_ipv4(self): """Get an instance of Api IPv4 services facade."""
return ApiIPv4( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_ipv6(self): """Get an instance of Api IPv6 services facade."""
return ApiIPv6( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_v4_ipv4(self): """Get an instance of Api V4 IPv4 services facade."""
return ApiV4IPv4( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_v4_ipv6(self): """Get an instance of Api V4 IPv6 services facade."""
return ApiV4IPv6( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_network_ipv4(self): """Get an instance of Api Networkv4 services facade."""
return ApiNetworkIPv4( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_network_ipv6(self): """Get an instance of Api Networkv6 services facade."""
return ApiNetworkIPv6( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_option_vip(self): """Get an instance of Api Option Vip services facade."""
return ApiOptionVip( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_pool(self): """Get an instance of Api Pool services facade."""
return ApiPool( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_pool_deploy(self): """Get an instance of Api Pool Deploy services facade."""
return ApiPoolDeploy( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_apirack(self): """Get an instance of Api Rack Variables services facade."""
return ApiRack( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_vlan(self): """Get an instance of Api Vlan services facade."""
return ApiVlan( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_api_vrf(self): """Get an instance of Api Vrf services facade."""
return ApiVrf( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_rule(self): """Get an instance of block rule services facade."""
return BlockRule( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_direito_grupo_equipamento(self): """Get an instance of direito_grupo_equipamento services facade."""
return DireitoGrupoEquipamento( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_divisao_dc(self): """Get an instance of divisao_dc services facade."""
return DivisaoDc( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_vip(self): """Get an instance of environment_vip services facade."""
return EnvironmentVIP( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_equipamento(self): """Get an instance of equipamento services facade."""
return Equipamento( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_equipamento_acesso(self): """Get an instance of equipamento_acesso services facade."""
return EquipamentoAcesso( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_equipamento_ambiente(self): """Get an instance of equipamento_ambiente services facade."""
return EquipamentoAmbiente( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_equipamento_roteiro(self): """Get an instance of equipamento_roteiro services facade."""
return EquipamentoRoteiro( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_log(self): """Get an instance of log services facade."""
return EventLog( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_filter(self): """Get an instance of filter services facade."""
return Filter( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_grupo_equipamento(self): """Get an instance of grupo_equipamento services facade."""
return GrupoEquipamento( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_grupo_l3(self): """Get an instance of grupo_l3 services facade."""
return GrupoL3( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_grupo_usuario(self): """Get an instance of grupo_usuario services facade."""
return GrupoUsuario( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_grupo_virtual(self): """Get an instance of grupo_virtual services facade."""
return GrupoVirtual( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_interface(self): """Get an instance of interface services facade."""
return Interface( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_ip(self): """Get an instance of ip services facade."""
return Ip( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_marca(self): """Get an instance of marca services facade."""
return Marca( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_modelo(self): """Get an instance of modelo services facade."""
return Modelo( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_dhcprelay_ipv4(self): """Get an instance of DHCPRelayIPv4 services facade."""
return DHCPRelayIPv4( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_dhcprelay_ipv6(self): """Get an instance of DHCPRelayIPv6 services facade."""
return DHCPRelayIPv6( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_option_pool(self): """Get an instance of option_pool services facade."""
return OptionPool( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_option_vip(self): """Get an instance of option_vip services facade."""
return OptionVIP( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_permissao_administrativa(self): """Get an instance of permissao_administrativa services facade."""
return PermissaoAdministrativa( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_permission(self): """Get an instance of permission services facade."""
return Permission( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_rack(self): """Get an instance of rack services facade."""
return Rack( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_rackservers(self): """Get an instance of rackservers services facade."""
return RackServers( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_roteiro(self): """Get an instance of roteiro services facade."""
return Roteiro( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_system(self): """Get an instance of Api System Variables services facade."""
return System( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_tipo_acesso(self): """Get an instance of tipo_acesso services facade."""
return TipoAcesso( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_tipo_equipamento(self): """Get an instance of tipo_equipamento services facade."""
return TipoEquipamento( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_tipo_rede(self): """Get an instance of tipo_rede services facade."""
return TipoRede( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_tipo_roteiro(self): """Get an instance of tipo_roteiro services facade."""
return TipoRoteiro( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_usuario(self): """Get an instance of usuario services facade."""
return Usuario( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_usuario_grupo(self): """Get an instance of usuario_grupo services facade."""
return UsuarioGrupo( self.networkapi_url, self.user, self.password, self.user_ldap)
<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_vip(self): """Get an instance of vip services facade."""
return Vip( self.networkapi_url, self.user, self.password, self.user_ldap)
<SYSTEM_TASK:> Solve the following problem using Python, implementing the functions described below, one line at a time <END_TASK> <USER_TASK:> Description: def deploy(self, id_networkv6): """Deploy network in equipments and set column 'active = 1' in tables redeipv6 ] :param id_networkv6: ID for NetworkIPv6 :return: Equipments configuration output """
data = dict() uri = 'api/networkv6/%s/equipments/' % id_networkv6 return super(ApiNetworkIPv6, 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 get_by_id(self, id_networkv6): """Get IPv6 network :param id_networkv4: ID for NetworkIPv6 :return: IPv6 Network """
uri = 'api/networkv4/%s/' % id_networkv6 return super(ApiNetworkIPv6, 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 list(self, environment_vip=None): """List networks redeipv6 ] :param environment_vip: environment vip to filter :return: IPv6 Networks """
uri = 'api/networkv6/?' if environment_vip: uri += 'environment_vip=%s' % environment_vip return super(ApiNetworkIPv6, 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 undeploy(self, id_networkv6): """Remove deployment of network in equipments and set column 'active = 0' in tables redeipv6 ] :param id_networkv6: ID for NetworkIPv6 :return: Equipments configuration output """
uri = 'api/networkv6/%s/equipments/' % id_networkv6 return super(ApiNetworkIPv6, 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 check_vip_ip(self, ip, environment_vip): """ Check available ipv6 in environment vip """
uri = 'api/ipv6/ip/%s/environment-vip/%s/' % (ip, environment_vip) return super(ApiNetworkIPv6, 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 delete network-ipv6's by their ids :param ids: Identifiers of network-ipv6's :return: None """
url = build_uri_with_ids('api/v3/networkv6/%s/', ids) return super(ApiNetworkIPv6, 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, networkipv6s): """ Method to update network-ipv6's :param networkipv6s: List containing network-ipv6's desired to updated :return: None """
data = {'networks': networkipv6s} networkipv6s_ids = [str(networkipv6.get('id')) for networkipv6 in networkipv6s] return super(ApiNetworkIPv6, self).put('api/v3/networkv6/%s/' % ';'.join(networkipv6s_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, networkipv6s): """ Method to create network-ipv6's :param networkipv6s: List containing networkipv6's desired to be created on database :return: None """
data = {'networks': networkipv6s} return super(ApiNetworkIPv6, self).post('api/v3/networkv6/', 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 list_all(self): """ List all environment vips :return: Following dictionary: :: {'environment_vip': [{'id': <id>, 'finalidade_txt': <finalidade_txt>, 'cliente_txt': <cliente_txt>, :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
url = 'environmentvip/all/' code, xml = self.submit(None, 'GET', url) key = 'environment_vip' return get_list_map(self.response(code, xml, [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_all_available(self, id_vlan): """ List all environment vips availables :return: Following dictionary: :: {'environment_vip': [{'id': <id>, 'finalidade_txt': <finalidade_txt>, 'cliente_txt': <cliente_txt>, 'ambiente_p44_txt': <ambiente_p44_txt> } :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
url = 'environmentvip/search/' + str(id_vlan) code, xml = self.submit(None, 'GET', url) key = 'environment_vip' return get_list_map(self.response(code, xml, [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 add(self, finalidade_txt, cliente_txt, ambiente_p44_txt, description): """Inserts a new Environment VIP and returns its identifier. :param finalidade_txt: Finality. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param cliente_txt: ID Client. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param ambiente_p44_txt: Environment P44. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: Following dictionary: :: {'environment_vip': {'id': < id >}} :raise InvalidParameterError: The value of finalidade_txt, cliente_txt or ambiente_p44_txt is invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
environmentvip_map = dict() environmentvip_map['finalidade_txt'] = finalidade_txt environmentvip_map['cliente_txt'] = cliente_txt environmentvip_map['ambiente_p44_txt'] = ambiente_p44_txt environmentvip_map['description'] = description code, xml = self.submit( {'environment_vip': environmentvip_map}, 'POST', 'environmentvip/') 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_environment_vip, finalidade_txt, cliente_txt, ambiente_p44_txt, description): """Change Environment VIP from by the identifier. :param id_environment_vip: Identifier of the Environment VIP. Integer value and greater than zero. :param finalidade_txt: Finality. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param cliente_txt: ID Client. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param ambiente_p44_txt: Environment P44. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: None :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise InvalidParameterError: The value of finalidade_txt, cliente_txt or ambiente_p44_txt is invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
if not is_valid_int_param(id_environment_vip): raise InvalidParameterError( u'The identifier of Environment VIP is invalid or was not informed.') environmentvip_map = dict() environmentvip_map['finalidade_txt'] = finalidade_txt environmentvip_map['cliente_txt'] = cliente_txt environmentvip_map['ambiente_p44_txt'] = ambiente_p44_txt environmentvip_map['description'] = description url = 'environmentvip/' + str(id_environment_vip) + '/' code, xml = self.submit( {'environment_vip': environmentvip_map}, '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 remove(self, id_environment_vip): """Remove Environment VIP from by the identifier. :param id_environment_vip: Identifier of the Environment VIP. Integer value and greater than zero. :return: None :raise InvalidParameterError: Environment VIP identifier is null and invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise EnvironmentVipError: There networkIPv4 or networkIPv6 associated with environment vip. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
if not is_valid_int_param(id_environment_vip): raise InvalidParameterError( u'The identifier of Environment VIP is invalid or was not informed.') url = 'environmentvip/' + str(id_environment_vip) + '/' 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 search( self, id_environment_vip=None, finalidade_txt=None, cliente_txt=None, ambiente_p44_txt=None): """Search Environment VIP from by parameters. Case the id parameter has been passed, the same it has priority over the other parameters. :param id_environment_vip: Identifier of the Environment VIP. Integer value and greater than zero. :param finalidade_txt: Finality. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param cliente_txt: ID Client. String with a maximum of 50 characters and respect [a-zA-Z\_-] :param ambiente_p44_txt: Environment P44. String with a maximum of 50 characters and respect [a-zA-Z\_-] :return: Following dictionary: :: {‘environment_vip’: {‘id’: < id >, ‘finalidade_txt’: < finalidade_txt >, ‘finalidade’: < finalidade >, ‘cliente_txt’: < cliente_txt >, ‘ambiente_p44_txt’: < ambiente_p44_txt >}} :raise InvalidParameterError: The value of id_environment_vip, finalidade_txt, cliente_txt or ambiente_p44_txt is invalid. :raise EnvironmentVipNotFoundError: Environment VIP not registered. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
environmentvip_map = dict() environmentvip_map['id_environment_vip'] = id_environment_vip environmentvip_map['finalidade_txt'] = finalidade_txt environmentvip_map['cliente_txt'] = cliente_txt environmentvip_map['ambiente_p44_txt'] = ambiente_p44_txt code, xml = self.submit( {'environment_vip': environmentvip_map}, 'POST', 'environmentvip/search/') 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 buscar_finalidade(self): """Search finalidade_txt environment vip :return: Dictionary with the following structure: :: {‘finalidade’: ‘finalidade’: <'finalidade_txt'>} :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
url = 'environment-vip/get/finality' 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 buscar_cliente_por_finalidade(self, finalidade_txt): """Search cliente_txt environment vip :return: Dictionary with the following structure: :: {‘cliente_txt’: ‘finalidade’: <'finalidade_txt'>, 'cliente_txt: <'cliente_txt'>'} :raise InvalidParameterError: finalidade_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
vip_map = dict() vip_map['finalidade_txt'] = finalidade_txt url = 'environment-vip/get/cliente_txt/' code, xml = self.submit({'vip': vip_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 buscar_ambientep44_por_finalidade_cliente( self, finalidade_txt, cliente_txt): """Search ambiente_p44_txt environment vip :return: Dictionary with the following structure: :: {‘ambiente_p44_txt’: 'id':<'id_ambientevip'>, ‘finalidade’: <'finalidade_txt'>, 'cliente_txt: <'cliente_txt'>', 'ambiente_p44: <'ambiente_p44'>',} :raise InvalidParameterError: finalidade_txt and cliente_txt is null and invalid. :raise DataBaseError: Networkapi failed to access the database. :raise XMLError: Networkapi failed to generate the XML response. """
vip_map = dict() vip_map['finalidade_txt'] = finalidade_txt vip_map['cliente_txt'] = cliente_txt url = 'environment-vip/get/ambiente_p44_txt/' code, xml = self.submit({'vip': vip_map}, 'POST', url) return self.response(code, xml)