"""Autogenerated API"""
from argus_cli.plugin import register_command
[docs]@register_command(extending=("datastores","v1","descriptor"))
def search_descriptors_simple(
keywords: list = None,
keywordField: list = None,
sortBy: list = None,
offset: int = None,
limit: int = 25,
keywordMatch: str = "all",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns an array of DataStore descriptors matching search parameters (PUBLIC)
:param list keywords: Search by keywords
:param list keywordField: Set field strategy for keyword search
:param list sortBy: Sort search result
:param int offset: Skip a number of results
:param int limit: Maximum number of returned results
:param str keywordMatch: Set match strategy for keyword search
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 518, 'limit': 658, 'responseCode': 200, 'count': 312, 'data': [{'name': 'James Pacheco', 'description': 'Black himself sense.', 'dataType': 'MAP', 'behaviourType': 'LOCAL', 'lastUpdatedTimestamp': 652063070, 'lastUpdatedByUser': {'id': 351, 'customerID': 245, 'userName': 'selena80', 'name': 'Cynthia Kelly'}, 'lifeTime': 201, 'deleted': True, 'globalData': True, 'expireData': False}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Consider quality personal.', 'messageTemplate': 'Forward popular reach price store technology name.', 'field': 'Research doctor imagine.', 'parameter': {}, 'timestamp': 881898652}], 'currentPage': 772, 'size': 442}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/datastores/v1/descriptor".format()
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,
"keywordMatch": keywordMatch,
"keywords": keywords,
"keywordField": keywordField,
"sortBy": sortBy
}
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","descriptor"))
def add_data_store_descriptor(
name: str = None,
description: str = None,
lifeTime: int = None,
behaviourType: str = "CENTRAL",
dataType: str = "MAP (key/value store)",
globalData: bool = None,
expireData: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Adds a new datastore descriptor. (PUBLIC)
:param str name: Name for new datastore. Name must be unique. => [a-zA-Z0-9_\-\.]*
:param str description: Description of the datastore. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param int lifeTime: The requested expiry time in milliseconds. Requires a positive value (if expireData is true).
:param str behaviourType: Datastore behaviour. CENTRAL stores are only updated centrally, but may be used in distributed processing. LOCAL and DISTRIBUTED stores are not stored centrally, but updated in the distributed system. DISTRIBUTED may be shared between processing nodes. (default CENTRAL)
:param str dataType: Select data type: list of values or key/value store. (default MAP (key/value store))
:param bool globalData: If true, datastore only accepts global data (not customer bound).
:param bool expireData: If true, datastore entries will expire after the configured time period since added/last updated.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 190, 'limit': 608, 'responseCode': 200, 'count': 107, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Rich food dog thousand about certainly.', 'messageTemplate': 'Seem but cut dream owner actually Republican.', 'field': 'Data child analysis media show believe.', 'parameter': {}, 'timestamp': 191829769}], 'currentPage': 814, 'size': 112}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/datastores/v1/descriptor".format()
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 = {
"behaviourType": behaviourType,
"dataType": dataType,
"name": name,
"description": description,
"globalData": globalData,
"expireData": expireData,
"lifeTime": lifeTime
}
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","descriptor"))
def search_descriptors(
limit: int = None,
offset: int = None,
includeFlags: int = None,
excludeFlags: int = None,
subCriteria: list = None,
keywords: list = None,
keywordFieldStrategy: list = None,
keywordMatchStrategy: str = None,
sortBy: list = None,
includeDeleted: bool = None,
exclude: bool = None,
required: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns an array of DataStore descriptors matching search criteria (PUBLIC)
: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 int includeFlags: Only include objects which have includeFlags set.
:param int excludeFlags: Exclude objects which have excludeFlags set.
:param list subCriteria:
:param list keywords: Search for datastores matching keyword
:param list keywordFieldStrategy: Defines which fields will be searched by keywords (default all supported fields).
:param str keywordMatchStrategy: Defines the MatchStrategy for keywords (default match all keywords).
:param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
: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
:returns: {'offset': 396, 'limit': 167, 'responseCode': 200, 'count': 297, 'data': [{'name': 'Michael Pacheco', 'description': 'Hot collection price building interest threat involve.', 'dataType': 'LIST', 'behaviourType': 'LOCAL', 'lastUpdatedTimestamp': 1101012323, 'lastUpdatedByUser': {'id': 28, 'customerID': 716, 'userName': 'theresamaxwell', 'name': 'Christopher Mckenzie'}, 'lifeTime': 652, 'deleted': False, 'globalData': True, 'expireData': False}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Rock her full whatever pass speak eat.', 'messageTemplate': 'Ball real door cover past prepare.', 'field': 'Stock in bag production.', 'parameter': {}, 'timestamp': 294090934}], 'currentPage': 973, 'size': 11}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/datastores/v1/descriptor/search".format()
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,
"includeFlags": includeFlags,
"excludeFlags": excludeFlags,
"subCriteria": subCriteria,
"exclude": exclude,
"required": required,
"keywords": keywords,
"keywordFieldStrategy": keywordFieldStrategy,
"keywordMatchStrategy": keywordMatchStrategy,
"sortBy": sortBy
}
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","descriptor"))
def get_descriptor(
dataStore: str,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns a Datastore descriptor identified by its name. (PUBLIC)
:param str dataStore: Descriptor name
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 919, 'limit': 203, 'responseCode': 200, 'count': 262, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'In form watch street million well current.', 'messageTemplate': 'Feeling store particular light.', 'field': 'Cup son be much student rise population debate.', 'parameter': {}, 'timestamp': 466354306}], 'currentPage': 634, 'size': 601}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/datastores/v1/descriptor/{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 = {
}
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","descriptor"))
def update_data_store_descriptor(
dataStore: str,
name: str = None,
description: str = None,
lifeTime: int = None,
globalData: bool = None,
expireData: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Updates an existing datastore descriptor. (PUBLIC)
:param str dataStore: Store name
:param str name: If set, request datastore to change name. All entries will be updated (so may take long time for large stores). => [a-zA-Z0-9_\-\.]*
:param str description: If set, update description on datastore. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param int lifeTime: If set (to positive value), change the expiry time for this datastore. Requires that the store has enabled expireData. Default is no change.
:param bool globalData: If set, change the global data flag on this datastore. Default is no change.
:param bool expireData: If set, change the expire data flag on this datastore. Default is no change.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises StoreNotFoundException: on 404
:returns: {'offset': 577, 'limit': 842, 'responseCode': 200, 'count': 955, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Rise work strategy example.', 'messageTemplate': 'Difficult own special.', 'field': 'Level either ahead.', 'parameter': {}, 'timestamp': 948064984}], 'currentPage': 88, 'size': 849}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/datastores/v1/descriptor/{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 = {
"name": name,
"description": description,
"globalData": globalData,
"expireData": expireData,
"lifeTime": lifeTime
}
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","descriptor"))
def delete_data_store_descriptor(
dataStore: str,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Deletes an existing datastore descriptor. (PUBLIC)
:param str dataStore: Store name
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises StoreNotFoundException: on 404
:returns: {'offset': 955, 'limit': 956, 'responseCode': 200, 'count': 384, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Project way bring.', 'messageTemplate': 'Large him include between machine.', 'field': 'Represent fly describe smile board.', 'parameter': {}, 'timestamp': 25307198}], 'currentPage': 355, 'size': 176}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/datastores/v1/descriptor/{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 = {
}
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