def update_params_for_auth(self, headers, querys, auth_settings): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. """ if not auth_settings: return for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: if not auth_setting['value']: continue elif auth_setting['in'] == 'cookie': headers['Cookie'] = auth_setting['value'] elif auth_setting['in'] == 'header': headers[auth_setting['key']] = auth_setting['value'] elif auth_setting['in'] == 'query': querys.append((auth_setting['key'], auth_setting['value'])) else: raise ApiValueError( 'Authentication token must be in `query` or `header`')
def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": return self.rest_client.GET(url, query_params=query_params, _preload_content=_preload_content, _request_timeout=_request_timeout, headers=headers) elif method == "HEAD": return self.rest_client.HEAD(url, query_params=query_params, _preload_content=_preload_content, _request_timeout=_request_timeout, headers=headers) elif method == "OPTIONS": return self.rest_client.OPTIONS(url, query_params=query_params, headers=headers, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) elif method == "POST": return self.rest_client.POST(url, query_params=query_params, headers=headers, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) elif method == "PUT": return self.rest_client.PUT(url, query_params=query_params, headers=headers, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) elif method == "PATCH": return self.rest_client.PATCH(url, query_params=query_params, headers=headers, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) elif method == "DELETE": return self.rest_client.DELETE(url, query_params=query_params, headers=headers, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) else: raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`.")
def retrieve_entity_type_with_http_info(self, entity_type, **kwargs): # noqa: E501 """retrieve_entity_type # noqa: E501 This operation returns a JSON object with information about the type: * `attrs` : the set of attribute names along with all the entities of such type, represented in a JSON object whose keys are the attribute names and whose values contain information of such attributes (in particular a list of the types used by attributes with that name along with all the entities). * `count` : the number of entities belonging to that type. Response code: * Successful operation uses 200 OK * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.retrieve_entity_type_with_http_info(entity_type, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str entity_type: Entity Type (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: tuple(EntityTypeBody, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['entity_type', 'fiware_service', 'fiware_service_path'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method retrieve_entity_type" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'entity_type' is set if ('entity_type' not in local_var_params or local_var_params['entity_type'] is None): raise ApiValueError( "Missing the required parameter `entity_type` when calling `retrieve_entity_type`" ) # noqa: E501 collection_formats = {} path_params = {} if 'entity_type' in local_var_params: path_params['entityType'] = local_var_params[ 'entity_type'] # noqa: E501 query_params = [] header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params[ 'fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params[ 'fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/types/{entityType}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='EntityTypeBody', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get( '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)
def get_attribute_data_with_http_info(self, entity_id, attr_name, **kwargs): # noqa: E501 """get_attribute_data # noqa: E501 Returns a JSON object with the attribute data of the attribute. The object follows the JSON Representation for attributes (described in [JSON Entity Representation](https://fiware.github.io/specifications/ngsiv2/stable) section). Response: * Successful operation uses 200 OK. * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_attribute_data_with_http_info(entity_id, attr_name, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str entity_id: Id of the entity (required) :param str attr_name: Name of the attribute to be retrieved. (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param str type: Entity type, to avoid ambiguity in the case there are several entities with the same entity id. :param str metadata: A list of metadata names to include in the response. See [Filtering out attributes and metadata](https://fiware.github.io/specifications/ngsiv2/stable) section for more detail. :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: tuple(Attribute, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'entity_id', 'attr_name', 'fiware_service', 'fiware_service_path', 'type', 'metadata' ] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_attribute_data" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'entity_id' is set if ('entity_id' not in local_var_params or local_var_params['entity_id'] is None): raise ApiValueError( "Missing the required parameter `entity_id` when calling `get_attribute_data`" ) # noqa: E501 # verify the required parameter 'attr_name' is set if ('attr_name' not in local_var_params or local_var_params['attr_name'] is None): raise ApiValueError( "Missing the required parameter `attr_name` when calling `get_attribute_data`" ) # noqa: E501 collection_formats = {} path_params = {} if 'entity_id' in local_var_params: path_params['entityId'] = local_var_params[ 'entity_id'] # noqa: E501 if 'attr_name' in local_var_params: path_params['attrName'] = local_var_params[ 'attr_name'] # noqa: E501 query_params = [] if 'type' in local_var_params: query_params.append( ('type', local_var_params['type'])) # noqa: E501 if 'metadata' in local_var_params: query_params.append( ('metadata', local_var_params['metadata'])) # noqa: E501 header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params[ 'fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params[ 'fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/entities/{entityId}/attrs/{attrName}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Attribute', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get( '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)
def notify_with_http_info(self, batch_notify, **kwargs): # noqa: E501 """notify # noqa: E501 This operation is intended to consume a notification payload so that all the entity data included by such notification is persisted, overwriting if necessary. This operation is useful when one NGSIv2 endpoint is subscribed to another NGSIv2 endpoint (federation scenarios). The request payload must be an NGSIv2 notification payload. The behaviour must be exactly the same as POST /v2/op/update with actionType equal to append. Response code: * Successful operation uses 200 OK * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.notify_with_http_info(batch_notify, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param BatchNotify batch_notify: (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param str options: Options dictionary :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: None If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'batch_notify', 'fiware_service', 'fiware_service_path', 'options' ] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method notify" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'batch_notify' is set if ('batch_notify' not in local_var_params or local_var_params['batch_notify'] is None): raise ApiValueError( "Missing the required parameter `batch_notify` when calling `notify`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'options' in local_var_params: query_params.append( ('options', local_var_params['options'])) # noqa: E501 header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params[ 'fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params[ 'fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'batch_notify' in local_var_params: body_params = local_var_params['batch_notify'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/op/notify', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get( '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)
def update_with_http_info(self, batch_update, **kwargs): # noqa: E501 """update # noqa: E501 This operation allows to create, update and/or delete several entities in a single batch operation. The payload is an object with two properties: + `actionType`, to specify the kind of update action to do: either `append`, `appendStrict`, `update`, `delete`. + `entities`, an array of entities, each one specified using the JSON entity Representation format (described in the section [JSON Entity Representation](https://fiware.github.io/specifications/ngsiv2/stable)). Response: * Successful operation uses 204 No Content. * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_with_http_info(batch_update, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param BatchUpdate batch_update: (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param str options: Options dictionary :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: None If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'batch_update', 'fiware_service', 'fiware_service_path', 'options' ] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'batch_update' is set if ('batch_update' not in local_var_params or local_var_params['batch_update'] is None): raise ApiValueError( "Missing the required parameter `batch_update` when calling `update`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'options' in local_var_params: query_params.append( ('options', local_var_params['options'])) # noqa: E501 header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params[ 'fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params[ 'fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'batch_update' in local_var_params: body_params = local_var_params['batch_update'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/op/update', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get( '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)
def query_with_http_info(self, batch_query, **kwargs): # noqa: E501 """query # noqa: E501 The response payload is an Array containing one object per matching entity, or an empty array `[]` if no entities are found. The entities follow the JSON entity Representation format (described in the section [JSON Entity Representation](https://fiware.github.io/specifications/ngsiv2/stable)). The payload may contain the following elements (all of them optional): + `entities`: a list of entites to search for. Each element is represented by a JSON object with the following elements: + `id` or `idPattern`: Id or pattern of the affected entities. Both cannot be used at the same time, but at least one of them must be present. + `type` or `typePattern`: Type or type pattern of the entities to search for. Both cannot be used at the same time. If omitted, it means \"any entity type\". + `attributes`: a list of attribute names to search for. If omitted, it means \"all attributes\". Response code: * Successful operation uses 200 OK * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.query_with_http_info(batch_query, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param BatchQuery batch_query: (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param int limit: Limit the number of entities to be retrieved. :param int offset: Skip a number of records. :param str order_by: Criteria for ordering results. See \"Ordering Results\" section for details. :param str options: Options dictionary :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: tuple(list[Entity], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'batch_query', 'fiware_service', 'fiware_service_path', 'limit', 'offset', 'order_by', 'options' ] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method query" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'batch_query' is set if ('batch_query' not in local_var_params or local_var_params['batch_query'] is None): raise ApiValueError( "Missing the required parameter `batch_query` when calling `query`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'limit' in local_var_params: query_params.append( ('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params: query_params.append( ('offset', local_var_params['offset'])) # noqa: E501 if 'order_by' in local_var_params: query_params.append( ('orderBy', local_var_params['order_by'])) # noqa: E501 if 'options' in local_var_params: query_params.append( ('options', local_var_params['options'])) # noqa: E501 header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params[ 'fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params[ 'fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'batch_query' in local_var_params: body_params = local_var_params['batch_query'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/op/query', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Entity]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get( '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)
def update_attribute_value_with_http_info(self, entity_id, attr_name, request_body, **kwargs): # noqa: E501 """update_attribute_value # noqa: E501 The request payload is the new attribute value. * If the request payload MIME type is `application/json`, then the value of the attribute is set to the JSON object or array coded in the payload (if the payload is not a valid JSON document, then an error is returned). * If the request payload MIME type is `text/plain`, then the following algorithm is applied to the payload: * If the payload starts and ends with citation-marks (`\"`), the value is taken as a string (the citation marks themselves are not considered part of the string) * If `true` or `false`, the value is taken as a boolean. * If `null`, the value is taken as null. * If these first three tests 'fail', the text is interpreted as a number. * If not a valid number, then an error is returned and the attribute's value is unchanged. The payload MIME type in the request is specified in the `Content-Type` HTTP header. Response: * Successful operation uses 204 No Content * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_attribute_value_with_http_info(entity_id, attr_name, request_body, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str entity_id: Id of the entity to be updated. (required) :param str attr_name: Attribute name. (required) :param dict(str, object) request_body: (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param str type: Entity type, to avoid ambiguity in the case there are several entities with the same entity id. :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: None If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['entity_id', 'attr_name', 'request_body', 'fiware_service', 'fiware_service_path', 'type'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_attribute_value" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'entity_id' is set if ('entity_id' not in local_var_params or local_var_params['entity_id'] is None): raise ApiValueError("Missing the required parameter `entity_id` when calling `update_attribute_value`") # noqa: E501 # verify the required parameter 'attr_name' is set if ('attr_name' not in local_var_params or local_var_params['attr_name'] is None): raise ApiValueError("Missing the required parameter `attr_name` when calling `update_attribute_value`") # noqa: E501 # verify the required parameter 'request_body' is set if ('request_body' not in local_var_params or local_var_params['request_body'] is None): raise ApiValueError("Missing the required parameter `request_body` when calling `update_attribute_value`") # noqa: E501 collection_formats = {} path_params = {} if 'entity_id' in local_var_params: path_params['entityId'] = local_var_params['entity_id'] # noqa: E501 if 'attr_name' in local_var_params: path_params['attrName'] = local_var_params['attr_name'] # noqa: E501 query_params = [] if 'type' in local_var_params: query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params['fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params['fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'request_body' in local_var_params: body_params = local_var_params['request_body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json', 'plain/text']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/entities/{entityId}/attrs/{attrName}/value', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)
def create_registrations_with_http_info(self, registration_body, **kwargs): # noqa: E501 """create_registrations # noqa: E501 Creates a new context provider registration. This is typically used for binding context sources as providers of certain data. The registration is represented by a JSON object as described at the beginning of this section. Response: * Successful operation uses 201 Created * Errors use a non-2xx and (optionally) an error payload. See subsection on [Error Responses](https://fiware.github.io/specifications/ngsiv2/stable) for more details. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_registrations_with_http_info(registration_body, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param RegistrationBody registration_body: (required) :param str fiware_service: When \"-multiservice\" is used, Orion uses the \"Fiware-Service\" HTTP header in the request to identify the service/tenant. If the header is not present in the HTTP request, the default service/tenant is used.. :param str fiware_service_path: Fiware-ServicePath is an optional header. It is assumed that all the entities created without Fiware-ServicePath (or that don't include service path information in the database) belongs to a root scope \"/\" implicitely. :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: None If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['registration_body', 'fiware_service', 'fiware_service_path'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_registrations" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'registration_body' is set if ('registration_body' not in local_var_params or local_var_params['registration_body'] is None): raise ApiValueError("Missing the required parameter `registration_body` when calling `create_registrations`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} if 'fiware_service' in local_var_params: header_params['Fiware-Service'] = local_var_params['fiware_service'] # noqa: E501 if 'fiware_service_path' in local_var_params: header_params['Fiware-ServicePath'] = local_var_params['fiware_service_path'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'registration_body' in local_var_params: body_params = local_var_params['registration_body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['ApiKeyAuth', 'BearerAuth'] # noqa: E501 return self.api_client.call_api( '/registrations', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)