@azure/arm-hardwaresecuritymodules 2.0.0-alpha.20240110.1 → 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.
Files changed (175) hide show
  1. package/CHANGELOG.md +82 -1
  2. package/LICENSE +1 -1
  3. package/README.md +14 -14
  4. package/dist/index.js +2215 -425
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsCreateSample.d.ts +2 -0
  9. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsCreateSample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsCreateSample.js +46 -0
  11. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsCreateSample.js.map +1 -0
  12. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsDeleteSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsDeleteSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsDeleteSample.js +40 -0
  15. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsDeleteSample.js.map +1 -0
  16. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsGetSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsGetSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsGetSample.js +40 -0
  19. package/dist-esm/samples-dev/cloudHsmClusterPrivateEndpointConnectionsGetSample.js.map +1 -0
  20. package/dist-esm/samples-dev/cloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/cloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/cloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSample.js +39 -0
  23. package/dist-esm/samples-dev/cloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSample.js.map +1 -0
  24. package/dist-esm/samples-dev/cloudHsmClustersCreateOrUpdateSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/cloudHsmClustersCreateOrUpdateSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/cloudHsmClustersCreateOrUpdateSample.js +53 -0
  27. package/dist-esm/samples-dev/cloudHsmClustersCreateOrUpdateSample.js.map +1 -0
  28. package/dist-esm/samples-dev/cloudHsmClustersDeleteSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/cloudHsmClustersDeleteSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/cloudHsmClustersDeleteSample.js +39 -0
  31. package/dist-esm/samples-dev/cloudHsmClustersDeleteSample.js.map +1 -0
  32. package/dist-esm/samples-dev/cloudHsmClustersGetSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/cloudHsmClustersGetSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/cloudHsmClustersGetSample.js +39 -0
  35. package/dist-esm/samples-dev/cloudHsmClustersGetSample.js.map +1 -0
  36. package/dist-esm/samples-dev/cloudHsmClustersListByResourceGroupSample.d.ts +2 -0
  37. package/dist-esm/samples-dev/cloudHsmClustersListByResourceGroupSample.d.ts.map +1 -0
  38. package/dist-esm/samples-dev/cloudHsmClustersListByResourceGroupSample.js +54 -0
  39. package/dist-esm/samples-dev/cloudHsmClustersListByResourceGroupSample.js.map +1 -0
  40. package/dist-esm/samples-dev/cloudHsmClustersListBySubscriptionSample.d.ts +2 -0
  41. package/dist-esm/samples-dev/cloudHsmClustersListBySubscriptionSample.d.ts.map +1 -0
  42. package/dist-esm/samples-dev/cloudHsmClustersListBySubscriptionSample.js +53 -0
  43. package/dist-esm/samples-dev/cloudHsmClustersListBySubscriptionSample.js.map +1 -0
  44. package/dist-esm/samples-dev/cloudHsmClustersUpdateSample.d.ts +2 -0
  45. package/dist-esm/samples-dev/cloudHsmClustersUpdateSample.d.ts.map +1 -0
  46. package/dist-esm/samples-dev/cloudHsmClustersUpdateSample.js +47 -0
  47. package/dist-esm/samples-dev/cloudHsmClustersUpdateSample.js.map +1 -0
  48. package/dist-esm/samples-dev/dedicatedHsmCreateOrUpdateSample.js +23 -13
  49. package/dist-esm/samples-dev/dedicatedHsmCreateOrUpdateSample.js.map +1 -1
  50. package/dist-esm/samples-dev/dedicatedHsmDeleteSample.js +13 -5
  51. package/dist-esm/samples-dev/dedicatedHsmDeleteSample.js.map +1 -1
  52. package/dist-esm/samples-dev/dedicatedHsmGetSample.js +23 -13
  53. package/dist-esm/samples-dev/dedicatedHsmGetSample.js.map +1 -1
  54. package/dist-esm/samples-dev/dedicatedHsmListByResourceGroupSample.js +18 -9
  55. package/dist-esm/samples-dev/dedicatedHsmListByResourceGroupSample.js.map +1 -1
  56. package/dist-esm/samples-dev/dedicatedHsmListBySubscriptionSample.js +16 -7
  57. package/dist-esm/samples-dev/dedicatedHsmListBySubscriptionSample.js.map +1 -1
  58. package/dist-esm/samples-dev/dedicatedHsmListOutboundNetworkDependenciesEndpointsSample.js +13 -5
  59. package/dist-esm/samples-dev/dedicatedHsmListOutboundNetworkDependenciesEndpointsSample.js.map +1 -1
  60. package/dist-esm/samples-dev/dedicatedHsmUpdateSample.js +18 -9
  61. package/dist-esm/samples-dev/dedicatedHsmUpdateSample.js.map +1 -1
  62. package/dist-esm/samples-dev/operationsListSample.js +16 -7
  63. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  64. package/dist-esm/samples-dev/privateEndpointConnectionsListByCloudHsmClusterSample.d.ts +2 -0
  65. package/dist-esm/samples-dev/privateEndpointConnectionsListByCloudHsmClusterSample.d.ts.map +1 -0
  66. package/dist-esm/samples-dev/privateEndpointConnectionsListByCloudHsmClusterSample.js +55 -0
  67. package/dist-esm/samples-dev/privateEndpointConnectionsListByCloudHsmClusterSample.js.map +1 -0
  68. package/dist-esm/src/azureHSMResourceProvider.d.ts +22 -0
  69. package/dist-esm/src/azureHSMResourceProvider.d.ts.map +1 -0
  70. package/dist-esm/src/{azureDedicatedHSMResourceProvider.js → azureHSMResourceProvider.js} +10 -37
  71. package/dist-esm/src/azureHSMResourceProvider.js.map +1 -0
  72. package/dist-esm/src/index.d.ts +1 -1
  73. package/dist-esm/src/index.d.ts.map +1 -1
  74. package/dist-esm/src/index.js +1 -1
  75. package/dist-esm/src/index.js.map +1 -1
  76. package/dist-esm/src/lroImpl.d.ts +6 -11
  77. package/dist-esm/src/lroImpl.d.ts.map +1 -1
  78. package/dist-esm/src/lroImpl.js +12 -20
  79. package/dist-esm/src/lroImpl.js.map +1 -1
  80. package/dist-esm/src/models/index.d.ts +538 -8
  81. package/dist-esm/src/models/index.d.ts.map +1 -1
  82. package/dist-esm/src/models/index.js +72 -0
  83. package/dist-esm/src/models/index.js.map +1 -1
  84. package/dist-esm/src/models/mappers.d.ts +28 -2
  85. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  86. package/dist-esm/src/models/mappers.js +692 -7
  87. package/dist-esm/src/models/mappers.js.map +1 -1
  88. package/dist-esm/src/models/parameters.d.ts +27 -5
  89. package/dist-esm/src/models/parameters.d.ts.map +1 -1
  90. package/dist-esm/src/models/parameters.js +161 -29
  91. package/dist-esm/src/models/parameters.js.map +1 -1
  92. package/dist-esm/src/operations/cloudHsmClusterPrivateEndpointConnections.d.ts +55 -0
  93. package/dist-esm/src/operations/cloudHsmClusterPrivateEndpointConnections.d.ts.map +1 -0
  94. package/dist-esm/src/operations/cloudHsmClusterPrivateEndpointConnections.js +193 -0
  95. package/dist-esm/src/operations/cloudHsmClusterPrivateEndpointConnections.js.map +1 -0
  96. package/dist-esm/src/operations/cloudHsmClusterPrivateLinkResources.d.ts +21 -0
  97. package/dist-esm/src/operations/cloudHsmClusterPrivateLinkResources.d.ts.map +1 -0
  98. package/dist-esm/src/operations/cloudHsmClusterPrivateLinkResources.js +54 -0
  99. package/dist-esm/src/operations/cloudHsmClusterPrivateLinkResources.js.map +1 -0
  100. package/dist-esm/src/operations/cloudHsmClusters.d.ts +114 -0
  101. package/dist-esm/src/operations/cloudHsmClusters.d.ts.map +1 -0
  102. package/dist-esm/src/operations/cloudHsmClusters.js +580 -0
  103. package/dist-esm/src/operations/cloudHsmClusters.js.map +1 -0
  104. package/dist-esm/src/operations/dedicatedHsmOperations.d.ts +6 -6
  105. package/dist-esm/src/operations/dedicatedHsmOperations.d.ts.map +1 -1
  106. package/dist-esm/src/operations/dedicatedHsmOperations.js +51 -39
  107. package/dist-esm/src/operations/dedicatedHsmOperations.js.map +1 -1
  108. package/dist-esm/src/operations/index.d.ts +4 -0
  109. package/dist-esm/src/operations/index.d.ts.map +1 -1
  110. package/dist-esm/src/operations/index.js +4 -0
  111. package/dist-esm/src/operations/index.js.map +1 -1
  112. package/dist-esm/src/operations/operations.d.ts +2 -2
  113. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  114. package/dist-esm/src/operations/operations.js +1 -1
  115. package/dist-esm/src/operations/operations.js.map +1 -1
  116. package/dist-esm/src/operations/privateEndpointConnections.d.ts +43 -0
  117. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -0
  118. package/dist-esm/src/operations/privateEndpointConnections.js +155 -0
  119. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -0
  120. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateEndpointConnections.d.ts +47 -0
  121. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateEndpointConnections.d.ts.map +1 -0
  122. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateEndpointConnections.js +9 -0
  123. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateEndpointConnections.js.map +1 -0
  124. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateLinkResources.d.ts +13 -0
  125. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateLinkResources.d.ts.map +1 -0
  126. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateLinkResources.js +9 -0
  127. package/dist-esm/src/operationsInterfaces/cloudHsmClusterPrivateLinkResources.js.map +1 -0
  128. package/dist-esm/src/operationsInterfaces/cloudHsmClusters.d.ts +77 -0
  129. package/dist-esm/src/operationsInterfaces/cloudHsmClusters.d.ts.map +1 -0
  130. package/dist-esm/src/operationsInterfaces/cloudHsmClusters.js +9 -0
  131. package/dist-esm/src/operationsInterfaces/cloudHsmClusters.js.map +1 -0
  132. package/dist-esm/src/operationsInterfaces/dedicatedHsmOperations.d.ts +4 -4
  133. package/dist-esm/src/operationsInterfaces/dedicatedHsmOperations.d.ts.map +1 -1
  134. package/dist-esm/src/operationsInterfaces/index.d.ts +4 -0
  135. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -1
  136. package/dist-esm/src/operationsInterfaces/index.js +4 -0
  137. package/dist-esm/src/operationsInterfaces/index.js.map +1 -1
  138. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts +15 -0
  139. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts.map +1 -0
  140. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js +9 -0
  141. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js.map +1 -0
  142. package/dist-esm/test/hardwaresecuritymodules_operations_test.spec.d.ts +4 -0
  143. package/dist-esm/test/hardwaresecuritymodules_operations_test.spec.d.ts.map +1 -0
  144. package/dist-esm/test/hardwaresecuritymodules_operations_test.spec.js +73 -0
  145. package/dist-esm/test/hardwaresecuritymodules_operations_test.spec.js.map +1 -0
  146. package/package.json +15 -12
  147. package/review/arm-hardwaresecuritymodules.api.md +426 -19
  148. package/src/{azureDedicatedHSMResourceProvider.ts → azureHSMResourceProvider.ts} +35 -46
  149. package/src/index.ts +1 -1
  150. package/src/lroImpl.ts +31 -23
  151. package/src/models/index.ts +599 -8
  152. package/src/models/mappers.ts +751 -7
  153. package/src/models/parameters.ts +187 -30
  154. package/src/operations/cloudHsmClusterPrivateEndpointConnections.ts +263 -0
  155. package/src/operations/cloudHsmClusterPrivateLinkResources.ts +74 -0
  156. package/src/operations/cloudHsmClusters.ts +750 -0
  157. package/src/operations/dedicatedHsmOperations.ts +69 -59
  158. package/src/operations/index.ts +4 -0
  159. package/src/operations/operations.ts +4 -4
  160. package/src/operations/privateEndpointConnections.ts +208 -0
  161. package/src/operationsInterfaces/cloudHsmClusterPrivateEndpointConnections.ts +83 -0
  162. package/src/operationsInterfaces/cloudHsmClusterPrivateLinkResources.ts +28 -0
  163. package/src/operationsInterfaces/cloudHsmClusters.ts +142 -0
  164. package/src/operationsInterfaces/dedicatedHsmOperations.ts +6 -6
  165. package/src/operationsInterfaces/index.ts +4 -0
  166. package/src/operationsInterfaces/privateEndpointConnections.ts +31 -0
  167. package/types/arm-hardwaresecuritymodules.d.ts +773 -34
  168. package/types/tsdoc-metadata.json +1 -1
  169. package/dist-esm/src/azureDedicatedHSMResourceProvider.d.ts +0 -22
  170. package/dist-esm/src/azureDedicatedHSMResourceProvider.d.ts.map +0 -1
  171. package/dist-esm/src/azureDedicatedHSMResourceProvider.js.map +0 -1
  172. package/dist-esm/test/sampleTest.d.ts +0 -2
  173. package/dist-esm/test/sampleTest.d.ts.map +0 -1
  174. package/dist-esm/test/sampleTest.js +0 -38
  175. package/dist-esm/test/sampleTest.js.map +0 -1
