@azure/arm-extendedlocation 1.0.0-alpha.20220414.1 → 1.0.0-beta.2

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 (129) hide show
  1. package/CHANGELOG.md +39 -10
  2. package/LICENSE +1 -1
  3. package/README.md +23 -8
  4. package/dist/index.js +783 -86
  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/customLocationsCreateOrUpdateSample.d.ts +2 -0
  9. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.js +42 -0
  11. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.js.map +1 -0
  12. package/dist-esm/samples-dev/customLocationsDeleteSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/customLocationsDeleteSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/customLocationsDeleteSample.js +31 -0
  15. package/dist-esm/samples-dev/customLocationsDeleteSample.js.map +1 -0
  16. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.js +34 -0
  19. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.js.map +1 -0
  20. package/dist-esm/samples-dev/customLocationsGetSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/customLocationsGetSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/customLocationsGetSample.js +31 -0
  23. package/dist-esm/samples-dev/customLocationsGetSample.js.map +1 -0
  24. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.js +44 -0
  27. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.js.map +1 -0
  28. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.js +43 -0
  31. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.js.map +1 -0
  32. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.js +45 -0
  35. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.js.map +1 -0
  36. package/dist-esm/samples-dev/customLocationsListOperationsSample.d.ts +2 -0
  37. package/dist-esm/samples-dev/customLocationsListOperationsSample.d.ts.map +1 -0
  38. package/dist-esm/samples-dev/customLocationsListOperationsSample.js +43 -0
  39. package/dist-esm/samples-dev/customLocationsListOperationsSample.js.map +1 -0
  40. package/dist-esm/samples-dev/customLocationsUpdateSample.d.ts +2 -0
  41. package/dist-esm/samples-dev/customLocationsUpdateSample.d.ts.map +1 -0
  42. package/dist-esm/samples-dev/customLocationsUpdateSample.js +34 -0
  43. package/dist-esm/samples-dev/customLocationsUpdateSample.js.map +1 -0
  44. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.d.ts +2 -0
  45. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.d.ts.map +1 -0
  46. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.js +41 -0
  47. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.js.map +1 -0
  48. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.d.ts +2 -0
  49. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.d.ts.map +1 -0
  50. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.js +32 -0
  51. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.js.map +1 -0
  52. package/dist-esm/samples-dev/resourceSyncRulesGetSample.d.ts +2 -0
  53. package/dist-esm/samples-dev/resourceSyncRulesGetSample.d.ts.map +1 -0
  54. package/dist-esm/samples-dev/resourceSyncRulesGetSample.js +32 -0
  55. package/dist-esm/samples-dev/resourceSyncRulesGetSample.js.map +1 -0
  56. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.d.ts +2 -0
  57. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.d.ts.map +1 -0
  58. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.js +45 -0
  59. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.js.map +1 -0
  60. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.d.ts +2 -0
  61. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.d.ts.map +1 -0
  62. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.js +34 -0
  63. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.js.map +1 -0
  64. package/dist-esm/src/customLocationsManagementClient.d.ts +9 -3
  65. package/dist-esm/src/customLocationsManagementClient.d.ts.map +1 -1
  66. package/dist-esm/src/customLocationsManagementClient.js +81 -4
  67. package/dist-esm/src/customLocationsManagementClient.js.map +1 -1
  68. package/dist-esm/src/index.d.ts +0 -1
  69. package/dist-esm/src/index.d.ts.map +1 -1
  70. package/dist-esm/src/index.js +0 -1
  71. package/dist-esm/src/index.js.map +1 -1
  72. package/dist-esm/src/models/index.d.ts +172 -25
  73. package/dist-esm/src/models/index.d.ts.map +1 -1
  74. package/dist-esm/src/models/index.js +7 -0
  75. package/dist-esm/src/models/index.js.map +1 -1
  76. package/dist-esm/src/models/mappers.d.ts +8 -1
  77. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  78. package/dist-esm/src/models/mappers.js +228 -29
  79. package/dist-esm/src/models/mappers.js.map +1 -1
  80. package/dist-esm/src/models/parameters.d.ts +7 -0
  81. package/dist-esm/src/models/parameters.d.ts.map +1 -1
  82. package/dist-esm/src/models/parameters.js +41 -2
  83. package/dist-esm/src/models/parameters.js.map +1 -1
  84. package/dist-esm/src/operations/customLocations.d.ts +12 -3
  85. package/dist-esm/src/operations/customLocations.d.ts.map +1 -1
  86. package/dist-esm/src/operations/customLocations.js +41 -2
  87. package/dist-esm/src/operations/customLocations.js.map +1 -1
  88. package/dist-esm/src/operations/index.d.ts +1 -0
  89. package/dist-esm/src/operations/index.d.ts.map +1 -1
  90. package/dist-esm/src/operations/index.js +1 -0
  91. package/dist-esm/src/operations/index.js.map +1 -1
  92. package/dist-esm/src/operations/resourceSyncRules.d.ts +97 -0
  93. package/dist-esm/src/operations/resourceSyncRules.d.ts.map +1 -0
  94. package/dist-esm/src/operations/resourceSyncRules.js +400 -0
  95. package/dist-esm/src/operations/resourceSyncRules.js.map +1 -0
  96. package/dist-esm/src/operationsInterfaces/customLocations.d.ts +10 -1
  97. package/dist-esm/src/operationsInterfaces/customLocations.d.ts.map +1 -1
  98. package/dist-esm/src/operationsInterfaces/index.d.ts +1 -0
  99. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -1
  100. package/dist-esm/src/operationsInterfaces/index.js +1 -0
  101. package/dist-esm/src/operationsInterfaces/index.js.map +1 -1
  102. package/dist-esm/src/operationsInterfaces/resourceSyncRules.d.ts +71 -0
  103. package/dist-esm/src/operationsInterfaces/resourceSyncRules.d.ts.map +1 -0
  104. package/dist-esm/src/operationsInterfaces/resourceSyncRules.js +9 -0
  105. package/dist-esm/src/operationsInterfaces/resourceSyncRules.js.map +1 -0
  106. package/dist-esm/test/sampleTest.js +11 -13
  107. package/dist-esm/test/sampleTest.js.map +1 -1
  108. package/package.json +39 -20
  109. package/review/arm-extendedlocation.api.md +139 -27
  110. package/rollup.config.js +6 -72
  111. package/src/customLocationsManagementClient.ts +109 -5
  112. package/src/index.ts +0 -1
  113. package/src/models/index.ts +186 -26
  114. package/src/models/mappers.ts +243 -30
  115. package/src/models/parameters.ts +53 -2
  116. package/src/operations/customLocations.ts +57 -5
  117. package/src/operations/index.ts +1 -0
  118. package/src/operations/resourceSyncRules.ts +562 -0
  119. package/src/operationsInterfaces/customLocations.ts +18 -1
  120. package/src/operationsInterfaces/index.ts +1 -0
  121. package/src/operationsInterfaces/resourceSyncRules.ts +136 -0
  122. package/tsconfig.json +19 -5
  123. package/types/arm-extendedlocation.d.ts +257 -20
  124. package/types/tsdoc-metadata.json +1 -1
  125. package/dist-esm/src/customLocationsManagementClientContext.d.ts +0 -16
  126. package/dist-esm/src/customLocationsManagementClientContext.d.ts.map +0 -1
  127. package/dist-esm/src/customLocationsManagementClientContext.js +0 -49
  128. package/dist-esm/src/customLocationsManagementClientContext.js.map +0 -1
  129. package/src/customLocationsManagementClientContext.ts +0 -70
