@azure/arm-databox 5.0.0-beta.2 → 5.0.0
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 +2 -2
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/index.js +973 -182
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/samples-dev/jobsBookShipmentPickUpSample.js +12 -5
- package/dist-esm/samples-dev/jobsBookShipmentPickUpSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsCancelSample.js +12 -5
- package/dist-esm/samples-dev/jobsCancelSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsCreateSample.js +93 -86
- package/dist-esm/samples-dev/jobsCreateSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsDeleteSample.js +12 -5
- package/dist-esm/samples-dev/jobsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsGetSample.js +32 -25
- package/dist-esm/samples-dev/jobsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsListByResourceGroupSample.js +23 -9
- package/dist-esm/samples-dev/jobsListByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsListCredentialsSample.js +24 -10
- package/dist-esm/samples-dev/jobsListCredentialsSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsListSample.js +22 -8
- package/dist-esm/samples-dev/jobsListSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsMarkDevicesShippedSample.js +16 -6
- package/dist-esm/samples-dev/jobsMarkDevicesShippedSample.js.map +1 -1
- package/dist-esm/samples-dev/jobsUpdateSample.js +39 -32
- package/dist-esm/samples-dev/jobsUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/mitigateSample.js +16 -6
- package/dist-esm/samples-dev/mitigateSample.js.map +1 -1
- package/dist-esm/samples-dev/operationsListSample.js +23 -8
- package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
- package/dist-esm/samples-dev/serviceListAvailableSkusByResourceGroupSample.js +24 -10
- package/dist-esm/samples-dev/serviceListAvailableSkusByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/serviceRegionConfigurationByResourceGroupSample.js +11 -4
- package/dist-esm/samples-dev/serviceRegionConfigurationByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/serviceRegionConfigurationSample.js +10 -3
- package/dist-esm/samples-dev/serviceRegionConfigurationSample.js.map +1 -1
- package/dist-esm/samples-dev/serviceValidateAddressSample.js +17 -10
- package/dist-esm/samples-dev/serviceValidateAddressSample.js.map +1 -1
- package/dist-esm/samples-dev/serviceValidateInputsByResourceGroupSample.js +20 -13
- package/dist-esm/samples-dev/serviceValidateInputsByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/serviceValidateInputsSample.js +19 -12
- package/dist-esm/samples-dev/serviceValidateInputsSample.js.map +1 -1
- package/dist-esm/src/dataBoxManagementClient.d.ts +2 -0
- package/dist-esm/src/dataBoxManagementClient.d.ts.map +1 -1
- package/dist-esm/src/dataBoxManagementClient.js +50 -19
- package/dist-esm/src/dataBoxManagementClient.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/lroImpl.d.ts +6 -11
- package/dist-esm/src/lroImpl.d.ts.map +1 -1
- package/dist-esm/src/lroImpl.js +12 -20
- package/dist-esm/src/lroImpl.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +479 -145
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +69 -1
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/models/mappers.d.ts +11 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -1
- package/dist-esm/src/models/mappers.js +614 -46
- package/dist-esm/src/models/mappers.js.map +1 -1
- package/dist-esm/src/models/parameters.js +1 -1
- package/dist-esm/src/models/parameters.js.map +1 -1
- package/dist-esm/src/operations/jobs.d.ts +4 -4
- package/dist-esm/src/operations/jobs.d.ts.map +1 -1
- package/dist-esm/src/operations/jobs.js +107 -49
- package/dist-esm/src/operations/jobs.js.map +1 -1
- package/dist-esm/src/operations/operations.d.ts.map +1 -1
- package/dist-esm/src/operations/operations.js +31 -13
- package/dist-esm/src/operations/operations.js.map +1 -1
- package/dist-esm/src/operations/service.d.ts.map +1 -1
- package/dist-esm/src/operations/service.js +31 -13
- package/dist-esm/src/operations/service.js.map +1 -1
- package/dist-esm/src/operationsInterfaces/jobs.d.ts +4 -4
- package/dist-esm/src/operationsInterfaces/jobs.d.ts.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/test/databox_operations_test.spec.d.ts +4 -0
- package/dist-esm/test/databox_operations_test.spec.d.ts.map +1 -0
- package/dist-esm/test/databox_operations_test.spec.js +78 -0
- package/dist-esm/test/databox_operations_test.spec.js.map +1 -0
- package/package.json +21 -16
- package/review/arm-databox.api.md +255 -189
- package/src/dataBoxManagementClient.ts +61 -21
- package/src/index.ts +1 -0
- package/src/lroImpl.ts +31 -23
- package/src/models/index.ts +468 -98
- package/src/models/mappers.ts +634 -42
- package/src/models/parameters.ts +1 -1
- package/src/operations/jobs.ts +96 -57
- package/src/operations/operations.ts +21 -9
- package/src/operations/service.ts +27 -14
- package/src/operationsInterfaces/jobs.ts +4 -4
- package/src/pagingHelper.ts +39 -0
- package/types/arm-databox.d.ts +457 -99
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/test/sampleTest.d.ts +0 -2
- package/dist-esm/test/sampleTest.d.ts.map +0 -1
- package/dist-esm/test/sampleTest.js +0 -40
- package/dist-esm/test/sampleTest.js.map +0 -1
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import * as coreClient from "@azure/core-client";
|
|
10
10
|
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
11
|
+
import {
|
|
12
|
+
PipelineRequest,
|
|
13
|
+
PipelineResponse,
|
|
14
|
+
SendRequest
|
|
15
|
+
} from "@azure/core-rest-pipeline";
|
|
11
16
|
import * as coreAuth from "@azure/core-auth";
|
|
12
17
|
import { OperationsImpl, JobsImpl, ServiceImpl } from "./operations";
|
|
13
18
|
import { Operations, Jobs, Service } from "./operationsInterfaces";
|
|
@@ -51,57 +56,92 @@ export class DataBoxManagementClient extends coreClient.ServiceClient {
|
|
|
51
56
|
credential: credentials
|
|
52
57
|
};
|
|
53
58
|
|
|
54
|
-
const packageDetails = `azsdk-js-arm-databox/5.0.0
|
|
59
|
+
const packageDetails = `azsdk-js-arm-databox/5.0.0`;
|
|
55
60
|
const userAgentPrefix =
|
|
56
61
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
57
62
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
58
63
|
: `${packageDetails}`;
|
|
59
64
|
|
|
60
|
-
if (!options.credentialScopes) {
|
|
61
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
62
|
-
}
|
|
63
65
|
const optionsWithDefaults = {
|
|
64
66
|
...defaults,
|
|
65
67
|
...options,
|
|
66
68
|
userAgentOptions: {
|
|
67
69
|
userAgentPrefix
|
|
68
70
|
},
|
|
69
|
-
|
|
71
|
+
endpoint:
|
|
70
72
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
71
73
|
};
|
|
72
74
|
super(optionsWithDefaults);
|
|
73
75
|
|
|
76
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
74
77
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
75
78
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
76
|
-
|
|
79
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
77
80
|
(pipelinePolicy) =>
|
|
78
81
|
pipelinePolicy.name ===
|
|
79
82
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
80
83
|
);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
}
|
|
85
|
+
if (
|
|
86
|
+
!options ||
|
|
87
|
+
!options.pipeline ||
|
|
88
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
89
|
+
!bearerTokenAuthenticationPolicyFound
|
|
90
|
+
) {
|
|
91
|
+
this.pipeline.removePolicy({
|
|
92
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
93
|
+
});
|
|
94
|
+
this.pipeline.addPolicy(
|
|
95
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
96
|
+
credential: credentials,
|
|
97
|
+
scopes:
|
|
98
|
+
optionsWithDefaults.credentialScopes ??
|
|
99
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
100
|
+
challengeCallbacks: {
|
|
101
|
+
authorizeRequestOnChallenge:
|
|
102
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
);
|
|
95
106
|
}
|
|
96
107
|
// Parameter assignments
|
|
97
108
|
this.subscriptionId = subscriptionId;
|
|
98
109
|
|
|
99
110
|
// Assigning values to Constant parameters
|
|
100
111
|
this.$host = options.$host || "https://management.azure.com";
|
|
101
|
-
this.apiVersion = options.apiVersion || "
|
|
112
|
+
this.apiVersion = options.apiVersion || "2022-12-01";
|
|
102
113
|
this.operations = new OperationsImpl(this);
|
|
103
114
|
this.jobs = new JobsImpl(this);
|
|
104
115
|
this.service = new ServiceImpl(this);
|
|
116
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
120
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
|
121
|
+
if (!apiVersion) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const apiVersionPolicy = {
|
|
125
|
+
name: "CustomApiVersionPolicy",
|
|
126
|
+
async sendRequest(
|
|
127
|
+
request: PipelineRequest,
|
|
128
|
+
next: SendRequest
|
|
129
|
+
): Promise<PipelineResponse> {
|
|
130
|
+
const param = request.url.split("?");
|
|
131
|
+
if (param.length > 1) {
|
|
132
|
+
const newParams = param[1].split("&").map((item) => {
|
|
133
|
+
if (item.indexOf("api-version") > -1) {
|
|
134
|
+
return "api-version=" + apiVersion;
|
|
135
|
+
} else {
|
|
136
|
+
return item;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
140
|
+
}
|
|
141
|
+
return next(request);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
105
145
|
}
|
|
106
146
|
|
|
107
147
|
/**
|
package/src/index.ts
CHANGED
package/src/lroImpl.ts
CHANGED
|
@@ -6,29 +6,37 @@
|
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
// Copyright (c) Microsoft Corporation.
|
|
10
|
+
// Licensed under the MIT license.
|
|
11
|
+
|
|
12
|
+
import { AbortSignalLike } from "@azure/abort-controller";
|
|
9
13
|
import { LongRunningOperation, LroResponse } from "@azure/core-lro";
|
|
10
14
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...restSpec
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
15
|
+
export function createLroSpec<T>(inputs: {
|
|
16
|
+
sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
|
|
17
|
+
args: Record<string, unknown>;
|
|
18
|
+
spec: {
|
|
19
|
+
readonly requestBody?: unknown;
|
|
20
|
+
readonly path?: string;
|
|
21
|
+
readonly httpMethod: string;
|
|
22
|
+
} & Record<string, any>;
|
|
23
|
+
}): LongRunningOperation<T> {
|
|
24
|
+
const { args, spec, sendOperationFn } = inputs;
|
|
25
|
+
return {
|
|
26
|
+
requestMethod: spec.httpMethod,
|
|
27
|
+
requestPath: spec.path!,
|
|
28
|
+
sendInitialRequest: () => sendOperationFn(args, spec),
|
|
29
|
+
sendPollRequest: (
|
|
30
|
+
path: string,
|
|
31
|
+
options?: { abortSignal?: AbortSignalLike }
|
|
32
|
+
) => {
|
|
33
|
+
const { requestBody, ...restSpec } = spec;
|
|
34
|
+
return sendOperationFn(args, {
|
|
35
|
+
...restSpec,
|
|
36
|
+
httpMethod: "GET",
|
|
37
|
+
path,
|
|
38
|
+
abortSignal: options?.abortSignal
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
34
42
|
}
|