UNPKG

2.99 kBTypeScriptView Raw
1import { HttpOperationResponse, RequestOptionsBase, RestResponse } from "@azure/ms-rest-js";
2import { AzureServiceClient } from "./azureServiceClient";
3import { LROPollState, LROPollStrategy } from "./lroPollStrategy";
4import { LongRunningOperationStates } from "./util/constants";
5/**
6 * An HTTP operation response that provides special methods for interacting with LROs (long running
7 * operations).
8 */
9export declare class LROPoller {
10 private readonly _lroPollStrategy;
11 private readonly _initialResponse;
12 /**
13 * Create a new HttpLongRunningOperationResponse.
14 * @param _lroPollStrategy The LROPollStrategy that this HttpLongRunningOperationResponse will
15 * use to interact with the LRO.
16 */
17 constructor(_lroPollStrategy: LROPollStrategy | undefined, _initialResponse: HttpOperationResponse);
18 /**
19 * Get the first response that the service sent back when the LRO was initiated.
20 */
21 getInitialResponse(): HttpOperationResponse;
22 /**
23 * Get the most recent response that the service sent back during this LRO.
24 */
25 getMostRecentResponse(): HttpOperationResponse;
26 /**
27 * Get whether or not the LRO is finished.
28 */
29 isFinished(): boolean;
30 /**
31 * Get whether or not the LRO is finished and its final state is acceptable. If the LRO has not
32 * finished yet, then undefined will be returned. An "acceptable" final state is determined by the
33 * LRO strategy that the Azure service uses to perform long running operations.
34 */
35 isFinalStatusAcceptable(): boolean | undefined;
36 /**
37 * Get the current status of the LRO.
38 */
39 getOperationStatus(): LongRunningOperationStates;
40 /**
41 * If the LRO is finished and in an acceptable state, then return the HttpOperationResponse. If
42 * the LRO is finished and not in an acceptable state, then throw the error that the LRO produced.
43 * If the LRO is not finished, then return undefined.
44 */
45 getOperationResponse(): Promise<HttpOperationResponse | undefined>;
46 /**
47 * Send a single poll request and return the LRO's state.
48 */
49 poll(): Promise<LongRunningOperationStates>;
50 /**
51 * Send poll requests that check the LRO's status until it is determined that the LRO is finished.
52 */
53 pollUntilFinished(): Promise<RestResponse>;
54 /**
55 * Get an LROPollState object that can be used to poll this LRO in a different context (such as on
56 * a different process or a different machine). If the LRO couldn't produce an LRO polling
57 * strategy, then this will return undefined.
58 */
59 getPollState(): LROPollState | undefined;
60}
61export declare function createLROPollerFromInitialResponse(azureServiceClient: AzureServiceClient, initialResponse: HttpOperationResponse, options?: RequestOptionsBase): LROPoller;
62export declare function createLROPollerFromPollState(azureServiceClient: AzureServiceClient, lroMemento: LROPollState): LROPoller;
63//# sourceMappingURL=lroPoller.d.ts.map
\No newline at end of file