@azure/arm-managedapplications 1.1.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/{LICENSE.txt → LICENSE} +2 -2
- package/README.md +63 -80
- package/dist/index.js +2896 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/esm/applicationClient.d.ts +50 -0
- package/esm/applicationClient.d.ts.map +1 -0
- package/esm/applicationClient.js +190 -0
- package/esm/applicationClient.js.map +1 -0
- package/esm/applicationClientContext.d.ts +16 -0
- package/esm/applicationClientContext.d.ts.map +1 -0
- package/esm/applicationClientContext.js +49 -0
- package/esm/applicationClientContext.js.map +1 -0
- package/esm/coreClientLro.d.ts +26 -0
- package/esm/coreClientLro.d.ts.map +1 -0
- package/esm/coreClientLro.js +186 -0
- package/esm/coreClientLro.js.map +1 -0
- package/esm/index.d.ts +770 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +13 -0
- package/esm/index.js.map +1 -0
- package/esm/lro/azureAsyncPolling.d.ts +3 -0
- package/esm/lro/azureAsyncPolling.d.ts.map +1 -0
- package/esm/lro/azureAsyncPolling.js +67 -0
- package/esm/lro/azureAsyncPolling.js.map +1 -0
- package/esm/lro/bodyPolling.d.ts +8 -0
- package/esm/lro/bodyPolling.d.ts.map +1 -0
- package/esm/lro/bodyPolling.js +37 -0
- package/esm/lro/bodyPolling.js.map +1 -0
- package/esm/lro/index.d.ts +4 -0
- package/esm/lro/index.d.ts.map +1 -0
- package/esm/lro/index.js +12 -0
- package/esm/lro/index.js.map +1 -0
- package/esm/lro/locationPolling.d.ts +3 -0
- package/esm/lro/locationPolling.d.ts.map +1 -0
- package/esm/lro/locationPolling.js +19 -0
- package/esm/lro/locationPolling.js.map +1 -0
- package/esm/lro/lroEngine.d.ts +14 -0
- package/esm/lro/lroEngine.d.ts.map +1 -0
- package/esm/lro/lroEngine.js +41 -0
- package/esm/lro/lroEngine.js.map +1 -0
- package/esm/lro/models.d.ts +138 -0
- package/esm/lro/models.d.ts.map +1 -0
- package/esm/lro/models.js +14 -0
- package/esm/lro/models.js.map +1 -0
- package/esm/lro/operation.d.ts +36 -0
- package/esm/lro/operation.d.ts.map +1 -0
- package/esm/lro/operation.js +82 -0
- package/esm/lro/operation.js.map +1 -0
- package/esm/lro/passthrough.d.ts +3 -0
- package/esm/lro/passthrough.d.ts.map +1 -0
- package/esm/lro/passthrough.js +15 -0
- package/esm/lro/passthrough.js.map +1 -0
- package/esm/lro/requestUtils.d.ts +16 -0
- package/esm/lro/requestUtils.d.ts.map +1 -0
- package/esm/lro/requestUtils.js +73 -0
- package/esm/lro/requestUtils.js.map +1 -0
- package/esm/lro/stateMachine.d.ts +18 -0
- package/esm/lro/stateMachine.d.ts.map +1 -0
- package/esm/lro/stateMachine.js +84 -0
- package/esm/lro/stateMachine.js.map +1 -0
- package/esm/models/index.d.ts +360 -762
- package/esm/models/index.d.ts.map +1 -1
- package/esm/models/index.js +17 -2
- package/esm/models/index.js.map +1 -1
- package/esm/models/mappers.d.ts +18 -20
- package/esm/models/mappers.d.ts.map +1 -1
- package/esm/models/mappers.js +296 -318
- package/esm/models/mappers.js.map +1 -1
- package/esm/models/parameters.d.ts +15 -10
- package/esm/models/parameters.d.ts.map +1 -1
- package/esm/models/parameters.js +77 -49
- package/esm/models/parameters.js.map +1 -1
- package/esm/operations/applicationDefinitions.d.ts +128 -0
- package/esm/operations/applicationDefinitions.d.ts.map +1 -0
- package/esm/operations/applicationDefinitions.js +574 -0
- package/esm/operations/applicationDefinitions.js.map +1 -0
- package/esm/operations/applications.d.ts +182 -0
- package/esm/operations/applications.d.ts.map +1 -0
- package/esm/operations/applications.js +802 -0
- package/esm/operations/applications.js.map +1 -0
- package/esm/operations/index.d.ts +2 -2
- package/esm/operations/index.d.ts.map +1 -1
- package/esm/operations/index.js +5 -7
- package/esm/operations/index.js.map +1 -1
- package/esm/operationsInterfaces/applicationDefinitions.d.ts +95 -0
- package/esm/operationsInterfaces/applicationDefinitions.d.ts.map +1 -0
- package/esm/operationsInterfaces/applicationDefinitions.js +9 -0
- package/esm/operationsInterfaces/applicationDefinitions.js.map +1 -0
- package/esm/operationsInterfaces/applications.d.ts +128 -0
- package/esm/operationsInterfaces/applications.d.ts.map +1 -0
- package/esm/operationsInterfaces/applications.js +9 -0
- package/esm/operationsInterfaces/applications.js.map +1 -0
- package/esm/operationsInterfaces/index.d.ts +3 -0
- package/esm/operationsInterfaces/index.d.ts.map +1 -0
- package/esm/operationsInterfaces/index.js +10 -0
- package/esm/operationsInterfaces/index.js.map +1 -0
- package/package.json +55 -16
- package/review/arm-managedapplications.api.md +443 -0
- package/rollup.config.js +181 -30
- package/src/applicationClient.ts +222 -0
- package/src/applicationClientContext.ts +70 -0
- package/src/coreClientLro.ts +323 -0
- package/src/index.ts +13 -0
- package/src/lro/azureAsyncPolling.ts +96 -0
- package/src/lro/bodyPolling.ts +54 -0
- package/src/lro/index.ts +26 -0
- package/src/lro/locationPolling.ts +30 -0
- package/src/lro/lroEngine.ts +61 -0
- package/src/lro/models.ts +173 -0
- package/src/lro/operation.ts +120 -0
- package/src/lro/passthrough.ts +23 -0
- package/src/lro/requestUtils.ts +105 -0
- package/src/lro/stateMachine.ts +138 -0
- package/src/models/index.ts +402 -794
- package/src/models/mappers.ts +290 -311
- package/src/models/parameters.ts +99 -50
- package/src/operations/applicationDefinitions.ts +810 -0
- package/src/operations/applications.ts +1069 -0
- package/src/operations/index.ts +5 -7
- package/src/operationsInterfaces/applicationDefinitions.ts +179 -0
- package/src/operationsInterfaces/applications.ts +225 -0
- package/src/operationsInterfaces/index.ts +10 -0
- package/tsconfig.json +3 -2
- package/dist/arm-managedapplications.js +0 -1865
- package/dist/arm-managedapplications.js.map +0 -1
- package/dist/arm-managedapplications.min.js +0 -1
- package/dist/arm-managedapplications.min.js.map +0 -1
- package/esm/managedApplicationClient.d.ts +0 -58
- package/esm/managedApplicationClient.d.ts.map +0 -1
- package/esm/managedApplicationClient.js +0 -92
- package/esm/managedApplicationClient.js.map +0 -1
- package/esm/managedApplicationClientContext.d.ts +0 -22
- package/esm/managedApplicationClientContext.d.ts.map +0 -1
- package/esm/managedApplicationClientContext.js +0 -61
- package/esm/managedApplicationClientContext.js.map +0 -1
- package/esm/models/applianceDefinitionsMappers.d.ts +0 -2
- package/esm/models/applianceDefinitionsMappers.d.ts.map +0 -1
- package/esm/models/applianceDefinitionsMappers.js +0 -9
- package/esm/models/applianceDefinitionsMappers.js.map +0 -1
- package/esm/models/appliancesMappers.d.ts +0 -2
- package/esm/models/appliancesMappers.d.ts.map +0 -1
- package/esm/models/appliancesMappers.js +0 -9
- package/esm/models/appliancesMappers.js.map +0 -1
- package/esm/operations/applianceDefinitions.d.ts +0 -167
- package/esm/operations/applianceDefinitions.d.ts.map +0 -1
- package/esm/operations/applianceDefinitions.js +0 -358
- package/esm/operations/applianceDefinitions.js.map +0 -1
- package/esm/operations/appliances.d.ts +0 -247
- package/esm/operations/appliances.d.ts.map +0 -1
- package/esm/operations/appliances.js +0 -482
- package/esm/operations/appliances.js.map +0 -1
- package/src/managedApplicationClient.ts +0 -144
- package/src/managedApplicationClientContext.ts +0 -68
- package/src/models/applianceDefinitionsMappers.ts +0 -24
- package/src/models/appliancesMappers.ts +0 -24
- package/src/operations/applianceDefinitions.ts +0 -492
- package/src/operations/appliances.ts +0 -716
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Microsoft Corporation.
|
|
10
|
+
// Licensed under the MIT license.
|
|
11
|
+
|
|
12
|
+
import { processAzureAsyncOperationResult } from "./azureAsyncPolling";
|
|
13
|
+
import {
|
|
14
|
+
isBodyPollingDone,
|
|
15
|
+
processBodyPollingOperationResult
|
|
16
|
+
} from "./bodyPolling";
|
|
17
|
+
import { processLocationPollingOperationResult } from "./locationPolling";
|
|
18
|
+
import {
|
|
19
|
+
LroResourceLocationConfig,
|
|
20
|
+
GetLroStatusFromResponse,
|
|
21
|
+
LongRunningOperation,
|
|
22
|
+
LroConfig,
|
|
23
|
+
LroStatus,
|
|
24
|
+
PollerConfig,
|
|
25
|
+
RawResponse,
|
|
26
|
+
ResumablePollOperationState
|
|
27
|
+
} from "./models";
|
|
28
|
+
import { processPassthroughOperationResult } from "./passthrough";
|
|
29
|
+
import {
|
|
30
|
+
getPollingUrl,
|
|
31
|
+
inferLroMode,
|
|
32
|
+
isUnexpectedInitialResponse
|
|
33
|
+
} from "./requestUtils";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* creates a stepping function that maps an LRO state to another.
|
|
37
|
+
*/
|
|
38
|
+
export function createGetLroStatusFromResponse<TResult>(
|
|
39
|
+
lroPrimitives: LongRunningOperation<TResult>,
|
|
40
|
+
config: LroConfig,
|
|
41
|
+
lroResourceLocationConfig?: LroResourceLocationConfig
|
|
42
|
+
): GetLroStatusFromResponse<TResult> {
|
|
43
|
+
switch (config.mode) {
|
|
44
|
+
case "AzureAsync": {
|
|
45
|
+
return processAzureAsyncOperationResult(
|
|
46
|
+
lroPrimitives,
|
|
47
|
+
config.resourceLocation,
|
|
48
|
+
lroResourceLocationConfig
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
case "Location": {
|
|
52
|
+
return processLocationPollingOperationResult;
|
|
53
|
+
}
|
|
54
|
+
case "Body": {
|
|
55
|
+
return processBodyPollingOperationResult;
|
|
56
|
+
}
|
|
57
|
+
default: {
|
|
58
|
+
return processPassthroughOperationResult;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates a polling operation that returns a LRO state.
|
|
65
|
+
*/
|
|
66
|
+
export function createPollForLROStatus<TResult>(
|
|
67
|
+
lroPrimitives: LongRunningOperation<TResult>,
|
|
68
|
+
config: LroConfig
|
|
69
|
+
): (
|
|
70
|
+
pollingURL: string,
|
|
71
|
+
pollerConfig: PollerConfig
|
|
72
|
+
) => Promise<LroStatus<TResult>> {
|
|
73
|
+
return async (
|
|
74
|
+
path: string,
|
|
75
|
+
pollerConfig: PollerConfig
|
|
76
|
+
): Promise<LroStatus<TResult>> => {
|
|
77
|
+
const response = await lroPrimitives.sendPollRequest(config, path);
|
|
78
|
+
const retryAfter: string | undefined =
|
|
79
|
+
response.rawResponse.headers["retry-after"];
|
|
80
|
+
if (retryAfter !== undefined) {
|
|
81
|
+
const retryAfterInMs = parseInt(retryAfter);
|
|
82
|
+
pollerConfig.intervalInMs = isNaN(retryAfterInMs)
|
|
83
|
+
? calculatePollingIntervalFromDate(
|
|
84
|
+
new Date(retryAfter),
|
|
85
|
+
pollerConfig.intervalInMs
|
|
86
|
+
)
|
|
87
|
+
: retryAfterInMs;
|
|
88
|
+
}
|
|
89
|
+
return response;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function calculatePollingIntervalFromDate(
|
|
94
|
+
retryAfterDate: Date,
|
|
95
|
+
defaultIntervalInMs: number
|
|
96
|
+
): number {
|
|
97
|
+
const timeNow = Math.floor(new Date().getTime());
|
|
98
|
+
const retryAfterTime = retryAfterDate.getTime();
|
|
99
|
+
if (timeNow < retryAfterTime) {
|
|
100
|
+
return retryAfterTime - timeNow;
|
|
101
|
+
}
|
|
102
|
+
return defaultIntervalInMs;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Creates a callback to be used to initialize the polling operation state.
|
|
107
|
+
* @param state - of the polling operation
|
|
108
|
+
* @param operationSpec - of the LRO
|
|
109
|
+
* @param callback - callback to be called when the operation is done
|
|
110
|
+
* @returns callback that initializes the state of the polling operation
|
|
111
|
+
*/
|
|
112
|
+
export function createInitializeState<TResult>(
|
|
113
|
+
state: ResumablePollOperationState<TResult>,
|
|
114
|
+
requestPath: string,
|
|
115
|
+
requestMethod: string
|
|
116
|
+
): (rawResponse: RawResponse, flatResponse: unknown) => boolean {
|
|
117
|
+
return (rawResponse: RawResponse, flatResponse: unknown) => {
|
|
118
|
+
if (isUnexpectedInitialResponse(rawResponse)) return true;
|
|
119
|
+
state.initialRawResponse = rawResponse;
|
|
120
|
+
state.isStarted = true;
|
|
121
|
+
state.pollingURL = getPollingUrl(state.initialRawResponse, requestPath);
|
|
122
|
+
state.config = inferLroMode(
|
|
123
|
+
requestPath,
|
|
124
|
+
requestMethod,
|
|
125
|
+
state.initialRawResponse
|
|
126
|
+
);
|
|
127
|
+
/** short circuit polling if body polling is done in the initial request */
|
|
128
|
+
if (
|
|
129
|
+
state.config.mode === undefined ||
|
|
130
|
+
(state.config.mode === "Body" &&
|
|
131
|
+
isBodyPollingDone(state.initialRawResponse))
|
|
132
|
+
) {
|
|
133
|
+
state.result = flatResponse as TResult;
|
|
134
|
+
state.isCompleted = true;
|
|
135
|
+
}
|
|
136
|
+
return Boolean(state.isCompleted);
|
|
137
|
+
};
|
|
138
|
+
}
|