@@ -11,7 +11,7 @@ import { CustomLocations } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
13
13
  import * as Parameters from "../models/parameters";
14
- import { CustomLocationsManagementClientContext } from "../customLocationsManagementClientContext";
14
+ import { CustomLocationsManagementClient } from "../customLocationsManagementClient";
15
15
  import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
16
16
  import { LroImpl } from "../lroImpl";
17
17
  import {
@@ -37,6 +37,9 @@ import {
37
37
  CustomLocationsUpdateOptionalParams,
38
38
  CustomLocationsUpdateResponse,
39
39
  CustomLocationsListEnabledResourceTypesResponse,
40
+ CustomLocationFindTargetResourceGroupProperties,
41
+ CustomLocationsFindTargetResourceGroupOptionalParams,
42
+ CustomLocationsFindTargetResourceGroupResponse,
40
43
  CustomLocationsListOperationsNextResponse,
41
44
  CustomLocationsListBySubscriptionNextResponse,
42
45
  CustomLocationsListByResourceGroupNextResponse,
@@ -46,13 +49,13 @@ import {
46
49
  /// <reference lib="esnext.asynciterable" />
47
50
  /** Class containing CustomLocations operations. */
48
51
  export class CustomLocationsImpl implements CustomLocations {
49
- private readonly client: CustomLocationsManagementClientContext;
52
+ private readonly client: CustomLocationsManagementClient;
50
53
 
51
54
  /**
52
55
  * Initialize a new instance of the class CustomLocations class.
53
56
  * @param client Reference to the service client
54
57
  */
55
- constructor(client: CustomLocationsManagementClientContext) {
58
+ constructor(client: CustomLocationsManagementClient) {
56
59
  this.client = client;
57
60
  }
58
61
 
@@ -388,11 +391,13 @@ export class CustomLocationsImpl implements CustomLocations {
388
391
  { resourceGroupName, resourceName, parameters, options },
389
392
  createOrUpdateOperationSpec
390
393
  );
391
- return new LroEngine(lro, {
394
+ const poller = new LroEngine(lro, {
392
395
  resumeFrom: options?.resumeFrom,
393
396
  intervalInMs: options?.updateIntervalInMs,
394
397
  lroResourceLocationConfig: "azure-async-operation"
395
398
  });
399
+ await poller.poll();
400
+ return poller;
396
401
  }
397
402
 
398
403
  /**
@@ -472,11 +477,13 @@ export class CustomLocationsImpl implements CustomLocations {
472
477
  { resourceGroupName, resourceName, options },
473
478
  deleteOperationSpec
474
479
  );
475
- return new LroEngine(lro, {
480
+ const poller = new LroEngine(lro, {
476
481
  resumeFrom: options?.resumeFrom,
477
482
  intervalInMs: options?.updateIntervalInMs,
478
483
  lroResourceLocationConfig: "azure-async-operation"
479
484
  });
485
+ await poller.poll();
486
+ return poller;
480
487
  }
481
488
 
482
489
  /**
@@ -533,6 +540,26 @@ export class CustomLocationsImpl implements CustomLocations {
533
540
  );
534
541
  }
535
542
 
543
+ /**
544
+ * Returns the target resource group associated with the resource sync rules of the Custom Location
545
+ * that match the rules passed in with the Find Target Resource Group Request.
546
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
547
+ * @param resourceName Custom Locations name.
548
+ * @param parameters Parameters of the find target resource group request.
549
+ * @param options The options parameters.
550
+ */
551
+ findTargetResourceGroup(
552
+ resourceGroupName: string,
553
+ resourceName: string,
554
+ parameters: CustomLocationFindTargetResourceGroupProperties,
555
+ options?: CustomLocationsFindTargetResourceGroupOptionalParams
556
+ ): Promise<CustomLocationsFindTargetResourceGroupResponse> {
557
+ return this.client.sendOperationRequest(
558
+ { resourceGroupName, resourceName, parameters, options },
559
+ findTargetResourceGroupOperationSpec
560
+ );
561
+ }
562
+
536
563
  /**
537
564
  * ListOperationsNext
538
565
  * @param nextLink The nextLink from the previous successful call to the ListOperations method.
@@ -794,6 +821,31 @@ const listEnabledResourceTypesOperationSpec: coreClient.OperationSpec = {
794
821
  headerParameters: [Parameters.accept],
795
822
  serializer
796
823
  };
824
+ const findTargetResourceGroupOperationSpec: coreClient.OperationSpec = {
825
+ path:
826
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}/findTargetResourceGroup",
827
+ httpMethod: "POST",
828
+ responses: {
829
+ 200: {
830
+ bodyMapper: Mappers.CustomLocationFindTargetResourceGroupResult
831
+ },
832
+ 204: {},
833
+ default: {
834
+ bodyMapper: Mappers.ErrorResponse
835
+ }
836
+ },
837
+ requestBody: Parameters.parameters2,
838
+ queryParameters: [Parameters.apiVersion],
839
+ urlParameters: [
840
+ Parameters.$host,
841
+ Parameters.subscriptionId,
842
+ Parameters.resourceGroupName,
843
+ Parameters.resourceName
844
+ ],
845
+ headerParameters: [Parameters.accept, Parameters.contentType],
846
+ mediaType: "json",
847
+ serializer
848
+ };
797
849
  const listOperationsNextOperationSpec: coreClient.OperationSpec = {
798
850
  path: "{nextLink}",
799
851
  httpMethod: "GET",
@@ -7,3 +7,4 @@
7
7
  */
8
8
 
9
9
  export * from "./customLocations";
10
+ export * from "./resourceSyncRules";
@@ -0,0 +1,562 @@
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 } from "@azure/core-paging";
10
+ import { ResourceSyncRules } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
13
+ import * as Parameters from "../models/parameters";
14
+ import { CustomLocationsManagementClient } from "../customLocationsManagementClient";
15
+ import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
16
+ import { LroImpl } from "../lroImpl";
17
+ import {
18
+ ResourceSyncRule,
19
+ ResourceSyncRulesListByCustomLocationIDNextOptionalParams,
20
+ ResourceSyncRulesListByCustomLocationIDOptionalParams,
21
+ ResourceSyncRulesListByCustomLocationIDResponse,
22
+ ResourceSyncRulesGetOptionalParams,
23
+ ResourceSyncRulesGetResponse,
24
+ ResourceSyncRulesCreateOrUpdateOptionalParams,
25
+ ResourceSyncRulesCreateOrUpdateResponse,
26
+ ResourceSyncRulesDeleteOptionalParams,
27
+ ResourceSyncRulesUpdateOptionalParams,
28
+ ResourceSyncRulesUpdateResponse,
29
+ ResourceSyncRulesListByCustomLocationIDNextResponse
30
+ } from "../models";
31
+
32
+ /// <reference lib="esnext.asynciterable" />
33
+ /** Class containing ResourceSyncRules operations. */
34
+ export class ResourceSyncRulesImpl implements ResourceSyncRules {
35
+ private readonly client: CustomLocationsManagementClient;
36
+
37
+ /**
38
+ * Initialize a new instance of the class ResourceSyncRules class.
39
+ * @param client Reference to the service client
40
+ */
41
+ constructor(client: CustomLocationsManagementClient) {
42
+ this.client = client;
43
+ }
44
+
45
+ /**
46
+ * Gets a list of Resource Sync Rules in the specified subscription. The operation returns properties
47
+ * of each Resource Sync Rule
48
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
49
+ * @param resourceName Custom Locations name.
50
+ * @param options The options parameters.
51
+ */
52
+ public listByCustomLocationID(
53
+ resourceGroupName: string,
54
+ resourceName: string,
55
+ options?: ResourceSyncRulesListByCustomLocationIDOptionalParams
56
+ ): PagedAsyncIterableIterator<ResourceSyncRule> {
57
+ const iter = this.listByCustomLocationIDPagingAll(
58
+ resourceGroupName,
59
+ resourceName,
60
+ options
61
+ );
62
+ return {
63
+ next() {
64
+ return iter.next();
65
+ },
66
+ [Symbol.asyncIterator]() {
67
+ return this;
68
+ },
69
+ byPage: () => {
70
+ return this.listByCustomLocationIDPagingPage(
71
+ resourceGroupName,
72
+ resourceName,
73
+ options
74
+ );
75
+ }
76
+ };
77
+ }
78
+
79
+ private async *listByCustomLocationIDPagingPage(
80
+ resourceGroupName: string,
81
+ resourceName: string,
82
+ options?: ResourceSyncRulesListByCustomLocationIDOptionalParams
83
+ ): AsyncIterableIterator<ResourceSyncRule[]> {
84
+ let result = await this._listByCustomLocationID(
85
+ resourceGroupName,
86
+ resourceName,
87
+ options
88
+ );
89
+ yield result.value || [];
90
+ let continuationToken = result.nextLink;
91
+ while (continuationToken) {
92
+ result = await this._listByCustomLocationIDNext(
93
+ resourceGroupName,
94
+ resourceName,
95
+ continuationToken,
96
+ options
97
+ );
98
+ continuationToken = result.nextLink;
99
+ yield result.value || [];
100
+ }
101
+ }
102
+
103
+ private async *listByCustomLocationIDPagingAll(
104
+ resourceGroupName: string,
105
+ resourceName: string,
106
+ options?: ResourceSyncRulesListByCustomLocationIDOptionalParams
107
+ ): AsyncIterableIterator<ResourceSyncRule> {
108
+ for await (const page of this.listByCustomLocationIDPagingPage(
109
+ resourceGroupName,
110
+ resourceName,
111
+ options
112
+ )) {
113
+ yield* page;
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Gets a list of Resource Sync Rules in the specified subscription. The operation returns properties
119
+ * of each Resource Sync Rule
120
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
121
+ * @param resourceName Custom Locations name.
122
+ * @param options The options parameters.
123
+ */
124
+ private _listByCustomLocationID(
125
+ resourceGroupName: string,
126
+ resourceName: string,
127
+ options?: ResourceSyncRulesListByCustomLocationIDOptionalParams
128
+ ): Promise<ResourceSyncRulesListByCustomLocationIDResponse> {
129
+ return this.client.sendOperationRequest(
130
+ { resourceGroupName, resourceName, options },
131
+ listByCustomLocationIDOperationSpec
132
+ );
133
+ }
134
+
135
+ /**
136
+ * Gets the details of the resourceSyncRule with a specified resource group, subscription id Custom
137
+ * Location resource name and Resource Sync Rule name.
138
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
139
+ * @param resourceName Custom Locations name.
140
+ * @param childResourceName Resource Sync Rule name.
141
+ * @param options The options parameters.
142
+ */
143
+ get(
144
+ resourceGroupName: string,
145
+ resourceName: string,
146
+ childResourceName: string,
147
+ options?: ResourceSyncRulesGetOptionalParams
148
+ ): Promise<ResourceSyncRulesGetResponse> {
149
+ return this.client.sendOperationRequest(
150
+ { resourceGroupName, resourceName, childResourceName, options },
151
+ getOperationSpec
152
+ );
153
+ }
154
+
155
+ /**
156
+ * Creates or updates a Resource Sync Rule in the parent Custom Location, Subscription Id and Resource
157
+ * Group
158
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
159
+ * @param resourceName Custom Locations name.
160
+ * @param childResourceName Resource Sync Rule name.
161
+ * @param parameters Parameters supplied to create or update a Resource Sync Rule.
162
+ * @param options The options parameters.
163
+ */
164
+ async beginCreateOrUpdate(
165
+ resourceGroupName: string,
166
+ resourceName: string,
167
+ childResourceName: string,
168
+ parameters: ResourceSyncRule,
169
+ options?: ResourceSyncRulesCreateOrUpdateOptionalParams
170
+ ): Promise<
171
+ PollerLike<
172
+ PollOperationState<ResourceSyncRulesCreateOrUpdateResponse>,
173
+ ResourceSyncRulesCreateOrUpdateResponse
174
+ >
175
+ > {
176
+ const directSendOperation = async (
177
+ args: coreClient.OperationArguments,
178
+ spec: coreClient.OperationSpec
179
+ ): Promise<ResourceSyncRulesCreateOrUpdateResponse> => {
180
+ return this.client.sendOperationRequest(args, spec);
181
+ };
182
+ const sendOperation = async (
183
+ args: coreClient.OperationArguments,
184
+ spec: coreClient.OperationSpec
185
+ ) => {
186
+ let currentRawResponse:
187
+ | coreClient.FullOperationResponse
188
+ | undefined = undefined;
189
+ const providedCallback = args.options?.onResponse;
190
+ const callback: coreClient.RawResponseCallback = (
191
+ rawResponse: coreClient.FullOperationResponse,
192
+ flatResponse: unknown
193
+ ) => {
194
+ currentRawResponse = rawResponse;
195
+ providedCallback?.(rawResponse, flatResponse);
196
+ };
197
+ const updatedArgs = {
198
+ ...args,
199
+ options: {
200
+ ...args.options,
201
+ onResponse: callback
202
+ }
203
+ };
204
+ const flatResponse = await directSendOperation(updatedArgs, spec);
205
+ return {
206
+ flatResponse,
207
+ rawResponse: {
208
+ statusCode: currentRawResponse!.status,
209
+ body: currentRawResponse!.parsedBody,
210
+ headers: currentRawResponse!.headers.toJSON()
211
+ }
212
+ };
213
+ };
214
+
215
+ const lro = new LroImpl(
216
+ sendOperation,
217
+ {
218
+ resourceGroupName,
219
+ resourceName,
220
+ childResourceName,
221
+ parameters,
222
+ options
223
+ },
224
+ createOrUpdateOperationSpec
225
+ );
226
+ const poller = new LroEngine(lro, {
227
+ resumeFrom: options?.resumeFrom,
228
+ intervalInMs: options?.updateIntervalInMs,
229
+ lroResourceLocationConfig: "azure-async-operation"
230
+ });
231
+ await poller.poll();
232
+ return poller;
233
+ }
234
+
235
+ /**
236
+ * Creates or updates a Resource Sync Rule in the parent Custom Location, Subscription Id and Resource
237
+ * Group
238
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
239
+ * @param resourceName Custom Locations name.
240
+ * @param childResourceName Resource Sync Rule name.
241
+ * @param parameters Parameters supplied to create or update a Resource Sync Rule.
242
+ * @param options The options parameters.
243
+ */
244
+ async beginCreateOrUpdateAndWait(
245
+ resourceGroupName: string,
246
+ resourceName: string,
247
+ childResourceName: string,
248
+ parameters: ResourceSyncRule,
249
+ options?: ResourceSyncRulesCreateOrUpdateOptionalParams
250
+ ): Promise<ResourceSyncRulesCreateOrUpdateResponse> {
251
+ const poller = await this.beginCreateOrUpdate(
252
+ resourceGroupName,
253
+ resourceName,
254
+ childResourceName,
255
+ parameters,
256
+ options
257
+ );
258
+ return poller.pollUntilDone();
259
+ }
260
+
261
+ /**
262
+ * Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource
263
+ * Name, Resource Group, and Subscription Id.
264
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
265
+ * @param resourceName Custom Locations name.
266
+ * @param childResourceName Resource Sync Rule name.
267
+ * @param options The options parameters.
268
+ */
269
+ delete(
270
+ resourceGroupName: string,
271
+ resourceName: string,
272
+ childResourceName: string,
273
+ options?: ResourceSyncRulesDeleteOptionalParams
274
+ ): Promise<void> {
275
+ return this.client.sendOperationRequest(
276
+ { resourceGroupName, resourceName, childResourceName, options },
277
+ deleteOperationSpec
278
+ );
279
+ }
280
+
281
+ /**
282
+ * Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource
283
+ * Group, Subscription and Custom Location name.
284
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
285
+ * @param resourceName Custom Locations name.
286
+ * @param childResourceName Resource Sync Rule name.
287
+ * @param options The options parameters.
288
+ */
289
+ async beginUpdate(
290
+ resourceGroupName: string,
291
+ resourceName: string,
292
+ childResourceName: string,
293
+ options?: ResourceSyncRulesUpdateOptionalParams
294
+ ): Promise<
295
+ PollerLike<
296
+ PollOperationState<ResourceSyncRulesUpdateResponse>,
297
+ ResourceSyncRulesUpdateResponse
298
+ >
299
+ > {
300
+ const directSendOperation = async (
301
+ args: coreClient.OperationArguments,
302
+ spec: coreClient.OperationSpec
303
+ ): Promise<ResourceSyncRulesUpdateResponse> => {
304
+ return this.client.sendOperationRequest(args, spec);
305
+ };
306
+ const sendOperation = async (
307
+ args: coreClient.OperationArguments,
308
+ spec: coreClient.OperationSpec
309
+ ) => {
310
+ let currentRawResponse:
311
+ | coreClient.FullOperationResponse
312
+ | undefined = undefined;
313
+ const providedCallback = args.options?.onResponse;
314
+ const callback: coreClient.RawResponseCallback = (
315
+ rawResponse: coreClient.FullOperationResponse,
316
+ flatResponse: unknown
317
+ ) => {
318
+ currentRawResponse = rawResponse;
319
+ providedCallback?.(rawResponse, flatResponse);
320
+ };
321
+ const updatedArgs = {
322
+ ...args,
323
+ options: {
324
+ ...args.options,
325
+ onResponse: callback
326
+ }
327
+ };
328
+ const flatResponse = await directSendOperation(updatedArgs, spec);
329
+ return {
330
+ flatResponse,
331
+ rawResponse: {
332
+ statusCode: currentRawResponse!.status,
333
+ body: currentRawResponse!.parsedBody,
334
+ headers: currentRawResponse!.headers.toJSON()
335
+ }
336
+ };
337
+ };
338
+
339
+ const lro = new LroImpl(
340
+ sendOperation,
341
+ { resourceGroupName, resourceName, childResourceName, options },
342
+ updateOperationSpec
343
+ );
344
+ const poller = new LroEngine(lro, {
345
+ resumeFrom: options?.resumeFrom,
346
+ intervalInMs: options?.updateIntervalInMs,
347
+ lroResourceLocationConfig: "azure-async-operation"
348
+ });
349
+ await poller.poll();
350
+ return poller;
351
+ }
352
+
353
+ /**
354
+ * Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource
355
+ * Group, Subscription and Custom Location name.
356
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
357
+ * @param resourceName Custom Locations name.
358
+ * @param childResourceName Resource Sync Rule name.
359
+ * @param options The options parameters.
360
+ */
361
+ async beginUpdateAndWait(
362
+ resourceGroupName: string,
363
+ resourceName: string,
364
+ childResourceName: string,
365
+ options?: ResourceSyncRulesUpdateOptionalParams
366
+ ): Promise<ResourceSyncRulesUpdateResponse> {
367
+ const poller = await this.beginUpdate(
368
+ resourceGroupName,
369
+ resourceName,
370
+ childResourceName,
371
+ options
372
+ );
373
+ return poller.pollUntilDone();
374
+ }
375
+
376
+ /**
377
+ * ListByCustomLocationIDNext
378
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
379
+ * @param resourceName Custom Locations name.
380
+ * @param nextLink The nextLink from the previous successful call to the ListByCustomLocationID method.
381
+ * @param options The options parameters.
382
+ */
383
+ private _listByCustomLocationIDNext(
384
+ resourceGroupName: string,
385
+ resourceName: string,
386
+ nextLink: string,
387
+ options?: ResourceSyncRulesListByCustomLocationIDNextOptionalParams
388
+ ): Promise<ResourceSyncRulesListByCustomLocationIDNextResponse> {
389
+ return this.client.sendOperationRequest(
390
+ { resourceGroupName, resourceName, nextLink, options },
391
+ listByCustomLocationIDNextOperationSpec
392
+ );
393
+ }
394
+ }
395
+ // Operation Specifications
396
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
397
+
398
+ const listByCustomLocationIDOperationSpec: coreClient.OperationSpec = {
399
+ path:
400
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}/resourceSyncRules",
401
+ httpMethod: "GET",
402
+ responses: {
403
+ 200: {
404
+ bodyMapper: Mappers.ResourceSyncRuleListResult
405
+ },
406
+ default: {
407
+ bodyMapper: Mappers.ErrorResponse
408
+ }
409
+ },
410
+ queryParameters: [Parameters.apiVersion],
411
+ urlParameters: [
412
+ Parameters.$host,
413
+ Parameters.subscriptionId,
414
+ Parameters.resourceGroupName,
415
+ Parameters.resourceName
416
+ ],
417
+ headerParameters: [Parameters.accept],
418
+ serializer
419
+ };
420
+ const getOperationSpec: coreClient.OperationSpec = {
421
+ path:
422
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}/resourceSyncRules/{childResourceName}",
423
+ httpMethod: "GET",
424
+ responses: {
425
+ 200: {
426
+ bodyMapper: Mappers.ResourceSyncRule
427
+ },
428
+ default: {
429
+ bodyMapper: Mappers.ErrorResponse
430
+ }
431
+ },
432
+ queryParameters: [Parameters.apiVersion],
433
+ urlParameters: [
434
+ Parameters.$host,
435
+ Parameters.subscriptionId,
436
+ Parameters.resourceGroupName,
437
+ Parameters.resourceName,
438
+ Parameters.childResourceName
439
+ ],
440
+ headerParameters: [Parameters.accept],
441
+ serializer
442
+ };
443
+ const createOrUpdateOperationSpec: coreClient.OperationSpec = {
444
+ path:
445
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}/resourceSyncRules/{childResourceName}",
446
+ httpMethod: "PUT",
447
+ responses: {
448
+ 200: {
449
+ bodyMapper: Mappers.ResourceSyncRule
450
+ },
451
+ 201: {
452
+ bodyMapper: Mappers.ResourceSyncRule
453
+ },
454
+ 202: {
455
+ bodyMapper: Mappers.ResourceSyncRule
456
+ },
457
+ 204: {
458
+ bodyMapper: Mappers.ResourceSyncRule
459
+ },
460
+ default: {
461
+ bodyMapper: Mappers.ErrorResponse
462
+ }
463
+ },
464
+ requestBody: Parameters.parameters3,
465
+ queryParameters: [Parameters.apiVersion],
466
+ urlParameters: [
467
+ Parameters.$host,
468
+ Parameters.subscriptionId,
469
+ Parameters.resourceGroupName,
470
+ Parameters.resourceName,
471
+ Parameters.childResourceName
472
+ ],
473
+ headerParameters: [Parameters.accept, Parameters.contentType],
474
+ mediaType: "json",
475
+ serializer
476
+ };
477
+ const deleteOperationSpec: coreClient.OperationSpec = {
478
+ path:
479
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}/resourceSyncRules/{childResourceName}",
480
+ httpMethod: "DELETE",
481
+ responses: {
482
+ 200: {},
483
+ 204: {},
484
+ default: {
485
+ bodyMapper: Mappers.ErrorResponse
486
+ }
487
+ },
488
+ queryParameters: [Parameters.apiVersion],
489
+ urlParameters: [
490
+ Parameters.$host,
491
+ Parameters.subscriptionId,
492
+ Parameters.resourceGroupName,
493
+ Parameters.resourceName,
494
+ Parameters.childResourceName
495
+ ],
496
+ headerParameters: [Parameters.accept],
497
+ serializer
498
+ };
499
+ const updateOperationSpec: coreClient.OperationSpec = {
500
+ path:
501
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}/resourceSyncRules/{childResourceName}",
502
+ httpMethod: "PATCH",
503
+ responses: {
504
+ 200: {
505
+ bodyMapper: Mappers.ResourceSyncRule
506
+ },
507
+ 201: {
508
+ bodyMapper: Mappers.ResourceSyncRule
509
+ },
510
+ 202: {
511
+ bodyMapper: Mappers.ResourceSyncRule
512
+ },
513
+ 204: {
514
+ bodyMapper: Mappers.ResourceSyncRule
515
+ },
516
+ default: {
517
+ bodyMapper: Mappers.ErrorResponse
518
+ }
519
+ },
520
+ requestBody: {
521
+ parameterPath: {
522
+ tags: ["options", "tags"],
523
+ priority: ["options", "priority"],
524
+ selector: ["options", "selector"],
525
+ targetResourceGroup: ["options", "targetResourceGroup"]
526
+ },
527
+ mapper: { ...Mappers.PatchableResourceSyncRule, required: true }
528
+ },
529
+ queryParameters: [Parameters.apiVersion],
530
+ urlParameters: [
531
+ Parameters.$host,
532
+ Parameters.subscriptionId,
533
+ Parameters.resourceGroupName,
534
+ Parameters.resourceName,
535
+ Parameters.childResourceName
536
+ ],
537
+ headerParameters: [Parameters.accept, Parameters.contentType],
538
+ mediaType: "json",
539
+ serializer
540
+ };
541
+ const listByCustomLocationIDNextOperationSpec: coreClient.OperationSpec = {
542
+ path: "{nextLink}",
543
+ httpMethod: "GET",
544
+ responses: {
545
+ 200: {
546
+ bodyMapper: Mappers.ResourceSyncRuleListResult
547
+ },
548
+ default: {
549
+ bodyMapper: Mappers.ErrorResponse
550
+ }
551
+ },
552
+ queryParameters: [Parameters.apiVersion],
553
+ urlParameters: [
554
+ Parameters.$host,
555
+ Parameters.subscriptionId,
556
+ Parameters.resourceGroupName,
557
+ Parameters.resourceName,
558
+ Parameters.nextLink
559
+ ],
560
+ headerParameters: [Parameters.accept],
561
+ serializer
562
+ };