"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('users','v1','group'))
def list_groups(subjectID: list = None, offset: int = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Get group information (PUBLIC)
:param list subjectID: IDs of groups
:param int offset: Offset results
:param int limit: Limit results
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 587, "limit": 966, "responseCode": 200, "count": 722, "data": [{"id": 786, "customerID": 872, "description": "Different daughter economic black less coach.", "name": "Terry Lewis"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Court time policy claim physical minute let.", "messageTemplate": "Simply his consumer since really receive before affect.", "field": "Describe there somebody after board recent over.", "parameter": {}, "timestamp": 1245309271}], "currentPage": 942, "size": 450}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/users/v1/group".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if limit:
body.update({"limit": limit})
if subjectID:
body.update({"subjectID": subjectID})
if offset:
body.update({"offset": offset})
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
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=('users','v1','group'))
def find_groups(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, customerID: list = None, domain: list = None, type: str = None, subjectID: list = None, excludeSubjectID: list = None, parentID: list = None, ancestorID: list = None, get_aclAncestorID: list = None, get_aclCustomerID: list = None, excludeAncestorID: list = None, userName: list = None, email: list = None, mobile: list = None, searchString: str = None, languageID: list = None, requiredFunctionID: list = None, requiredFunctionCustomerID: int = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', requireAllFunctions: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Search group profiles (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 customerID: Restrict search to data belonging to specified customers.
:param list domain:
:param str type:
:param list subjectID:
:param list excludeSubjectID:
:param list parentID:
:param list ancestorID:
:param list get_aclAncestorID:
:param list get_aclCustomerID:
:param list excludeAncestorID:
:param list userName:
:param list email:
:param list mobile:
:param str searchString:
:param list languageID:
:param list requiredFunctionID:
:param int requiredFunctionCustomerID:
: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).
:param bool requireAllFunctions:
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 703, "limit": 827, "responseCode": 200, "count": 912, "data": [{"id": 153, "userName": "tina97", "name": "Cory Sanders", "createdTimestamp": 548123974, "createdByUser": {"id": 625, "customerID": 933, "userName": "figueroaeric", "name": "Victoria Stone"}, "lastUpdatedTimestamp": 1394459918, "lastUpdatedByUser": {"id": 616, "customerID": 978, "userName": "adamsgregory", "name": "Amanda Roberts"}, "properties": {"additionalProperties": "Voice general risk water doctor control."}, "groupName": "Budget friend animal my current new of.", "description": "Discussion short available break.", "ascendantIDs": [1000], "flags": ["AUTH_APIKEY"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Yard morning nature just great hard else.", "messageTemplate": "Those dream structure stop president to type.", "field": "Collection position notice make else.", "parameter": {}, "timestamp": 1493877256}], "currentPage": 658, "size": 489}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/users/v1/group/search".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
if limit:
body.update({"limit": limit})
if offset:
body.update({"offset": offset})
if includeDeleted:
body.update({"includeDeleted": includeDeleted})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
if subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if customerID:
body.update({"customerID": customerID})
if domain:
body.update({"domain": domain})
if type:
body.update({"type": type})
if subjectID:
body.update({"subjectID": subjectID})
if excludeSubjectID:
body.update({"excludeSubjectID": excludeSubjectID})
if parentID:
body.update({"parentID": parentID})
if ancestorID:
body.update({"ancestorID": ancestorID})
if get_aclAncestorID:
body.update({"get_aclAncestorID": get_aclAncestorID})
if get_aclCustomerID:
body.update({"get_aclCustomerID": get_aclCustomerID})
if excludeAncestorID:
body.update({"excludeAncestorID": excludeAncestorID})
if userName:
body.update({"userName": userName})
if email:
body.update({"email": email})
if mobile:
body.update({"mobile": mobile})
if searchString:
body.update({"searchString": searchString})
if languageID:
body.update({"languageID": languageID})
if requiredFunctionID:
body.update({"requiredFunctionID": requiredFunctionID})
if requiredFunctionCustomerID:
body.update({"requiredFunctionCustomerID": requiredFunctionCustomerID})
if requireAllFunctions:
body.update({"requireAllFunctions": requireAllFunctions})
response = post(url, json=body if body else None, verify=verify, headers=headers)
errors = []
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=('users','v1','group'))
def get_gropu_by_id(groupId: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Get group profile by ID (PUBLIC)
:param int groupId: ID of group
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 576, "limit": 185, "responseCode": 200, "count": 727, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Standard method station professor writer radio voice.", "messageTemplate": "Instead reach purpose live at front.", "field": "Agent much moment time.", "parameter": {}, "timestamp": 826550696}], "currentPage": 665, "size": 402}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/users/v1/group/{groupId}".format(groupId=groupId)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
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)
errors = []
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=('users','v1','group'))
def get_group_by_name(groupName: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Get group profile by name (PUBLIC)
:param str groupName: Group shortname
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 230, "limit": 948, "responseCode": 200, "count": 56, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Maybe blue will majority.", "messageTemplate": "None fine memory.", "field": "Chair skill fly.", "parameter": {}, "timestamp": 1021234115}], "currentPage": 688, "size": 580}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/users/v1/group/{groupName}".format(groupName=groupName)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
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)
errors = []
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