# Source code for api.system.components.configuration.v1.host

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

    @register_command(extending=('system','components','configuration','v1','host'))
    def list(search: str = None, orderDesc: bool = None, includeComments: bool = 'True', includeDeleted: bool = 'True', offset: int = 0, limit: int = 25, orderBy: str = 'name',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List configuration hosts (INTERNAL)

        :param str search: Limit results to hosts matching this searchstring
        :param bool orderDesc: Sort results descending
        :param bool includeComments: Include comments in output
        :param bool includeDeleted: Include deleted hosts in results
        :param int offset: Offset results
        :param int limit: Limit results
        :param str orderBy: Sort results
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 285, "limit": 779, "responseCode": 200, "count": 136, "data": [{"id": 295, "name": "Michelle Morgan", "flags": 240, "scheduledDowntimeFrom": 67, "scheduledDowntimeTo": 637, "created": 219, "lastUpdatedTimestamp": 829694226, "lastUpdatedByUser": {"id": 639, "customerID": 492, "userName": "patriciahernandez", "name": "Rebecca Martinez"}, "information": "Truth miss employee condition role.", "comments": [{"timestamp": 1425741093, "comment": "Scene performance various turn."}], "properties": {"additionalProperties": "Pull pretty feeling crime develop seek community back."}}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Yes officer natural strategy imagine firm.", "messageTemplate": "Or skill they side.", "field": "Line against card represent represent trouble.", "parameter": {}, "timestamp": 1040876555}], "currentPage": 917, "size": 244}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host".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 includeComments:
            body.update({"includeComments": includeComments})

        if includeDeleted:
            body.update({"includeDeleted": includeDeleted})

        if offset:
            body.update({"offset": offset})

        if limit:
            body.update({"limit": limit})

        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

    @register_command(extending=('system','components','configuration','v1','host'))
    def create(name: str = None, information: str = None, properties: dict = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Create new configuration host (INTERNAL)

        :param str name: [a-zA-Z0-9_\-\.]*
        :param str information: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
        :param dict properties:
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 252, "limit": 353, "responseCode": 200, "count": 709, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Necessary save until side allow interest.", "messageTemplate": "Moment control maintain grow build consumer amount see.", "field": "Certainly soldier painting attack.", "parameter": {}, "timestamp": 78767406}], "currentPage": 204, "size": 545}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host".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 name:
            body.update({"name": name})

        if information:
            body.update({"information": information})

        if properties:
            body.update({"properties": properties})

        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

    @register_command(extending=('system','components','configuration','v1','host'))
    def search(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, searchString: str = None, sortBy: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeComments: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search configuration hosts (INTERNAL)

        :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 str searchString:
        :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).
        :param bool includeComments:
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 928, "limit": 502, "responseCode": 200, "count": 652, "data": [{"id": 421, "name": "Cody Oneill", "flags": 155, "scheduledDowntimeFrom": 955, "scheduledDowntimeTo": 346, "created": 678, "lastUpdatedTimestamp": 1052364224, "lastUpdatedByUser": {"id": 514, "customerID": 615, "userName": "xbarry", "name": "Natasha Thornton"}, "information": "Star blue outside during.", "comments": [{"timestamp": 312656843, "comment": "Brother let member us same south."}], "properties": {"additionalProperties": "Force pattern clearly must past suffer."}}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Factor interview great mother collection power.", "messageTemplate": "Movie purpose together behavior religious rather challenge.", "field": "Consumer member like your her.", "parameter": {}, "timestamp": 215913225}], "currentPage": 450, "size": 424}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/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 searchString:
            body.update({"searchString": searchString})

        if includeComments:
            body.update({"includeComments": includeComments})

        if sortBy:
            body.update({"sortBy": sortBy})

        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

    @register_command(extending=('system','components','configuration','v1','host'))
    def update(hostID: int, id: int = None, name: str = None, information: str = None, properties: dict = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Update configuration host (INTERNAL)

        :param int hostID: ID of host to update
        :param int id:
        :param str name: [a-zA-Z0-9_\-\.]*
        :param str information: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
        :param dict properties:
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 345, "limit": 845, "responseCode": 200, "count": 787, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Book tonight artist share reality.", "messageTemplate": "Successful management close radio be life discuss.", "field": "Court country last read big degree bag.", "parameter": {}, "timestamp": 190640983}], "currentPage": 327, "size": 617}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{hostID}".format(hostID=hostID)
        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 id:
            body.update({"id": id})

        if name:
            body.update({"name": name})

        if information:
            body.update({"information": information})

        if properties:
            body.update({"properties": properties})

        response = put(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

    @register_command(extending=('system','components','configuration','v1','host'))
    def duplicate(hostID: int, packagename: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Create default instances on configuration host (INTERNAL)

        :param int hostID: ID of host to add instances to
        :param str packagename: Instance package names
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{hostID}/setupdefault".format(hostID=hostID)
        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 packagename:
            body.update({"packagename": packagename})

        response = put(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

    @register_command(extending=('system','components','configuration','v1','host'))
    def view(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch configuration host (INTERNAL)

        :param int id: ID of host to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 373, "limit": 194, "responseCode": 200, "count": 518, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Help exist spend dinner.", "messageTemplate": "Study art dinner we suggest.", "field": "Yes ago answer protect clear.", "parameter": {}, "timestamp": 1430475026}], "currentPage": 115, "size": 557}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{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 = {}

        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

    @register_command(extending=('system','components','configuration','v1','host'))
    def delete(id: int, deleteInstances: bool = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete configuration host (INTERNAL)

        :param int id: ID of host to delete
        :param bool deleteInstances: If true, force deletion of instances for this host first
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 609, "limit": 339, "responseCode": 200, "count": 104, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Structure public trade cause discussion report coach go.", "messageTemplate": "Political south its exactly.", "field": "Happen exist do defense situation.", "parameter": {}, "timestamp": 475892699}], "currentPage": 510, "size": 458}
        """
        from requests import delete
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{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 deleteInstances:
            body.update({"deleteInstances": deleteInstances})

        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

    @register_command(extending=('system','components','configuration','v1','host'))
    def add_comment(id: int, body: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Add a comment to configuration host (INTERNAL)

        :param int id: ID of host to comment
        :param  body: Comment
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 953, "limit": 921, "responseCode": 200, "count": 824, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Member civil material decade bill.", "messageTemplate": "Try not crime rule always apply.", "field": "Opportunity spend civil.", "parameter": {}, "timestamp": 1088999593}], "currentPage": 533, "size": 939}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{id}/comment".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 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

    @register_command(extending=('system','components','configuration','v1','host'))
    def disable_monitoring(id: int, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Disable monitoring of configuration host (INTERNAL)

        :param int id: ID of host to disable monitoring on
        :param str comment: Reason for disabling monitoring
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 62, "limit": 711, "responseCode": 200, "count": 555, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Lot word win perhaps late drop.", "messageTemplate": "Least discussion crime west along.", "field": "Present side necessary hand population.", "parameter": {}, "timestamp": 229135525}], "currentPage": 330, "size": 594}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{id}/monitoring/disable".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 comment:
            body.update({"comment": comment})

        response = put(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

    @register_command(extending=('system','components','configuration','v1','host'))
    def enable_monitoring(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Enable monitoring of configuration host (INTERNAL)

        :param int id: ID of host to enable monitoring on
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 532, "limit": 350, "responseCode": 200, "count": 783, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Much car military.", "messageTemplate": "Professional company he forget once door pattern.", "field": "Whom watch local take than everybody step.", "parameter": {}, "timestamp": 606029131}], "currentPage": 462, "size": 717}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{id}/monitoring/enable".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 = put(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

    @register_command(extending=('system','components','configuration','v1','host'))
    def schedule_monitoring(id: int, _from: int = None, to: int = None, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Schedule downtime for configuration host (INTERNAL)

        :param int id: ID of host to schedule downtime for
        :param int from: Timestamp to schedule downtime from
        :param int to: Timestamp to schedule downtime to
        :param str comment: Reason for scheduling downtime
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 270, "limit": 949, "responseCode": 200, "count": 240, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Help near while human once have.", "messageTemplate": "System authority memory discussion.", "field": "Others tree southern history federal citizen.", "parameter": {}, "timestamp": 1334121667}], "currentPage": 18, "size": 12}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/host/{id}/monitoring/schedule".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 _from:
            body.update({"from": _from})

        if to:
            body.update({"to": to})

        if comment:
            body.update({"comment": comment})

        response = put(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