@azure/arm-databox 3.0.0 → 5.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.
Files changed (142) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +72 -73
  4. package/dist/index.js +5592 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/src/dataBoxManagementClient.d.ts +29 -0
  9. package/dist-esm/src/dataBoxManagementClient.d.ts.map +1 -0
  10. package/dist-esm/src/dataBoxManagementClient.js +89 -0
  11. package/dist-esm/src/dataBoxManagementClient.js.map +1 -0
  12. package/dist-esm/src/index.d.ts +5 -0
  13. package/dist-esm/src/index.d.ts.map +1 -0
  14. package/dist-esm/src/index.js +12 -0
  15. package/dist-esm/src/index.js.map +1 -0
  16. package/dist-esm/src/lroImpl.d.ts +16 -0
  17. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  18. package/dist-esm/src/lroImpl.js +29 -0
  19. package/dist-esm/src/lroImpl.js.map +1 -0
  20. package/dist-esm/src/models/index.d.ts +2157 -0
  21. package/dist-esm/src/models/index.d.ts.map +1 -0
  22. package/dist-esm/src/models/index.js +168 -0
  23. package/dist-esm/src/models/index.js.map +1 -0
  24. package/dist-esm/src/models/mappers.d.ts +163 -0
  25. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  26. package/dist-esm/src/models/mappers.js +3911 -0
  27. package/dist-esm/src/models/mappers.js.map +1 -0
  28. package/dist-esm/src/models/parameters.d.ts +24 -0
  29. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  30. package/dist-esm/src/models/parameters.js +176 -0
  31. package/dist-esm/src/models/parameters.js.map +1 -0
  32. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  33. package/dist-esm/src/operations/index.d.ts.map +1 -0
  34. package/dist-esm/src/operations/index.js +11 -0
  35. package/dist-esm/src/operations/index.js.map +1 -0
  36. package/dist-esm/src/operations/jobs.d.ts +161 -0
  37. package/dist-esm/src/operations/jobs.d.ts.map +1 -0
  38. package/dist-esm/src/operations/jobs.js +687 -0
  39. package/dist-esm/src/operations/jobs.js.map +1 -0
  40. package/dist-esm/src/operations/operations.d.ts +32 -0
  41. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  42. package/dist-esm/src/operations/operations.js +120 -0
  43. package/dist-esm/src/operations/operations.js.map +1 -0
  44. package/dist-esm/src/operations/service.d.ts +83 -0
  45. package/dist-esm/src/operations/service.d.ts.map +1 -0
  46. package/dist-esm/src/operations/service.js +307 -0
  47. package/dist-esm/src/operations/service.js.map +1 -0
  48. package/dist-esm/src/operationsInterfaces/index.d.ts +4 -0
  49. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  50. package/dist-esm/src/operationsInterfaces/index.js +11 -0
  51. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  52. package/dist-esm/src/operationsInterfaces/jobs.d.ts +115 -0
  53. package/dist-esm/src/operationsInterfaces/jobs.d.ts.map +1 -0
  54. package/dist-esm/src/operationsInterfaces/jobs.js +9 -0
  55. package/dist-esm/src/operationsInterfaces/jobs.js.map +1 -0
  56. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  57. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  58. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  59. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  60. package/dist-esm/src/operationsInterfaces/service.d.ts +54 -0
  61. package/dist-esm/src/operationsInterfaces/service.d.ts.map +1 -0
  62. package/dist-esm/src/operationsInterfaces/service.js +9 -0
  63. package/dist-esm/src/operationsInterfaces/service.js.map +1 -0
  64. package/dist-esm/test/sampleTest.d.ts +2 -0
  65. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  66. package/dist-esm/test/sampleTest.js +40 -0
  67. package/dist-esm/test/sampleTest.js.map +1 -0
  68. package/package.json +65 -31
  69. package/review/arm-databox.api.md +1376 -0
  70. package/rollup.config.js +181 -30
  71. package/src/dataBoxManagementClient.ts +113 -29
  72. package/src/index.ts +12 -0
  73. package/src/lroImpl.ts +34 -0
  74. package/src/models/index.ts +1924 -1354
  75. package/src/models/mappers.ts +3160 -1086
  76. package/src/models/parameters.ts +144 -54
  77. package/src/operations/index.ts +3 -5
  78. package/src/operations/jobs.ts +702 -480
  79. package/src/operations/operations.ts +89 -75
  80. package/src/operations/service.ts +342 -127
  81. package/src/operationsInterfaces/index.ts +11 -0
  82. package/src/operationsInterfaces/jobs.ts +205 -0
  83. package/src/operationsInterfaces/operations.ts +22 -0
  84. package/src/operationsInterfaces/service.ts +107 -0
  85. package/tsconfig.json +3 -3
  86. package/types/arm-databox.d.ts +2558 -0
  87. package/types/tsdoc-metadata.json +11 -0
  88. package/dist/arm-databox.js +0 -3090
  89. package/dist/arm-databox.js.map +0 -1
  90. package/dist/arm-databox.min.js +0 -1
  91. package/dist/arm-databox.min.js.map +0 -1
  92. package/esm/dataBoxManagementClient.d.ts +0 -20
  93. package/esm/dataBoxManagementClient.d.ts.map +0 -1
  94. package/esm/dataBoxManagementClient.js +0 -35
  95. package/esm/dataBoxManagementClient.js.map +0 -1
  96. package/esm/dataBoxManagementClientContext.d.ts +0 -16
  97. package/esm/dataBoxManagementClientContext.d.ts.map +0 -1
  98. package/esm/dataBoxManagementClientContext.js +0 -57
  99. package/esm/dataBoxManagementClientContext.js.map +0 -1
  100. package/esm/models/index.d.ts +0 -1754
  101. package/esm/models/index.d.ts.map +0 -1
  102. package/esm/models/index.js +0 -8
  103. package/esm/models/index.js.map +0 -1
  104. package/esm/models/jobsMappers.d.ts +0 -2
  105. package/esm/models/jobsMappers.d.ts.map +0 -1
  106. package/esm/models/jobsMappers.js +0 -9
  107. package/esm/models/jobsMappers.js.map +0 -1
  108. package/esm/models/mappers.d.ts +0 -75
  109. package/esm/models/mappers.d.ts.map +0 -1
  110. package/esm/models/mappers.js +0 -2020
  111. package/esm/models/mappers.js.map +0 -1
  112. package/esm/models/operationsMappers.d.ts +0 -2
  113. package/esm/models/operationsMappers.d.ts.map +0 -1
  114. package/esm/models/operationsMappers.js +0 -9
  115. package/esm/models/operationsMappers.js.map +0 -1
  116. package/esm/models/parameters.d.ts +0 -12
  117. package/esm/models/parameters.d.ts.map +0 -1
  118. package/esm/models/parameters.js +0 -122
  119. package/esm/models/parameters.js.map +0 -1
  120. package/esm/models/serviceMappers.d.ts +0 -2
  121. package/esm/models/serviceMappers.d.ts.map +0 -1
  122. package/esm/models/serviceMappers.js +0 -9
  123. package/esm/models/serviceMappers.js.map +0 -1
  124. package/esm/operations/index.d.ts.map +0 -1
  125. package/esm/operations/index.js +0 -13
  126. package/esm/operations/index.js.map +0 -1
  127. package/esm/operations/jobs.d.ts +0 -245
  128. package/esm/operations/jobs.d.ts.map +0 -1
  129. package/esm/operations/jobs.js +0 -444
  130. package/esm/operations/jobs.js.map +0 -1
  131. package/esm/operations/operations.d.ts +0 -46
  132. package/esm/operations/operations.d.ts.map +0 -1
  133. package/esm/operations/operations.js +0 -77
  134. package/esm/operations/operations.js.map +0 -1
  135. package/esm/operations/service.d.ts +0 -79
  136. package/esm/operations/service.d.ts.map +0 -1
  137. package/esm/operations/service.js +0 -126
  138. package/esm/operations/service.js.map +0 -1
  139. package/src/dataBoxManagementClientContext.ts +0 -69
  140. package/src/models/jobsMappers.ts +0 -55
  141. package/src/models/operationsMappers.ts +0 -15
  142. package/src/models/serviceMappers.ts +0 -22
