_performRequest(requestUrl, method, body, apiVersion) {
        if (!method) {
            method = 'GET';
        }

        var httpRequest = new WebResource();
        var client = this._rmClient;
        httpRequest.method = method;
        httpRequest.headers = {};
        if (method === 'POST' || method === 'PUT' || method === 'PATCH') {
            if (body.constructor.name === 'ReadStream') {
                httpRequest.body = body;
            } else {
                httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
                httpRequest.body = JSON.stringify(body);
            }

        } else {
            httpRequest.body = null;
        }
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();

        var queryParameters = [];
        queryParameters.push('api-version=' + encodeURIComponent(apiVersion || client.apiVersion));

        if (queryParameters.length > 0) {
            requestUrl += '?' + queryParameters.join('&');
        }
        // trim all duplicate forward slashes in the url
        var regex = /([^:]\/)\/+/gi;
        requestUrl = requestUrl.replace(regex, '$1');

        httpRequest.url = requestUrl;
        // this logic is mostly from the Azure auto-rest generated code
        return client.pipelineAsync(httpRequest)
        .spread((response, responseBody) => {
            var statusCode = response.statusCode;

            if (statusCode < 200 || statusCode > 299) {
                var errorResponse = JSON.parse(responseBody);
                throw new Error(errorResponse.error.code, errorResponse.error.message);
            }
            // Create Result
            var result = null;
            if (responseBody === '') {
                responseBody = null;
            }

            result = JSON.parse(responseBody);
            return result;
        });
    }
/**
     * Performs authenticated call to ARM Api. Lifted from Azure/autorest
     *
     * @method
     * @param {string} requestUrl The full url to make the request call to
     * @param {string} method The HTTP method
     * @param {object|Readable} body The request body. Can be a Readable stream as well.
     * @return {Promise<response>} A promise that resolves with the response body
     */
Performs authenticated call to ARM Api. Lifted from Azure/autorest
@method
@param {string} requestUrl The full url to make the request call to
@param {string} method The HTTP method
@param {object|Readable} body The request body. Can be a Readable stream as well.
@return {Promise} A promise that resolves with the response body
Performs authenticated call to ARM Api . Lifted from Azure / autorest @method @param { string } requestUrl The full url to make the request call to @param { string } method The HTTP method @param { object|Readable } body The request body . Can be a Readable stream as well . @return { Promise } A promise that resolves with the response body
_performRequest(requestUrl, method, body, apiVersion) {
        if (!method) {
            method = 'GET';
        }
        var httpRequest = new WebResource();
        var client = this._rmClient;
        httpRequest.method = method;
        httpRequest.headers = {};
        if (method === 'POST' || method === 'PUT' || method === 'PATCH') {
            if (body.constructor.name === 'ReadStream') {
                httpRequest.body = body;
            } else {
                httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
                httpRequest.body = JSON.stringify(body);
            }
        } else {
            httpRequest.body = null;
        }
        httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid();
        var queryParameters = [];
        queryParameters.push('api-version=' + encodeURIComponent(apiVersion || client.apiVersion));
        if (queryParameters.length > 0) {
            requestUrl += '?' + queryParameters.join('&');
        }
        var regex = /([^:]\/)\/+/gi;
        requestUrl = requestUrl.replace(regex, '$1');
        httpRequest.url = requestUrl;
        return client.pipelineAsync(httpRequest)
        .spread((response, responseBody) => {
            var statusCode = response.statusCode;
            if (statusCode < 200 || statusCode > 299) {
                var errorResponse = JSON.parse(responseBody);
                throw new Error(errorResponse.error.code, errorResponse.error.message);
            }
            var result = null;
            if (responseBody === '') {
                responseBody = null;
            }
            result = JSON.parse(responseBody);
            return result;
        });
    }
_performRequest ( requestUrl , method , body , apiVersion ) { if ( ! method ) { method = 'GET' ; } var httpRequest = new WebResource ( ) ; var client = this . _rmClient ; httpRequest . method = method ; httpRequest . headers = { } ; if ( method === 'POST' || method === 'PUT' || method === 'PATCH' ) { if ( body . constructor . name === 'ReadStream' ) { httpRequest . body = body ; } else { httpRequest . headers [ 'Content-Type' ] = 'application/json; charset=utf-8' ; httpRequest . body = JSON . stringify ( body ) ; } } else { httpRequest . body = null ; } httpRequest . headers [ 'x-ms-client-request-id' ] = msRestAzure . generateUuid ( ) ; var queryParameters = [ ] ; queryParameters . push ( 'api-version=' + encodeURIComponent ( apiVersion || client . apiVersion ) ) ; if ( queryParameters . length > 0 ) { requestUrl += '?' + queryParameters . join ( '&' ) ; } var regex = / ([^:]\/)\/+ / gi ; requestUrl = requestUrl . replace ( regex , '$1' ) ; httpRequest . url = requestUrl ; return client . pipelineAsync ( httpRequest ) . spread ( ( response , responseBody ) => { var statusCode = response . statusCode ; if ( statusCode < 200 || statusCode > 299 ) { var errorResponse = JSON . parse ( responseBody ) ; throw new Error ( errorResponse . error . code , errorResponse . error . message ) ; } var result = null ; if ( responseBody === '' ) { responseBody = null ; } result = JSON . parse ( responseBody ) ; return result ; } ) ; }
Performs authenticated call to ARM Api.
Performs authenticated call to ARM Api .
// trim all duplicate forward slashes in the url // this logic is mostly from the Azure auto-rest generated code // Create Result