node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js
/**
     * Create a new long-running operation polling strategy based on the provided initial response.
     * @param initialResponse The initial response to the long-running operation's initial request.
     * @param azureServiceClient The AzureServiceClient that was used to send the initial request.
     * @param options Any options that were provided to the initial request.
     */
Create a new long-running operation polling strategy based on the provided initial response.
@param initialResponse The initial response to the long-running operation's initial request.
@param azureServiceClient The AzureServiceClient that was used to send the initial request.
@param options Any options that were provided to the initial request.
Create a new long - running operation polling strategy based on the provided initial response . @param initialResponse The initial response to the long - running operation ' s initial request . @param azureServiceClient The AzureServiceClient that was used to send the initial request . @param options Any options that were provided to the initial request .
function createLROPollStrategyFromInitialResponse(initialResponse, azureServiceClient, options) {
        var initialRequestMethod = initialResponse.request.method;
        var initialResponseStatus = initialResponse.status;
        var lroPollStrategyType;
        if (getAzureAsyncOperationHeaderValue(initialResponse)) {
            lroPollStrategyType = "AzureAsyncOperation";
        }
        else if (getLocationHeaderValue(initialResponse)) {
            lroPollStrategyType = "Location";
        }
        else if (initialRequestMethod === "PUT" || initialRequestMethod === "PATCH") {
            lroPollStrategyType = "GetResource";
        }
        else if (initialResponseStatus !== 201 && initialResponseStatus !== 202 && !isFinished(getStatusFromResponse(initialResponse))) {
            throw new Error("Can't determine long running operation polling strategy.");
        }
        var result;
        if (lroPollStrategyType) {
            var resource = getResponseBody(initialResponse);
            var lroPollState = {
                pollStrategyType: lroPollStrategyType,
                options: options,
                initialResponse: initialResponse,
                mostRecentResponse: initialResponse,
                mostRecentRequest: initialResponse.request,
                azureAsyncOperationHeaderValue: getAzureAsyncOperationHeaderValue(initialResponse),
                locationHeaderValue: getLocationHeaderValue(initialResponse),
                resource: resource,
                state: getStatusFromResponse(initialResponse, resource)
            };
            result = createLROPollStrategyFromPollState(azureServiceClient, lroPollState);
        }
        else {
            result = undefined;
        }
        return result;
    }
function createLROPollStrategyFromInitialResponse ( initialResponse , azureServiceClient , options ) { var initialRequestMethod = initialResponse . request . method ; var initialResponseStatus = initialResponse . status ; var lroPollStrategyType ; if ( getAzureAsyncOperationHeaderValue ( initialResponse ) ) { lroPollStrategyType = "AzureAsyncOperation" ; } else if ( getLocationHeaderValue ( initialResponse ) ) { lroPollStrategyType = "Location" ; } else if ( initialRequestMethod === "PUT" || initialRequestMethod === "PATCH" ) { lroPollStrategyType = "GetResource" ; } else if ( initialResponseStatus !== 201 && initialResponseStatus !== 202 && ! isFinished ( getStatusFromResponse ( initialResponse ) ) ) { throw new Error ( "Can't determine long running operation polling strategy." ) ; } var result ; if ( lroPollStrategyType ) { var resource = getResponseBody ( initialResponse ) ; var lroPollState = { pollStrategyType : lroPollStrategyType , options : options , initialResponse : initialResponse , mostRecentResponse : initialResponse , mostRecentRequest : initialResponse . request , azureAsyncOperationHeaderValue : getAzureAsyncOperationHeaderValue ( initialResponse ) , locationHeaderValue : getLocationHeaderValue ( initialResponse ) , resource : resource , state : getStatusFromResponse ( initialResponse , resource ) } ; result = createLROPollStrategyFromPollState ( azureServiceClient , lroPollState ) ; } else { result = undefined ; } return result ; }
Create a new long-running operation polling strategy based on the provided initial response.
Create a new long - running operation polling strategy based on the provided initial response .