Source code for api.datastores.v1.store.store

"""Autogenerated API"""

from argus_cli.plugin import register_command



[docs]@register_command(extending=("datastores","v1","store","")) def get_entries_from_store_simplified( dataStore: str, customerID: list = None, key: list = None, offset: int = None, limit: int = 25, includeDeleted: bool = True, json: bool = True, verify: bool = True, apiKey: str = None, authentication: dict = {} ) -> dict: """Returns datastore entries for the specified store, matching query parameters. (PUBLIC) :param str dataStore: Store name :param list customerID: Limit search to entries for the specified customers :param list key: Limit search to the specified entry keys :param int offset: Skip a number of results :param int limit: Maximum number of returned results :param bool includeDeleted: Include deleted/expired keys :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises StoreNotFoundException: on 404 :returns: {'offset': 728, 'limit': 321, 'responseCode': 200, 'count': 666, 'data': [{'dataStoreName': 'Seem end individual there understand medical.', 'lastUpdatedTimestamp': 1501433753, 'lastUpdatedByUser': {'id': 629, 'customerID': 278, 'userName': 'qeverett', 'name': 'John Jordan'}, 'key': 'Commercial listen main.', 'value': 'Control still what into month.', 'flags': ['DELETED']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Find modern Mrs never north time.', 'messageTemplate': 'Age quickly accept create.', 'field': 'Fall fact yeah nearly according community yourself.', 'parameter': {}, 'timestamp': 1293946015}], 'currentPage': 399, 'size': 970} """ from requests import get from argus_api.exceptions import http url = "https://portal.mnemonic.no/web/api/datastores/v1/store/{dataStore}".format(dataStore=dataStore) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "offset": offset, "limit": limit, "includeDeleted": includeDeleted, "customerID": customerID, "key": key } response = get(url, json=body if body else None, verify=verify, headers=headers ) if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=("datastores","v1","store","")) def put_data_store_entries( dataStore: str, customerID: int = None, entries: list = None, json: bool = True, verify: bool = True, apiKey: str = None, authentication: dict = {} ) -> dict: """Updates the provided datastore entries for the specified store. (PUBLIC) :param str dataStore: Store name :param int customerID: ID of customer to bind data to. If not set, default is to bind to the current users customer (or none, if datastore is global) :param list entries: Entries to add :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises StoreNotFoundException: on 404 :returns: {'offset': 860, 'limit': 412, 'responseCode': 200, 'count': 93, 'data': [{'dataStoreName': 'True early truth left population.', 'lastUpdatedTimestamp': 1278211288, 'lastUpdatedByUser': {'id': 84, 'customerID': 333, 'userName': 'pjones', 'name': 'Andrew Mueller'}, 'key': 'Yourself down child age always.', 'value': 'Hit beautiful low.', 'flags': ['DELETED']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Wide matter plan.', 'messageTemplate': 'Goal others interview describe.', 'field': 'Top anyone involve resource.', 'parameter': {}, 'timestamp': 1374768256}], 'currentPage': 917, 'size': 85} """ from requests import put from argus_api.exceptions import http url = "https://portal.mnemonic.no/web/api/datastores/v1/store/{dataStore}".format(dataStore=dataStore) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "customerID": customerID, "entries": entries } response = put(url, json=body if body else None, verify=verify, headers=headers ) if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=("datastores","v1","store","")) def delete_data_store_entries( dataStore: str, key: list = None, customerID: int = None, json: bool = True, verify: bool = True, apiKey: str = None, authentication: dict = {} ) -> dict: """Deletes the specified datastore entries for the specified store. (PUBLIC) :param str dataStore: Store name :param list key: Datastore keys to delete :param int customerID: Specify datastore to delete entries from (default is users customer) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises StoreNotFoundException: on 404 :returns: {'offset': 604, 'limit': 346, 'responseCode': 200, 'count': 67, 'data': [{'dataStoreName': 'Various eye personal start.', 'lastUpdatedTimestamp': 456144997, 'lastUpdatedByUser': {'id': 538, 'customerID': 219, 'userName': 'ricelouis', 'name': 'Frederick Francis'}, 'key': 'Right former behavior somebody.', 'value': 'Majority official piece.', 'flags': ['DELETED']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Especially reflect institution memory ago place.', 'messageTemplate': 'Pretty include trip.', 'field': 'Better majority example police hold.', 'parameter': {}, 'timestamp': 1300688137}], 'currentPage': 949, 'size': 897} """ from requests import delete from argus_api.exceptions import http url = "https://portal.mnemonic.no/web/api/datastores/v1/store/{dataStore}".format(dataStore=dataStore) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "key": key, "customerID": customerID } response = delete(url, json=body if body else None, verify=verify, headers=headers ) if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=("datastores","v1","store","")) def get_entries_from_store( dataStore: str, limit: int = None, offset: int = None, subCriteria: list = None, customerID: list = None, userID: list = None, key: list = None, fromKey: str = None, toKey: str = None, startTimestamp: int = None, endTimestamp: int = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = None, exclude: bool = None, required: bool = None, json: bool = True, verify: bool = True, apiKey: str = None, authentication: dict = {} ) -> dict: """Returns datastore entries for the specified store, matching the search criteria. (PUBLIC) :param str dataStore: Store name :param int limit: Set this value to set max number of results. By default, no restriction on result set size. :param int offset: Set this value to skip the first (offset) objects. By default, return result from first object. :param list subCriteria: :param list customerID: Restrict search to data belonging to specified customers. :param list userID: Restrict search to entries which was last updated by specified users. :param list key: Restrict search to the specified key (entries). :param str fromKey: Restrict search to entries (map keys) which are greater than this key (including, by lexical order). :param str toKey: Restrict search to entries (map keys) which are less than this key (including, by lexical order). :param int startTimestamp: Restrict search to entries which are last updated after this timestamp (including). :param int endTimestamp: Restrict search to entries which are last updated before this timestamp (including). :param list sortBy: List of properties to sort by (prefix with "-" to sort descending). :param list includeFlags: Only include objects which have includeFlags set. :param list excludeFlags: Exclude objects which have excludeFlags set. :param bool includeDeleted: Set to true to include deleted objects. By default, exclude deleted objects. :param bool exclude: Only relevant for subcriteria. If set to true, objects matching this subcriteria object will be excluded. :param bool required: Only relevant for subcriteria. If set to true, objects matching this subcriteria are required (AND-ed together with parent criteria). :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises StoreNotFoundException: on 404 :returns: {'offset': 695, 'limit': 826, 'responseCode': 200, 'count': 705, 'data': [{'dataStoreName': 'Movie morning concern.', 'lastUpdatedTimestamp': 1379177680, 'lastUpdatedByUser': {'id': 467, 'customerID': 816, 'userName': 'iwilson', 'name': 'Jeffrey Stewart'}, 'key': 'Cold across crime social.', 'value': 'Performance simply word system modern exactly.', 'flags': ['DELETED']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Line rate morning seem main future policy turn.', 'messageTemplate': 'Fund window song remember quickly despite success deal.', 'field': 'Game wear safe western despite yourself nothing.', 'parameter': {}, 'timestamp': 983908002}], 'currentPage': 708, 'size': 24} """ from requests import post from argus_api.exceptions import http url = "https://portal.mnemonic.no/web/api/datastores/v1/store/{dataStore}/search".format(dataStore=dataStore) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "limit": limit, "offset": offset, "includeDeleted": includeDeleted, "subCriteria": subCriteria, "exclude": exclude, "required": required, "customerID": customerID, "userID": userID, "key": key, "fromKey": fromKey, "toKey": toKey, "startTimestamp": startTimestamp, "endTimestamp": endTimestamp, "sortBy": sortBy, "includeFlags": includeFlags, "excludeFlags": excludeFlags } response = post(url, json=body if body else None, verify=verify, headers=headers ) if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=("datastores","v1","store","")) def get_single_entry( dataStore: str, key: str, customerID: int = None, includeDeleted: bool = True, json: bool = True, verify: bool = True, apiKey: str = None, authentication: dict = {} ) -> dict: """Returns the specified datastore entry for the specified store, or null if it does not exist (PUBLIC) :param str dataStore: Store name :param str key: Key to search :param int customerID: Search specified customer store for this key (default is users customer) :param bool includeDeleted: Include deleted/expired key :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises StoreNotFoundException: on 404 :returns: {'offset': 215, 'limit': 586, 'responseCode': 200, 'count': 566, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Someone true prevent body.', 'messageTemplate': 'Property career finally dark current.', 'field': 'City born east one write maybe person.', 'parameter': {}, 'timestamp': 598061804}], 'currentPage': 815, 'size': 289} """ from requests import get from argus_api.exceptions import http url = "https://portal.mnemonic.no/web/api/datastores/v1/store/{dataStore}/{key}".format(dataStore=dataStore, key=key) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "includeDeleted": includeDeleted, "customerID": customerID } response = get(url, json=body if body else None, verify=verify, headers=headers ) if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=("datastores","v1","store","")) def put_single_data_store_entry( dataStore: str, key: str, customerID: int = None, json: bool = True, verify: bool = True, apiKey: str = None, authentication: dict = {} ) -> dict: """Adds the provided datastore entry for the specified store. To use for lists (key, no value) (PUBLIC) :param str dataStore: Store name :param str key: Datastore key to set :param int customerID: Specify datastore to put entry to (default is users customer) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises StoreNotFoundException: on 404 :returns: {'offset': 254, 'limit': 546, 'responseCode': 200, 'count': 161, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Show design hold town suddenly let.', 'messageTemplate': 'Not paper suggest realize nice.', 'field': 'Large include page guy eat.', 'parameter': {}, 'timestamp': 1366589543}], 'currentPage': 823, 'size': 644} """ from requests import put from argus_api.exceptions import http url = "https://portal.mnemonic.no/web/api/datastores/v1/store/{dataStore}/{key}".format(dataStore=dataStore, key=key) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "customerID": customerID } response = put(url, json=body if body else None, verify=verify, headers=headers ) if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response