@@ -0,0 +1,750 @@
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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
11
+ import { CloudHsmClusters } from "../operationsInterfaces";
12
+ import * as coreClient from "@azure/core-client";
13
+ import * as Mappers from "../models/mappers";
14
+ import * as Parameters from "../models/parameters";
15
+ import { AzureHSMResourceProvider } from "../azureHSMResourceProvider";
16
+ import {
17
+ SimplePollerLike,
18
+ OperationState,
19
+ createHttpPoller
20
+ } from "@azure/core-lro";
21
+ import { createLroSpec } from "../lroImpl";
22
+ import {
23
+ CloudHsmCluster,
24
+ CloudHsmClustersListByResourceGroupNextOptionalParams,
25
+ CloudHsmClustersListByResourceGroupOptionalParams,
26
+ CloudHsmClustersListByResourceGroupResponse,
27
+ CloudHsmClustersListBySubscriptionNextOptionalParams,
28
+ CloudHsmClustersListBySubscriptionOptionalParams,
29
+ CloudHsmClustersListBySubscriptionResponse,
30
+ CloudHsmClustersCreateOrUpdateOptionalParams,
31
+ CloudHsmClustersCreateOrUpdateResponse,
32
+ CloudHsmClustersUpdateOptionalParams,
33
+ CloudHsmClustersUpdateResponse,
34
+ CloudHsmClustersGetOptionalParams,
35
+ CloudHsmClustersGetResponse,
36
+ CloudHsmClustersDeleteOptionalParams,
37
+ CloudHsmClustersListByResourceGroupNextResponse,
38
+ CloudHsmClustersListBySubscriptionNextResponse
39
+ } from "../models";
40
+
41
+ /// <reference lib="esnext.asynciterable" />
42
+ /** Class containing CloudHsmClusters operations. */
43
+ export class CloudHsmClustersImpl implements CloudHsmClusters {
44
+ private readonly client: AzureHSMResourceProvider;
45
+
46
+ /**
47
+ * Initialize a new instance of the class CloudHsmClusters class.
48
+ * @param client Reference to the service client
49
+ */
50
+ constructor(client: AzureHSMResourceProvider) {
51
+ this.client = client;
52
+ }
53
+
54
+ /**
55
+ * The List operation gets information about the Cloud HSM Clusters associated with the subscription
56
+ * and within the specified resource group.
57
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
58
+ * @param options The options parameters.
59
+ */
60
+ public listByResourceGroup(
61
+ resourceGroupName: string,
62
+ options?: CloudHsmClustersListByResourceGroupOptionalParams
63
+ ): PagedAsyncIterableIterator<CloudHsmCluster> {
64
+ const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
65
+ return {
66
+ next() {
67
+ return iter.next();
68
+ },
69
+ [Symbol.asyncIterator]() {
70
+ return this;
71
+ },
72
+ byPage: (settings?: PageSettings) => {
73
+ if (settings?.maxPageSize) {
74
+ throw new Error("maxPageSize is not supported by this operation.");
75
+ }
76
+ return this.listByResourceGroupPagingPage(
77
+ resourceGroupName,
78
+ options,
79
+ settings
80
+ );
81
+ }
82
+ };
83
+ }
84
+
85
+ private async *listByResourceGroupPagingPage(
86
+ resourceGroupName: string,
87
+ options?: CloudHsmClustersListByResourceGroupOptionalParams,
88
+ settings?: PageSettings
89
+ ): AsyncIterableIterator<CloudHsmCluster[]> {
90
+ let result: CloudHsmClustersListByResourceGroupResponse;
91
+ let continuationToken = settings?.continuationToken;
92
+ if (!continuationToken) {
93
+ result = await this._listByResourceGroup(resourceGroupName, options);
94
+ let page = result.value || [];
95
+ continuationToken = result.nextLink;
96
+ setContinuationToken(page, continuationToken);
97
+ yield page;
98
+ }
99
+ while (continuationToken) {
100
+ result = await this._listByResourceGroupNext(
101
+ resourceGroupName,
102
+ continuationToken,
103
+ options
104
+ );
105
+ continuationToken = result.nextLink;
106
+ let page = result.value || [];
107
+ setContinuationToken(page, continuationToken);
108
+ yield page;
109
+ }
110
+ }
111
+
112
+ private async *listByResourceGroupPagingAll(
113
+ resourceGroupName: string,
114
+ options?: CloudHsmClustersListByResourceGroupOptionalParams
115
+ ): AsyncIterableIterator<CloudHsmCluster> {
116
+ for await (const page of this.listByResourceGroupPagingPage(
117
+ resourceGroupName,
118
+ options
119
+ )) {
120
+ yield* page;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * The List operation gets information about the Cloud HSM Clusters associated with the subscription.
126
+ * @param options The options parameters.
127
+ */
128
+ public listBySubscription(
129
+ options?: CloudHsmClustersListBySubscriptionOptionalParams
130
+ ): PagedAsyncIterableIterator<CloudHsmCluster> {
131
+ const iter = this.listBySubscriptionPagingAll(options);
132
+ return {
133
+ next() {
134
+ return iter.next();
135
+ },
136
+ [Symbol.asyncIterator]() {
137
+ return this;
138
+ },
139
+ byPage: (settings?: PageSettings) => {
140
+ if (settings?.maxPageSize) {
141
+ throw new Error("maxPageSize is not supported by this operation.");
142
+ }
143
+ return this.listBySubscriptionPagingPage(options, settings);
144
+ }
145
+ };
146
+ }
147
+
148
+ private async *listBySubscriptionPagingPage(
149
+ options?: CloudHsmClustersListBySubscriptionOptionalParams,
150
+ settings?: PageSettings
151
+ ): AsyncIterableIterator<CloudHsmCluster[]> {
152
+ let result: CloudHsmClustersListBySubscriptionResponse;
153
+ let continuationToken = settings?.continuationToken;
154
+ if (!continuationToken) {
155
+ result = await this._listBySubscription(options);
156
+ let page = result.value || [];
157
+ continuationToken = result.nextLink;
158
+ setContinuationToken(page, continuationToken);
159
+ yield page;
160
+ }
161
+ while (continuationToken) {
162
+ result = await this._listBySubscriptionNext(continuationToken, options);
163
+ continuationToken = result.nextLink;
164
+ let page = result.value || [];
165
+ setContinuationToken(page, continuationToken);
166
+ yield page;
167
+ }
168
+ }
169
+
170
+ private async *listBySubscriptionPagingAll(
171
+ options?: CloudHsmClustersListBySubscriptionOptionalParams
172
+ ): AsyncIterableIterator<CloudHsmCluster> {
173
+ for await (const page of this.listBySubscriptionPagingPage(options)) {
174
+ yield* page;
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Create or Update a Cloud HSM Cluster in the specified subscription.
180
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
181
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
182
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
183
+ * @param location The geo-location where the resource lives
184
+ * @param options The options parameters.
185
+ */
186
+ async beginCreateOrUpdate(
187
+ resourceGroupName: string,
188
+ cloudHsmClusterName: string,
189
+ location: string,
190
+ options?: CloudHsmClustersCreateOrUpdateOptionalParams
191
+ ): Promise<
192
+ SimplePollerLike<
193
+ OperationState<CloudHsmClustersCreateOrUpdateResponse>,
194
+ CloudHsmClustersCreateOrUpdateResponse
195
+ >
196
+ > {
197
+ const directSendOperation = async (
198
+ args: coreClient.OperationArguments,
199
+ spec: coreClient.OperationSpec
200
+ ): Promise<CloudHsmClustersCreateOrUpdateResponse> => {
201
+ return this.client.sendOperationRequest(args, spec);
202
+ };
203
+ const sendOperationFn = async (
204
+ args: coreClient.OperationArguments,
205
+ spec: coreClient.OperationSpec
206
+ ) => {
207
+ let currentRawResponse:
208
+ | coreClient.FullOperationResponse
209
+ | undefined = undefined;
210
+ const providedCallback = args.options?.onResponse;
211
+ const callback: coreClient.RawResponseCallback = (
212
+ rawResponse: coreClient.FullOperationResponse,
213
+ flatResponse: unknown
214
+ ) => {
215
+ currentRawResponse = rawResponse;
216
+ providedCallback?.(rawResponse, flatResponse);
217
+ };
218
+ const updatedArgs = {
219
+ ...args,
220
+ options: {
221
+ ...args.options,
222
+ onResponse: callback
223
+ }
224
+ };
225
+ const flatResponse = await directSendOperation(updatedArgs, spec);
226
+ return {
227
+ flatResponse,
228
+ rawResponse: {
229
+ statusCode: currentRawResponse!.status,
230
+ body: currentRawResponse!.parsedBody,
231
+ headers: currentRawResponse!.headers.toJSON()
232
+ }
233
+ };
234
+ };
235
+
236
+ const lro = createLroSpec({
237
+ sendOperationFn,
238
+ args: { resourceGroupName, cloudHsmClusterName, location, options },
239
+ spec: createOrUpdateOperationSpec
240
+ });
241
+ const poller = await createHttpPoller<
242
+ CloudHsmClustersCreateOrUpdateResponse,
243
+ OperationState<CloudHsmClustersCreateOrUpdateResponse>
244
+ >(lro, {
245
+ restoreFrom: options?.resumeFrom,
246
+ intervalInMs: options?.updateIntervalInMs,
247
+ resourceLocationConfig: "original-uri"
248
+ });
249
+ await poller.poll();
250
+ return poller;
251
+ }
252
+
253
+ /**
254
+ * Create or Update a Cloud HSM Cluster in the specified subscription.
255
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
256
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
257
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
258
+ * @param location The geo-location where the resource lives
259
+ * @param options The options parameters.
260
+ */
261
+ async beginCreateOrUpdateAndWait(
262
+ resourceGroupName: string,
263
+ cloudHsmClusterName: string,
264
+ location: string,
265
+ options?: CloudHsmClustersCreateOrUpdateOptionalParams
266
+ ): Promise<CloudHsmClustersCreateOrUpdateResponse> {
267
+ const poller = await this.beginCreateOrUpdate(
268
+ resourceGroupName,
269
+ cloudHsmClusterName,
270
+ location,
271
+ options
272
+ );
273
+ return poller.pollUntilDone();
274
+ }
275
+
276
+ /**
277
+ * Update a Cloud HSM Cluster in the specified subscription.
278
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
279
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
280
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
281
+ * @param options The options parameters.
282
+ */
283
+ async beginUpdate(
284
+ resourceGroupName: string,
285
+ cloudHsmClusterName: string,
286
+ options?: CloudHsmClustersUpdateOptionalParams
287
+ ): Promise<
288
+ SimplePollerLike<
289
+ OperationState<CloudHsmClustersUpdateResponse>,
290
+ CloudHsmClustersUpdateResponse
291
+ >
292
+ > {
293
+ const directSendOperation = async (
294
+ args: coreClient.OperationArguments,
295
+ spec: coreClient.OperationSpec
296
+ ): Promise<CloudHsmClustersUpdateResponse> => {
297
+ return this.client.sendOperationRequest(args, spec);
298
+ };
299
+ const sendOperationFn = async (
300
+ args: coreClient.OperationArguments,
301
+ spec: coreClient.OperationSpec
302
+ ) => {
303
+ let currentRawResponse:
304
+ | coreClient.FullOperationResponse
305
+ | undefined = undefined;
306
+ const providedCallback = args.options?.onResponse;
307
+ const callback: coreClient.RawResponseCallback = (
308
+ rawResponse: coreClient.FullOperationResponse,
309
+ flatResponse: unknown
310
+ ) => {
311
+ currentRawResponse = rawResponse;
312
+ providedCallback?.(rawResponse, flatResponse);
313
+ };
314
+ const updatedArgs = {
315
+ ...args,
316
+ options: {
317
+ ...args.options,
318
+ onResponse: callback
319
+ }
320
+ };
321
+ const flatResponse = await directSendOperation(updatedArgs, spec);
322
+ return {
323
+ flatResponse,
324
+ rawResponse: {
325
+ statusCode: currentRawResponse!.status,
326
+ body: currentRawResponse!.parsedBody,
327
+ headers: currentRawResponse!.headers.toJSON()
328
+ }
329
+ };
330
+ };
331
+
332
+ const lro = createLroSpec({
333
+ sendOperationFn,
334
+ args: { resourceGroupName, cloudHsmClusterName, options },
335
+ spec: updateOperationSpec
336
+ });
337
+ const poller = await createHttpPoller<
338
+ CloudHsmClustersUpdateResponse,
339
+ OperationState<CloudHsmClustersUpdateResponse>
340
+ >(lro, {
341
+ restoreFrom: options?.resumeFrom,
342
+ intervalInMs: options?.updateIntervalInMs,
343
+ resourceLocationConfig: "location"
344
+ });
345
+ await poller.poll();
346
+ return poller;
347
+ }
348
+
349
+ /**
350
+ * Update a Cloud HSM Cluster in the specified subscription.
351
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
352
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
353
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
354
+ * @param options The options parameters.
355
+ */
356
+ async beginUpdateAndWait(
357
+ resourceGroupName: string,
358
+ cloudHsmClusterName: string,
359
+ options?: CloudHsmClustersUpdateOptionalParams
360
+ ): Promise<CloudHsmClustersUpdateResponse> {
361
+ const poller = await this.beginUpdate(
362
+ resourceGroupName,
363
+ cloudHsmClusterName,
364
+ options
365
+ );
366
+ return poller.pollUntilDone();
367
+ }
368
+
369
+ /**
370
+ * Gets the specified Cloud HSM Cluster
371
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
372
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
373
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
374
+ * @param options The options parameters.
375
+ */
376
+ get(
377
+ resourceGroupName: string,
378
+ cloudHsmClusterName: string,
379
+ options?: CloudHsmClustersGetOptionalParams
380
+ ): Promise<CloudHsmClustersGetResponse> {
381
+ return this.client.sendOperationRequest(
382
+ { resourceGroupName, cloudHsmClusterName, options },
383
+ getOperationSpec
384
+ );
385
+ }
386
+
387
+ /**
388
+ * Deletes the specified Cloud HSM Cluster
389
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
390
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
391
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
392
+ * @param options The options parameters.
393
+ */
394
+ async beginDelete(
395
+ resourceGroupName: string,
396
+ cloudHsmClusterName: string,
397
+ options?: CloudHsmClustersDeleteOptionalParams
398
+ ): Promise<SimplePollerLike<OperationState<void>, void>> {
399
+ const directSendOperation = async (
400
+ args: coreClient.OperationArguments,
401
+ spec: coreClient.OperationSpec
402
+ ): Promise<void> => {
403
+ return this.client.sendOperationRequest(args, spec);
404
+ };
405
+ const sendOperationFn = async (
406
+ args: coreClient.OperationArguments,
407
+ spec: coreClient.OperationSpec
408
+ ) => {
409
+ let currentRawResponse:
410
+ | coreClient.FullOperationResponse
411
+ | undefined = undefined;
412
+ const providedCallback = args.options?.onResponse;
413
+ const callback: coreClient.RawResponseCallback = (
414
+ rawResponse: coreClient.FullOperationResponse,
415
+ flatResponse: unknown
416
+ ) => {
417
+ currentRawResponse = rawResponse;
418
+ providedCallback?.(rawResponse, flatResponse);
419
+ };
420
+ const updatedArgs = {
421
+ ...args,
422
+ options: {
423
+ ...args.options,
424
+ onResponse: callback
425
+ }
426
+ };
427
+ const flatResponse = await directSendOperation(updatedArgs, spec);
428
+ return {
429
+ flatResponse,
430
+ rawResponse: {
431
+ statusCode: currentRawResponse!.status,
432
+ body: currentRawResponse!.parsedBody,
433
+ headers: currentRawResponse!.headers.toJSON()
434
+ }
435
+ };
436
+ };
437
+
438
+ const lro = createLroSpec({
439
+ sendOperationFn,
440
+ args: { resourceGroupName, cloudHsmClusterName, options },
441
+ spec: deleteOperationSpec
442
+ });
443
+ const poller = await createHttpPoller<void, OperationState<void>>(lro, {
444
+ restoreFrom: options?.resumeFrom,
445
+ intervalInMs: options?.updateIntervalInMs,
446
+ resourceLocationConfig: "location"
447
+ });
448
+ await poller.poll();
449
+ return poller;
450
+ }
451
+
452
+ /**
453
+ * Deletes the specified Cloud HSM Cluster
454
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
455
+ * @param cloudHsmClusterName The name of the Cloud HSM Cluster within the specified resource group.
456
+ * Cloud HSM Cluster names must be between 3 and 24 characters in length.
457
+ * @param options The options parameters.
458
+ */
459
+ async beginDeleteAndWait(
460
+ resourceGroupName: string,
461
+ cloudHsmClusterName: string,
462
+ options?: CloudHsmClustersDeleteOptionalParams
463
+ ): Promise<void> {
464
+ const poller = await this.beginDelete(
465
+ resourceGroupName,
466
+ cloudHsmClusterName,
467
+ options
468
+ );
469
+ return poller.pollUntilDone();
470
+ }
471
+
472
+ /**
473
+ * The List operation gets information about the Cloud HSM Clusters associated with the subscription
474
+ * and within the specified resource group.
475
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
476
+ * @param options The options parameters.
477
+ */
478
+ private _listByResourceGroup(
479
+ resourceGroupName: string,
480
+ options?: CloudHsmClustersListByResourceGroupOptionalParams
481
+ ): Promise<CloudHsmClustersListByResourceGroupResponse> {
482
+ return this.client.sendOperationRequest(
483
+ { resourceGroupName, options },
484
+ listByResourceGroupOperationSpec
485
+ );
486
+ }
487
+
488
+ /**
489
+ * The List operation gets information about the Cloud HSM Clusters associated with the subscription.
490
+ * @param options The options parameters.
491
+ */
492
+ private _listBySubscription(
493
+ options?: CloudHsmClustersListBySubscriptionOptionalParams
494
+ ): Promise<CloudHsmClustersListBySubscriptionResponse> {
495
+ return this.client.sendOperationRequest(
496
+ { options },
497
+ listBySubscriptionOperationSpec
498
+ );
499
+ }
500
+
501
+ /**
502
+ * ListByResourceGroupNext
503
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
504
+ * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
505
+ * @param options The options parameters.
506
+ */
507
+ private _listByResourceGroupNext(
508
+ resourceGroupName: string,
509
+ nextLink: string,
510
+ options?: CloudHsmClustersListByResourceGroupNextOptionalParams
511
+ ): Promise<CloudHsmClustersListByResourceGroupNextResponse> {
512
+ return this.client.sendOperationRequest(
513
+ { resourceGroupName, nextLink, options },
514
+ listByResourceGroupNextOperationSpec
515
+ );
516
+ }
517
+
518
+ /**
519
+ * ListBySubscriptionNext
520
+ * @param nextLink The nextLink from the previous successful call to the ListBySubscription method.
521
+ * @param options The options parameters.
522
+ */
523
+ private _listBySubscriptionNext(
524
+ nextLink: string,
525
+ options?: CloudHsmClustersListBySubscriptionNextOptionalParams
526
+ ): Promise<CloudHsmClustersListBySubscriptionNextResponse> {
527
+ return this.client.sendOperationRequest(
528
+ { nextLink, options },
529
+ listBySubscriptionNextOperationSpec
530
+ );
531
+ }
532
+ }
533
+ // Operation Specifications
534
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
535
+
536
+ const createOrUpdateOperationSpec: coreClient.OperationSpec = {
537
+ path:
538
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}",
539
+ httpMethod: "PUT",
540
+ responses: {
541
+ 200: {
542
+ bodyMapper: Mappers.CloudHsmCluster
543
+ },
544
+ 201: {
545
+ bodyMapper: Mappers.CloudHsmCluster
546
+ },
547
+ 202: {
548
+ bodyMapper: Mappers.CloudHsmCluster
549
+ },
550
+ 204: {
551
+ bodyMapper: Mappers.CloudHsmCluster
552
+ },
553
+ default: {
554
+ bodyMapper: Mappers.CloudHsmClusterError
555
+ }
556
+ },
557
+ requestBody: {
558
+ parameterPath: {
559
+ tags: ["options", "tags"],
560
+ location: ["location"],
561
+ sku: ["options", "sku"],
562
+ identity: ["options", "identity"],
563
+ provisioningState: ["options", "provisioningState"],
564
+ autoGeneratedDomainNameLabelScope: [
565
+ "options",
566
+ "autoGeneratedDomainNameLabelScope"
567
+ ],
568
+ securityDomain: ["options", "securityDomain"],
569
+ hsms: ["options", "hsms"],
570
+ publicNetworkAccess: ["options", "publicNetworkAccess"],
571
+ privateEndpointConnections: ["options", "privateEndpointConnections"],
572
+ restoreProperties: ["options", "restoreProperties"],
573
+ backupProperties: ["options", "backupProperties"]
574
+ },
575
+ mapper: { ...Mappers.CloudHsmCluster, required: true }
576
+ },
577
+ queryParameters: [Parameters.apiVersion],
578
+ urlParameters: [
579
+ Parameters.$host,
580
+ Parameters.subscriptionId,
581
+ Parameters.resourceGroupName,
582
+ Parameters.cloudHsmClusterName
583
+ ],
584
+ headerParameters: [Parameters.contentType, Parameters.accept],
585
+ mediaType: "json",
586
+ serializer
587
+ };
588
+ const updateOperationSpec: coreClient.OperationSpec = {
589
+ path:
590
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}",
591
+ httpMethod: "PATCH",
592
+ responses: {
593
+ 200: {
594
+ bodyMapper: Mappers.CloudHsmCluster
595
+ },
596
+ 201: {
597
+ bodyMapper: Mappers.CloudHsmCluster
598
+ },
599
+ 202: {
600
+ bodyMapper: Mappers.CloudHsmCluster
601
+ },
602
+ 204: {
603
+ bodyMapper: Mappers.CloudHsmCluster
604
+ },
605
+ default: {
606
+ bodyMapper: Mappers.CloudHsmClusterError
607
+ }
608
+ },
609
+ requestBody: {
610
+ parameterPath: {
611
+ tags: ["options", "tags"],
612
+ sku: ["options", "sku"],
613
+ identity: ["options", "identity"],
614
+ backupProperties: ["options", "backupProperties"]
615
+ },
616
+ mapper: { ...Mappers.CloudHsmClusterPatchParameters, required: true }
617
+ },
618
+ queryParameters: [Parameters.apiVersion],
619
+ urlParameters: [
620
+ Parameters.$host,
621
+ Parameters.subscriptionId,
622
+ Parameters.resourceGroupName,
623
+ Parameters.cloudHsmClusterName
624
+ ],
625
+ headerParameters: [Parameters.contentType, Parameters.accept],
626
+ mediaType: "json",
627
+ serializer
628
+ };
629
+ const getOperationSpec: coreClient.OperationSpec = {
630
+ path:
631
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}",
632
+ httpMethod: "GET",
633
+ responses: {
634
+ 200: {
635
+ bodyMapper: Mappers.CloudHsmCluster
636
+ },
637
+ default: {
638
+ bodyMapper: Mappers.CloudHsmClusterError
639
+ }
640
+ },
641
+ queryParameters: [Parameters.apiVersion],
642
+ urlParameters: [
643
+ Parameters.$host,
644
+ Parameters.subscriptionId,
645
+ Parameters.resourceGroupName,
646
+ Parameters.cloudHsmClusterName
647
+ ],
648
+ headerParameters: [Parameters.accept],
649
+ serializer
650
+ };
651
+ const deleteOperationSpec: coreClient.OperationSpec = {
652
+ path:
653
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}",
654
+ httpMethod: "DELETE",
655
+ responses: {
656
+ 200: {},
657
+ 201: {},
658
+ 202: {},
659
+ 204: {},
660
+ default: {
661
+ bodyMapper: Mappers.CloudHsmClusterError
662
+ }
663
+ },
664
+ queryParameters: [Parameters.apiVersion],
665
+ urlParameters: [
666
+ Parameters.$host,
667
+ Parameters.subscriptionId,
668
+ Parameters.resourceGroupName,
669
+ Parameters.cloudHsmClusterName
670
+ ],
671
+ headerParameters: [Parameters.accept],
672
+ serializer
673
+ };
674
+ const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
675
+ path:
676
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters",
677
+ httpMethod: "GET",
678
+ responses: {
679
+ 200: {
680
+ bodyMapper: Mappers.CloudHsmClusterListResult
681
+ },
682
+ default: {
683
+ bodyMapper: Mappers.CloudHsmClusterError
684
+ }
685
+ },
686
+ queryParameters: [Parameters.apiVersion, Parameters.skiptoken],
687
+ urlParameters: [
688
+ Parameters.$host,
689
+ Parameters.subscriptionId,
690
+ Parameters.resourceGroupName
691
+ ],
692
+ headerParameters: [Parameters.accept],
693
+ serializer
694
+ };
695
+ const listBySubscriptionOperationSpec: coreClient.OperationSpec = {
696
+ path:
697
+ "/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters",
698
+ httpMethod: "GET",
699
+ responses: {
700
+ 200: {
701
+ bodyMapper: Mappers.CloudHsmClusterListResult
702
+ },
703
+ default: {
704
+ bodyMapper: Mappers.CloudHsmClusterError
705
+ }
706
+ },
707
+ queryParameters: [Parameters.apiVersion, Parameters.skiptoken],
708
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
709
+ headerParameters: [Parameters.accept],
710
+ serializer
711
+ };
712
+ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
713
+ path: "{nextLink}",
714
+ httpMethod: "GET",
715
+ responses: {
716
+ 200: {
717
+ bodyMapper: Mappers.CloudHsmClusterListResult
718
+ },
719
+ default: {
720
+ bodyMapper: Mappers.CloudHsmClusterError
721
+ }
722
+ },
723
+ urlParameters: [
724
+ Parameters.$host,
725
+ Parameters.subscriptionId,
726
+ Parameters.resourceGroupName,
727
+ Parameters.nextLink
728
+ ],
729
+ headerParameters: [Parameters.accept],
730
+ serializer
731
+ };
732
+ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
733
+ path: "{nextLink}",
734
+ httpMethod: "GET",
735
+ responses: {
736
+ 200: {
737
+ bodyMapper: Mappers.CloudHsmClusterListResult
738
+ },
739
+ default: {
740
+ bodyMapper: Mappers.CloudHsmClusterError
741
+ }
742
+ },
743
+ urlParameters: [
744
+ Parameters.$host,
745
+ Parameters.subscriptionId,
746
+ Parameters.nextLink
747
+ ],
748
+ headerParameters: [Parameters.accept],
749
+ serializer
750
+ };