# Source code for api.system.components.runtime.v1.host.cachedconfigurations.host_cachedconfigurations_clear

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

    @register_command(extending=('system','components','runtime','v1','host','cachedconfigurations','clear'))
    def clear_cached_configurations(hostID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Clear all installed configurations on this host (INTERNAL)

        :param int hostID: ID of host to clear
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 929, "limit": 702, "responseCode": 200, "count": 307, "data": [{"id": 685, "flags": 743, "scheduledDowntimeFrom": 646, "scheduledDowntimeTo": 685, "revision": 620, "masterID": 848, "createdTimestamp": 942730712, "lastUpdatedTimestamp": 595774267, "lastUpdatedByUser": {"id": 332, "customerID": 166, "userName": "cblevins", "name": "Christopher Robinson"}, "information": "Back herself practice our game.", "properties": {"additionalProperties": "Sign sell history part choose."}, "identifiers": {"additionalProperties": "Management least pressure under month poor water."}, "comments": [{"timestamp": 637259198, "comment": "Back identify view series."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Brother build measure.", "messageTemplate": "Travel indeed order sing second prepare.", "field": "Look major first charge certainly.", "parameter": {}, "timestamp": 50723792}], "currentPage": 534, "size": 582}
        """
        from requests import put
        from argus_api.exceptions import http

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

        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','runtime','v1','host','cachedconfigurations','clear'))
    def install_all(hostID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Install all defined configurations defined for this host (INTERNAL)

        :param int hostID: ID of host to install on
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 813, "limit": 618, "responseCode": 200, "count": 537, "data": [{"id": 182, "flags": 547, "scheduledDowntimeFrom": 147, "scheduledDowntimeTo": 300, "revision": 862, "masterID": 709, "createdTimestamp": 980310256, "lastUpdatedTimestamp": 113279214, "lastUpdatedByUser": {"id": 491, "customerID": 570, "userName": "wendyrosario", "name": "Jenny Bell"}, "information": "During most not manager.", "properties": {"additionalProperties": "Early material sign option fear."}, "identifiers": {"additionalProperties": "Notice quite type address suggest."}, "comments": [{"timestamp": 1148157190, "comment": "Share contain for five."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "It mission like reduce seat.", "messageTemplate": "Even receive free quite power apply remember.", "field": "Security day east thus director around across available.", "parameter": {}, "timestamp": 878723711}], "currentPage": 598, "size": 40}
        """
        from requests import put
        from argus_api.exceptions import http

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

        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','runtime','v1','host','cachedconfigurations','clear'))
    def list_persistent_components(hostID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List persistent components on host (INTERNAL)

        :param int hostID: ID of host to fetch list from
        :raises AuthenticationFailedException: on 401
        :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/runtime/v1/host/{hostID}/persistence".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 = {}

        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','runtime','v1','host','cachedconfigurations','clear'))
    def compact_persistence(hostID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Initiate compacting of persistence database on host (INTERNAL)

        :param int hostID: ID of host to fetch list from
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 112, "limit": 554, "responseCode": 200, "count": 174, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Paper most their hand marriage leader too war.", "messageTemplate": "Let program catch growth front season American.", "field": "Meet better property information.", "parameter": {}, "timestamp": 475183925}], "currentPage": 271, "size": 47}
        """
        from requests import put
        from argus_api.exceptions import http

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

        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','runtime','v1','host','cachedconfigurations','clear'))
    def reboot(hostID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Reboot host (INTERNAL)

        :param int hostID: ID of host to reboot
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 534, "limit": 460, "responseCode": 200, "count": 381, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Admit kind hand kitchen sign.", "messageTemplate": "Matter before maintain use treatment cause.", "field": "Coach plan they control why lawyer who.", "parameter": {}, "timestamp": 1304165437}], "currentPage": 323, "size": 125}
        """
        from requests import put
        from argus_api.exceptions import http

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

        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','runtime','v1','host','cachedconfigurations','clear'))
    def refresh_host_status(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Request all components on specified host to immediately refresh status (INTERNAL)

        :param int id: ID of host to request update from
        :raises AuthenticationFailedException: on 401
        :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/runtime/v1/host/{id}/status/refresh".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