package/rollup.config.js CHANGED
@@ -1,37 +1,188 @@
1
- import rollup from "rollup";
2
- import nodeResolve from "rollup-plugin-node-resolve";
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
+ import nodeResolve from "@rollup/plugin-node-resolve";
10
+ import cjs from "@rollup/plugin-commonjs";
3
11
  import sourcemaps from "rollup-plugin-sourcemaps";
12
+ import multiEntry from "@rollup/plugin-multi-entry";
13
+ import json from "@rollup/plugin-json";
14
+
15
+ import nodeBuiltins from "builtin-modules";
16
+
17
+ /**
18
+ * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
19
+ *
20
+ * NOTE: this manual configuration is only needed because OpenTelemetry uses an
21
+ * __exportStar downleveled helper function to declare its exports which confuses
22
+ * rollup's automatic discovery mechanism.
23
+ *
24
+ * @returns an object reference that can be `...`'d into your cjs() configuration.
25
+ */
26
+ export function openTelemetryCommonJs() {
27
+ const namedExports = {};
28
+
29
+ for (const key of [
30
+ "@opentelemetry/api",
31
+ "@azure/core-tracing/node_modules/@opentelemetry/api"
32
+ ]) {
33
+ namedExports[key] = [
34
+ "SpanKind",
35
+ "TraceFlags",
36
+ "getSpan",
37
+ "setSpan",
38
+ "SpanStatusCode",
39
+ "getSpanContext",
40
+ "setSpanContext"
41
+ ];
42
+ }
43
+
44
+ const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
45
+
46
+ for (const version of releasedOpenTelemetryVersions) {
47
+ namedExports[
48
+ // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
49
+ `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
50
+ ] = [
51
+ "SpanKind",
52
+ "TraceFlags",
53
+ "getSpan",
54
+ "setSpan",
55
+ "StatusCode",
56
+ "CanonicalCode",
57
+ "getSpanContext",
58
+ "setSpanContext"
59
+ ];
60
+ }
61
+
62
+ return namedExports;
63
+ }
64
+
65
+ // #region Warning Handler
4
66
 
5
67
  /**
6
- * @type {rollup.RollupFileOptions}
68
+ * A function that can determine whether a rollupwarning should be ignored. If
69
+ * the function returns `true`, then the warning will not be displayed.
7
70
  */
8
- const config = {
9
- input: "./esm/dataBoxManagementClient.js",
10
- external: [
11
- "@azure/ms-rest-js",
12
- "@azure/ms-rest-azure-js"
13
- ],
14
- output: {
15
- file: "./dist/arm-databox.js",
16
- format: "umd",
17
- name: "Azure.ArmDatabox",
18
- sourcemap: true,
19
- globals: {
20
- "@azure/ms-rest-js": "msRest",
21
- "@azure/ms-rest-azure-js": "msRestAzure"
71
+
72
+ function ignoreNiseSinonEvalWarnings(warning) {
73
+ return (
74
+ warning.code === "EVAL" &&
75
+ warning.id &&
76
+ (warning.id.includes("node_modules/nise") ||
77
+ warning.id.includes("node_modules/sinon")) === true
78
+ );
79
+ }
80
+
81
+ function ignoreChaiCircularDependencyWarnings(warning) {
82
+ return (
83
+ warning.code === "CIRCULAR_DEPENDENCY" &&
84
+ warning.importer && warning.importer.includes("node_modules/chai") === true
85
+ );
86
+ }
87
+
88
+ const warningInhibitors = [
89
+ ignoreChaiCircularDependencyWarnings,
90
+ ignoreNiseSinonEvalWarnings
91
+ ];
92
+
93
+ /**
94
+ * Construct a warning handler for the shared rollup configuration
95
+ * that ignores certain warnings that are not relevant to testing.
96
+ */
97
+ function makeOnWarnForTesting() {
98
+ return (warning, warn) => {
99
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
100
+ if (warningInhibitors.every((inhib) => !inhib(warning))) {
101
+ warn(warning);
102
+ }
103
+ };
104
+ }
105
+
106
+ // #endregion
107
+
108
+ function makeBrowserTestConfig() {
109
+ const config = {
110
+ input: {
111
+ include: ["dist-esm/test/**/*.spec.js"],
112
+ exclude: ["dist-esm/test/**/node/**"]
22
113
  },
23
- banner: `/*
24
- * Copyright (c) Microsoft Corporation. All rights reserved.
25
- * Licensed under the MIT License. See License.txt in the project root for license information.
26
- *
27
- * Code generated by Microsoft (R) AutoRest Code Generator.
28
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
29
- */`
30
- },
31
- plugins: [
32
- nodeResolve({ mainFields: ['module', 'main'] }),
33
- sourcemaps()
34
- ]
114
+ output: {
115
+ file: `dist-test/index.browser.js`,
116
+ format: "umd",
117
+ sourcemap: true
118
+ },
119
+ preserveSymlinks: false,
120
+ plugins: [
121
+ multiEntry({ exports: false }),
122
+ nodeResolve({
123
+ mainFields: ["module", "browser"]
124
+ }),
125
+ cjs({
126
+ namedExports: {
127
+ // Chai's strange internal architecture makes it impossible to statically
128
+ // analyze its exports.
129
+ chai: [
130
+ "version",
131
+ "use",
132
+ "util",
133
+ "config",
134
+ "expect",
135
+ "should",
136
+ "assert"
137
+ ],
138
+ ...openTelemetryCommonJs()
139
+ }
140
+ }),
141
+ json(),
142
+ sourcemaps()
143
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
144
+ ],
145
+ onwarn: makeOnWarnForTesting(),
146
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
147
+ // rollup started respecting the "sideEffects" field in package.json. Since
148
+ // our package.json sets "sideEffects=false", this also applies to test
149
+ // code, which causes all tests to be removed by tree-shaking.
150
+ treeshake: false
151
+ };
152
+
153
+ return config;
154
+ }
155
+
156
+ const defaultConfigurationOptions = {
157
+ disableBrowserBundle: false
35
158
  };
36
159
 
37
- export default config;
160
+ export function makeConfig(pkg, options) {
161
+ options = {
162
+ ...defaultConfigurationOptions,
163
+ ...(options || {})
164
+ };
165
+
166
+ const baseConfig = {
167
+ // Use the package's module field if it has one
168
+ input: pkg["module"] || "dist-esm/src/index.js",
169
+ external: [
170
+ ...nodeBuiltins,
171
+ ...Object.keys(pkg.dependencies),
172
+ ...Object.keys(pkg.devDependencies)
173
+ ],
174
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
175
+ preserveSymlinks: false,
176
+ plugins: [sourcemaps(), nodeResolve(), cjs()]
177
+ };
178
+
179
+ const config = [baseConfig];
180
+
181
+ if (!options.disableBrowserBundle) {
182
+ config.push(makeBrowserTestConfig());
183
+ }
184
+
185
+ return config;
186
+ }
187
+
188
+ export default makeConfig(require("./package.json"));
@@ -1,46 +1,130 @@
1
1
  /*
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for
4
- * license information.
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
5
4
  *
6
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
7
- * Changes may cause incorrect behavior and will be lost if the code is
8
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
9
7
  */
10
8
 
11
- import * as msRest from "@azure/ms-rest-js";
12
- import * as Models from "./models";
9
+ import * as coreClient from "@azure/core-client";
10
+ import * as coreAuth from "@azure/core-auth";
11
+ import { OperationsImpl, JobsImpl, ServiceImpl } from "./operations";
12
+ import { Operations, Jobs, Service } from "./operationsInterfaces";
13
+ import * as Parameters from "./models/parameters";
13
14
  import * as Mappers from "./models/mappers";
14
- import * as operations from "./operations";
15
- import { DataBoxManagementClientContext } from "./dataBoxManagementClientContext";
15
+ import {
16
+ DataBoxManagementClientOptionalParams,
17
+ MitigateJobRequest,
18
+ MitigateOptionalParams
19
+ } from "./models";
16
20
 
17
-
18
- class DataBoxManagementClient extends DataBoxManagementClientContext {
19
- // Operation groups
20
- operations: operations.Operations;
21
- jobs: operations.Jobs;
22
- service: operations.Service;
21
+ export class DataBoxManagementClient extends coreClient.ServiceClient {
22
+ $host: string;
23
+ apiVersion: string;
24
+ subscriptionId: string;
23
25
 
24
26
  /**
25
27
  * Initializes a new instance of the DataBoxManagementClient class.
26
- * @param credentials Credentials needed for the client to connect to Azure.
28
+ * @param credentials Subscription credentials which uniquely identify client subscription.
27
29
  * @param subscriptionId The Subscription Id
28
- * @param [options] The parameter options
30
+ * @param options The parameter options
29
31
  */
30
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.DataBoxManagementClientOptions) {
31
- super(credentials, subscriptionId, options);
32
- this.operations = new operations.Operations(this);
33
- this.jobs = new operations.Jobs(this);
34
- this.service = new operations.Service(this);
32
+ constructor(
33
+ credentials: coreAuth.TokenCredential,
34
+ subscriptionId: string,
35
+ options?: DataBoxManagementClientOptionalParams
36
+ ) {
37
+ if (credentials === undefined) {
38
+ throw new Error("'credentials' cannot be null");
39
+ }
40
+ if (subscriptionId === undefined) {
41
+ throw new Error("'subscriptionId' cannot be null");
42
+ }
43
+
44
+ // Initializing default values for options
45
+ if (!options) {
46
+ options = {};
47
+ }
48
+ const defaults: DataBoxManagementClientOptionalParams = {
49
+ requestContentType: "application/json; charset=utf-8",
50
+ credential: credentials
51
+ };
52
+
53
+ const packageDetails = `azsdk-js-arm-databox/5.0.0-beta.1`;
54
+ const userAgentPrefix =
55
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
56
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
57
+ : `${packageDetails}`;
58
+
59
+ if (!options.credentialScopes) {
60
+ options.credentialScopes = ["https://management.azure.com/.default"];
61
+ }
62
+ const optionsWithDefaults = {
63
+ ...defaults,
64
+ ...options,
65
+ userAgentOptions: {
66
+ userAgentPrefix
67
+ },
68
+ baseUri: options.endpoint || "https://management.azure.com"
69
+ };
70
+ super(optionsWithDefaults);
71
+ // Parameter assignments
72
+ this.subscriptionId = subscriptionId;
73
+
74
+ // Assigning values to Constant parameters
75
+ this.$host = options.$host || "https://management.azure.com";
76
+ this.apiVersion = options.apiVersion || "2021-08-01-preview";
77
+ this.operations = new OperationsImpl(this);
78
+ this.jobs = new JobsImpl(this);
79
+ this.service = new ServiceImpl(this);
35
80
  }
36
- }
37
81
 
82
+ /**
83
+ * Request to mitigate for a given job
84
+ * @param jobName The name of the job Resource within the specified resource group. job names must be
85
+ * between 3 and 24 characters in length and use any alphanumeric and underscore only
86
+ * @param resourceGroupName The Resource Group Name
87
+ * @param mitigateJobRequest Mitigation Request
88
+ * @param options The options parameters.
89
+ */
90
+ mitigate(
91
+ jobName: string,
92
+ resourceGroupName: string,
93
+ mitigateJobRequest: MitigateJobRequest,
94
+ options?: MitigateOptionalParams
95
+ ): Promise<void> {
96
+ return this.sendOperationRequest(
97
+ { jobName, resourceGroupName, mitigateJobRequest, options },
98
+ mitigateOperationSpec
99
+ );
100
+ }
101
+
102
+ operations: Operations;
103
+ jobs: Jobs;
104
+ service: Service;
105
+ }
38
106
  // Operation Specifications
107
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
39
108
 
40
- export {
41
- DataBoxManagementClient,
42
- DataBoxManagementClientContext,
43
- Models as DataBoxManagementModels,
44
- Mappers as DataBoxManagementMappers
109
+ const mitigateOperationSpec: coreClient.OperationSpec = {
110
+ path:
111
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate",
112
+ httpMethod: "POST",
113
+ responses: {
114
+ 204: {},
115
+ default: {
116
+ bodyMapper: Mappers.ApiError
117
+ }
118
+ },
119
+ requestBody: Parameters.mitigateJobRequest,
120
+ queryParameters: [Parameters.apiVersion],
121
+ urlParameters: [
122
+ Parameters.$host,
123
+ Parameters.subscriptionId,
124
+ Parameters.jobName,
125
+ Parameters.resourceGroupName
126
+ ],
127
+ headerParameters: [Parameters.accept, Parameters.contentType],
128
+ mediaType: "json",
129
+ serializer
45
130
  };
46
- export * from "./operations";
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
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
+ /// <reference lib="esnext.asynciterable" />
10
+ export * from "./models";
11
+ export { DataBoxManagementClient } from "./dataBoxManagementClient";
12
+ export * from "./operationsInterfaces";
package/src/lroImpl.ts ADDED
@@ -0,0 +1,34 @@
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
+ import { LongRunningOperation, LroResponse } from "@azure/core-lro";
10
+
11
+ export class LroImpl<T> implements LongRunningOperation<T> {
12
+ constructor(
13
+ private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
14
+ private args: Record<string, unknown>,
15
+ private spec: {
16
+ readonly requestBody?: unknown;
17
+ readonly path?: string;
18
+ readonly httpMethod: string;
19
+ } & Record<string, any>,
20
+ public requestPath: string = spec.path!,
21
+ public requestMethod: string = spec.httpMethod
22
+ ) {}
23
+ public async sendInitialRequest(): Promise<LroResponse<T>> {
24
+ return this.sendOperationFn(this.args, this.spec);
25
+ }
26
+ public async sendPollRequest(path: string): Promise<LroResponse<T>> {
27
+ const { requestBody, ...restSpec } = this.spec;
28
+ return this.sendOperationFn(this.args, {
29
+ ...restSpec,
30
+ path,
31
+ httpMethod: "GET"
32
+ });
33
+ }
34
+ }