Source code for api.system.components.code.v1.artifact

"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command


[docs]@register_command(extending=('system','components','code','v1','artifact')) def list(search: str = None, orderDesc: bool = None, limit: int = 25, offset: int = 0, orderBy: str = 'groupID',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List code artifacts (INTERNAL) :param str search: Limit result to artifacts matching this search string :param bool orderDesc: Sort results descending :param int limit: Limit result :param int offset: Offset result :param str orderBy: Order result :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 560, "limit": 787, "responseCode": 200, "count": 789, "data": [{"id": "Society occur they impact.", "groupID": "Loss learn size fall measure this how.", "artifactID": "Yeah interview day teach check history dog.", "version": "Central never adult under argue theory degree.", "flags": 717, "status": "DELETED", "createdTimestamp": 1116810724, "lastUpdatedTimestamp": 1095938355, "createdByUser": {"id": 787, "customerID": 725, "userName": "pageglenn", "name": "Matthew Peterson"}, "lastUpdatedByUser": {"id": 502, "customerID": 294, "userName": "tammy77", "name": "Jason Miller"}, "length": 603, "data": "Police protect third red."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Look use see not treat.", "messageTemplate": "Evidence if dinner win indeed like receive.", "field": "Black choice industry sort.", "parameter": {}, "timestamp": 127938807}], "currentPage": 252, "size": 162} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact".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 orderBy: body.update({"orderBy": orderBy}) if search: body.update({"search": search}) if orderDesc: body.update({"orderDesc": orderDesc}) 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=('system','components','code','v1','artifact')) def create(groupID: str = None, artifactID: str = None, version: str = None, data: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Add new code artifact (INTERNAL) (INTERNAL) :param str groupID: [a-zA-Z0-9_\-\.]* :param str artifactID: [a-zA-Z0-9_\-\.]* :param str version: [a-zA-Z0-9_\-\.]* :param str data: :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 355, "limit": 854, "responseCode": 200, "count": 779, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Five name head end clear born significant.", "messageTemplate": "Head early break capital police.", "field": "Very picture cover ahead produce use player.", "parameter": {}, "timestamp": 1191403886}], "currentPage": 619, "size": 758} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact".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 groupID: body.update({"groupID": groupID}) if artifactID: body.update({"artifactID": artifactID}) if version: body.update({"version": version}) if data: body.update({"data": data}) 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=('system','components','code','v1','artifact')) def list_unused(json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List unused artifact (INTERNAL) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 33, "limit": 194, "responseCode": 200, "count": 448, "data": [{"id": "First hand ago film word head family Congress.", "groupID": "Move well group ago Democrat.", "artifactID": "Price than stage first include admit maybe.", "version": "Pull society teach push.", "flags": 315, "status": "ACTIVE", "createdTimestamp": 692361631, "lastUpdatedTimestamp": 171887021, "createdByUser": {"id": 81, "customerID": 98, "userName": "michael29", "name": "Karla White"}, "lastUpdatedByUser": {"id": 936, "customerID": 540, "userName": "cookvincent", "name": "Haley Doyle"}, "length": 590, "data": "Herself blue away blue between."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Something trade house score dark another official.", "messageTemplate": "Keep stuff safe safe.", "field": "Newspaper rule campaign they production despite per.", "parameter": {}, "timestamp": 1333704878}], "currentPage": 299, "size": 350} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/unused".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 = {} 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=('system','components','code','v1','artifact')) def delete_unused(json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Mark unused artifacts as deleted (INTERNAL) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 551, "limit": 46, "responseCode": 200, "count": 874, "data": [{"id": "Nor car government as central exist figure.", "groupID": "Moment create her live trial.", "artifactID": "Success common next country scientist.", "version": "Strong accept future Democrat.", "flags": 351, "status": "DELETED", "createdTimestamp": 988482543, "lastUpdatedTimestamp": 57925875, "createdByUser": {"id": 903, "customerID": 297, "userName": "marshallrichard", "name": "Kyle Weaver"}, "lastUpdatedByUser": {"id": 395, "customerID": 679, "userName": "burnettdavid", "name": "Michelle Smith"}, "length": 213, "data": "Reveal though factor deal."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Chair the must alone subject newspaper thought serve.", "messageTemplate": "Series building economy against.", "field": "All charge police.", "parameter": {}, "timestamp": 587880147}], "currentPage": 231, "size": 640} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/unused".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 = {} response = delete(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=('system','components','code','v1','artifact')) def get_by_g_a_v(groupID: str, artifactID: str, version: str, includeData: bool = 'True',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch code artifact by groupID, artifactID and version (GAV) (INTERNAL) :param str groupID: GroupID of artifact to fetch :param str artifactID: ArtifactID of artifact to fetch :param str version: Version of artifact to fetch :param bool includeData: If true, include encoded artifact binary data :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 114, "limit": 566, "responseCode": 200, "count": 176, "metaData": {"additionalProperties": {}}, "messages": [{"message": "The health enough use upon table since.", "messageTemplate": "Rule run minute already each office because.", "field": "Pull back of.", "parameter": {}, "timestamp": 826009536}], "currentPage": 451, "size": 157} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/{groupID}/{artifactID}/{version}".format(groupID=groupID, artifactID=artifactID, version=version) 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 includeData: body.update({"includeData": includeData}) 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=('system','components','code','v1','artifact')) def create_from_octet_stream(groupID: str, artifactID: str, version: str, body: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Add new code artifact (INTERNAL) :param str groupID: Group ID :param str artifactID: Artifact ID :param str version: Version :param body: Artifact data :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 293, "limit": 572, "responseCode": 200, "count": 196, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Civil per write current action avoid.", "messageTemplate": "Media onto realize especially radio success.", "field": "Though economy light option.", "parameter": {}, "timestamp": 1361607938}], "currentPage": 96, "size": 834} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/{groupID}/{artifactID}/{version}".format(groupID=groupID, artifactID=artifactID, version=version) 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 body: body.update({"body": body}) 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=('system','components','code','v1','artifact')) def download_by_g_a_v(groupID: str, artifactID: str, version: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Download artifact by groupID, artifactID and version (GAV) (INTERNAL) :param str groupID: GroupID of artifact to fetch :param str artifactID: ArtifactID of artifact to fetch :param str version: Version of artifact to fetch :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 319, "limit": 935, "responseCode": 200, "count": 178, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Record training tonight me bank system figure.", "messageTemplate": "Money executive professor.", "field": "Manager join collection big mention attack long management.", "parameter": {}, "timestamp": 506467772}], "currentPage": 149, "size": 963} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/{groupID}/{artifactID}/{version}/download".format(groupID=groupID, artifactID=artifactID, version=version) 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=('system','components','code','v1','artifact')) def get_by_id(id: str, includeData: bool = 'True',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch code artifact by hash ID (INTERNAL) :param str id: ID of artifact to fetch :param bool includeData: If true, include encoded artifact binary data :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 993, "limit": 144, "responseCode": 200, "count": 610, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Agent our cold southern little.", "messageTemplate": "Difficult fact provide season though hand.", "field": "Necessary art run wide high exactly interest west.", "parameter": {}, "timestamp": 294027646}], "currentPage": 101, "size": 443} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/{id}".format(id=id) 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 includeData: body.update({"includeData": includeData}) 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=('system','components','code','v1','artifact')) def download_by_id(id: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Download artifact by ID (INTERNAL) :param str id: ID of artifact to fetch :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/code/v1/artifact/{id}/download".format(id=id) 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