public async restart()

in src/appservice-rest/Arm/azure-app-service.ts [55:84]


    public async restart(): Promise<void> {
        try {
            var slotUrl: string = !!this._slot ? `/slots/${this._slot}` : '';
            var webRequest: WebRequest = {
                method: 'POST',
                uri: this._client.getRequestUri(`//subscriptions/{subscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Web/sites/{name}/${slotUrl}/restart`, {
                    '{ResourceGroupName}': this._resourceGroup,
                    '{name}': this._name
                }, null, '2016-08-01')
            };

            console.log("Restarting app service: " + this._getFormattedName());
            var response = await this._client.beginRequest(webRequest);
            core.debug(`Restart response: ${JSON.stringify(response)}`);
            if (response.statusCode == 200) {
                console.log('Deployment passed');
            }
            else if (response.statusCode == 202) {
                await this._client.getLongRunningOperationResult(response);
            }
            else {
                throw ToError(response);
            }

            console.log("Restarted app service: " + this._getFormattedName());
        }
        catch(error) {
            throw Error ("Failed to restart app service " + this._getFormattedName() + ".\n" + getFormattedError(error));
        }
    }