# Source code for api.system.components.runtime.v1.instance.instance_install

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

    @register_command(extending=('system','components','runtime','v1','instance','install'))
    def install(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Install configuration for instance (INTERNAL)

        :param int id: ID of instance to install
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"exact": true, "identifiers": {"additionalProperties": "Across side behavior."}}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/instance/{id}/install".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','runtime','v1','instance','install'))
    def get_container_performance(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch performance details from specified component (INTERNAL)

        :param int id: ID of instance to fetch performance data 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/instance/{id}/performance".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','runtime','v1','instance','install'))
    def reboot(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Reboot runtime instance (INTERNAL)

        :param int id: ID of instance to reboot
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 874, "limit": 53, "responseCode": 200, "count": 323, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Clearly enjoy natural dark structure.", "messageTemplate": "Together against south bar yeah.", "field": "Yes without lot gas discover support political.", "parameter": {}, "timestamp": 1287615532}], "currentPage": 177, "size": 637}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/instance/{id}/reboot".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','runtime','v1','instance','install'))
    def start(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Initiate runtime instance (INTERNAL)

        :param int id: ID of instance to start
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 334, "limit": 819, "responseCode": 200, "count": 934, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Direction you democratic young edge get.", "messageTemplate": "Far apply own try give.", "field": "Difficult agency modern represent power you tough.", "parameter": {}, "timestamp": 1422204457}], "currentPage": 125, "size": 611}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/instance/{id}/start".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','runtime','v1','instance','install'))
    def get_instance_status(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch status for specified component (INTERNAL)

        :param int id: ID of host to fetch status for
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"installedInstanceRevision": 2, "installedTemplateRevision": 864, "templateID": 694, "instanceID": 50, "templateName": "Inside wide hold reduce.", "monitored": true, "inDowntime": true}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/instance/{id}/status".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','runtime','v1','instance','install'))
    def refresh_instance_status(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Request specified component to immediately refresh status (INTERNAL)

        :param int id: ID of component 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/instance/{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

    @register_command(extending=('system','components','runtime','v1','instance','install'))
    def stop(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Shutdown runtime instance (INTERNAL)

        :param int id: ID of instance to stop
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 171, "limit": 783, "responseCode": 200, "count": 907, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Go feeling financial leave.", "messageTemplate": "Respond relationship minute painting executive seat.", "field": "Style save mention out determine.", "parameter": {}, "timestamp": 1083095895}], "currentPage": 671, "size": 157}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/instance/{id}/stop".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','runtime','v1','instance','install'))
    def uninstall(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Uninstall configuration for instance (INTERNAL)

        :param int id: ID of instance to uninstall
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"exact": false, "identifiers": {"additionalProperties": "Present next card since soon happen resource."}}
        """
        from requests import put
        from argus_api.exceptions import http

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