@azure/arm-resourceconnector 1.0.0-beta.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 (49) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/index.js +107 -39
  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/appliancesCreateOrUpdateSample.js +11 -3
  9. package/dist-esm/samples-dev/appliancesCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/appliancesDeleteSample.js +11 -3
  11. package/dist-esm/samples-dev/appliancesDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/appliancesGetSample.js +11 -3
  13. package/dist-esm/samples-dev/appliancesGetSample.js.map +1 -1
  14. package/dist-esm/samples-dev/appliancesGetUpgradeGraphSample.js +11 -3
  15. package/dist-esm/samples-dev/appliancesGetUpgradeGraphSample.js.map +1 -1
  16. package/dist-esm/samples-dev/appliancesListByResourceGroupSample.js +11 -3
  17. package/dist-esm/samples-dev/appliancesListByResourceGroupSample.js.map +1 -1
  18. package/dist-esm/samples-dev/appliancesListBySubscriptionSample.js +10 -2
  19. package/dist-esm/samples-dev/appliancesListBySubscriptionSample.js.map +1 -1
  20. package/dist-esm/samples-dev/appliancesListClusterCustomerUserCredentialSample.js +11 -3
  21. package/dist-esm/samples-dev/appliancesListClusterCustomerUserCredentialSample.js.map +1 -1
  22. package/dist-esm/samples-dev/appliancesListClusterUserCredentialSample.js +11 -3
  23. package/dist-esm/samples-dev/appliancesListClusterUserCredentialSample.js.map +1 -1
  24. package/dist-esm/samples-dev/appliancesListOperationsSample.js +10 -2
  25. package/dist-esm/samples-dev/appliancesListOperationsSample.js.map +1 -1
  26. package/dist-esm/samples-dev/appliancesUpdateSample.js +11 -3
  27. package/dist-esm/samples-dev/appliancesUpdateSample.js.map +1 -1
  28. package/dist-esm/src/index.d.ts +1 -0
  29. package/dist-esm/src/index.d.ts.map +1 -1
  30. package/dist-esm/src/index.js +1 -0
  31. package/dist-esm/src/index.js.map +1 -1
  32. package/dist-esm/src/operations/appliances.d.ts.map +1 -1
  33. package/dist-esm/src/operations/appliances.js +55 -24
  34. package/dist-esm/src/operations/appliances.js.map +1 -1
  35. package/dist-esm/src/pagingHelper.d.ts +13 -0
  36. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  37. package/dist-esm/src/pagingHelper.js +32 -0
  38. package/dist-esm/src/pagingHelper.js.map +1 -0
  39. package/dist-esm/src/resourceConnectorManagementClient.d.ts.map +1 -1
  40. package/dist-esm/src/resourceConnectorManagementClient.js +20 -15
  41. package/dist-esm/src/resourceConnectorManagementClient.js.map +1 -1
  42. package/package.json +8 -6
  43. package/review/arm-resourceconnector.api.md +3 -0
  44. package/src/index.ts +1 -0
  45. package/src/operations/appliances.ts +65 -27
  46. package/src/pagingHelper.ts +39 -0
  47. package/src/resourceConnectorManagementClient.ts +26 -17
  48. package/types/arm-resourceconnector.d.ts +9 -0
  49. package/types/tsdoc-metadata.json +1 -1
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Appliances } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,13 +19,13 @@ import {
18
19
  ApplianceOperation,
19
20
  AppliancesListOperationsNextOptionalParams,
20
21
  AppliancesListOperationsOptionalParams,
22
+ AppliancesListOperationsResponse,
21
23
  Appliance,
22
24
  AppliancesListBySubscriptionNextOptionalParams,
23
25
  AppliancesListBySubscriptionOptionalParams,
26
+ AppliancesListBySubscriptionResponse,
24
27
  AppliancesListByResourceGroupNextOptionalParams,
25
28
  AppliancesListByResourceGroupOptionalParams,
26
- AppliancesListOperationsResponse,
27
- AppliancesListBySubscriptionResponse,
28
29
  AppliancesListByResourceGroupResponse,
29
30
  AppliancesGetOptionalParams,
30
31
  AppliancesGetResponse,
@@ -72,22 +73,34 @@ export class AppliancesImpl implements Appliances {
72
73
  [Symbol.asyncIterator]() {
73
74
  return this;
74
75
  },
75
- byPage: () => {
76
- return this.listOperationsPagingPage(options);
76
+ byPage: (settings?: PageSettings) => {
77
+ if (settings?.maxPageSize) {
78
+ throw new Error("maxPageSize is not supported by this operation.");
79
+ }
80
+ return this.listOperationsPagingPage(options, settings);
77
81
  }
78
82
  };
79
83
  }
80
84
 
81
85
  private async *listOperationsPagingPage(
82
- options?: AppliancesListOperationsOptionalParams
86
+ options?: AppliancesListOperationsOptionalParams,
87
+ settings?: PageSettings
83
88
  ): AsyncIterableIterator<ApplianceOperation[]> {
84
- let result = await this._listOperations(options);
85
- yield result.value || [];
86
- let continuationToken = result.nextLink;
89
+ let result: AppliancesListOperationsResponse;
90
+ let continuationToken = settings?.continuationToken;
91
+ if (!continuationToken) {
92
+ result = await this._listOperations(options);
93
+ let page = result.value || [];
94
+ continuationToken = result.nextLink;
95
+ setContinuationToken(page, continuationToken);
96
+ yield page;
97
+ }
87
98
  while (continuationToken) {
88
99
  result = await this._listOperationsNext(continuationToken, options);
89
100
  continuationToken = result.nextLink;
90
- yield result.value || [];
101
+ let page = result.value || [];
102
+ setContinuationToken(page, continuationToken);
103
+ yield page;
91
104
  }
92
105
  }
93
106
 
@@ -115,22 +128,34 @@ export class AppliancesImpl implements Appliances {
115
128
  [Symbol.asyncIterator]() {
116
129
  return this;
117
130
  },
118
- byPage: () => {
119
- return this.listBySubscriptionPagingPage(options);
131
+ byPage: (settings?: PageSettings) => {
132
+ if (settings?.maxPageSize) {
133
+ throw new Error("maxPageSize is not supported by this operation.");
134
+ }
135
+ return this.listBySubscriptionPagingPage(options, settings);
120
136
  }
121
137
  };
122
138
  }
123
139
 
124
140
  private async *listBySubscriptionPagingPage(
125
- options?: AppliancesListBySubscriptionOptionalParams
141
+ options?: AppliancesListBySubscriptionOptionalParams,
142
+ settings?: PageSettings
126
143
  ): AsyncIterableIterator<Appliance[]> {
127
- let result = await this._listBySubscription(options);
128
- yield result.value || [];
129
- let continuationToken = result.nextLink;
144
+ let result: AppliancesListBySubscriptionResponse;
145
+ let continuationToken = settings?.continuationToken;
146
+ if (!continuationToken) {
147
+ result = await this._listBySubscription(options);
148
+ let page = result.value || [];
149
+ continuationToken = result.nextLink;
150
+ setContinuationToken(page, continuationToken);
151
+ yield page;
152
+ }
130
153
  while (continuationToken) {
131
154
  result = await this._listBySubscriptionNext(continuationToken, options);
132
155
  continuationToken = result.nextLink;
133
- yield result.value || [];
156
+ let page = result.value || [];
157
+ setContinuationToken(page, continuationToken);
158
+ yield page;
134
159
  }
135
160
  }
136
161
 
@@ -160,19 +185,33 @@ export class AppliancesImpl implements Appliances {
160
185
  [Symbol.asyncIterator]() {
161
186
  return this;
162
187
  },
163
- byPage: () => {
164
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
188
+ byPage: (settings?: PageSettings) => {
189
+ if (settings?.maxPageSize) {
190
+ throw new Error("maxPageSize is not supported by this operation.");
191
+ }
192
+ return this.listByResourceGroupPagingPage(
193
+ resourceGroupName,
194
+ options,
195
+ settings
196
+ );
165
197
  }
166
198
  };
167
199
  }
168
200
 
169
201
  private async *listByResourceGroupPagingPage(
170
202
  resourceGroupName: string,
171
- options?: AppliancesListByResourceGroupOptionalParams
203
+ options?: AppliancesListByResourceGroupOptionalParams,
204
+ settings?: PageSettings
172
205
  ): AsyncIterableIterator<Appliance[]> {
173
- let result = await this._listByResourceGroup(resourceGroupName, options);
174
- yield result.value || [];
175
- let continuationToken = result.nextLink;
206
+ let result: AppliancesListByResourceGroupResponse;
207
+ let continuationToken = settings?.continuationToken;
208
+ if (!continuationToken) {
209
+ result = await this._listByResourceGroup(resourceGroupName, options);
210
+ let page = result.value || [];
211
+ continuationToken = result.nextLink;
212
+ setContinuationToken(page, continuationToken);
213
+ yield page;
214
+ }
176
215
  while (continuationToken) {
177
216
  result = await this._listByResourceGroupNext(
178
217
  resourceGroupName,
@@ -180,7 +219,9 @@ export class AppliancesImpl implements Appliances {
180
219
  options
181
220
  );
182
221
  continuationToken = result.nextLink;
183
- yield result.value || [];
222
+ let page = result.value || [];
223
+ setContinuationToken(page, continuationToken);
224
+ yield page;
184
225
  }
185
226
  }
186
227
 
@@ -791,7 +832,6 @@ const listOperationsNextOperationSpec: coreClient.OperationSpec = {
791
832
  bodyMapper: Mappers.ErrorResponse
792
833
  }
793
834
  },
794
- queryParameters: [Parameters.apiVersion],
795
835
  urlParameters: [Parameters.$host, Parameters.nextLink],
796
836
  headerParameters: [Parameters.accept],
797
837
  serializer
@@ -807,7 +847,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
807
847
  bodyMapper: Mappers.ErrorResponse
808
848
  }
809
849
  },
810
- queryParameters: [Parameters.apiVersion],
811
850
  urlParameters: [
812
851
  Parameters.$host,
813
852
  Parameters.subscriptionId,
@@ -827,7 +866,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
827
866
  bodyMapper: Mappers.ErrorResponse
828
867
  }
829
868
  },
830
- queryParameters: [Parameters.apiVersion],
831
869
  urlParameters: [
832
870
  Parameters.$host,
833
871
  Parameters.subscriptionId,
@@ -0,0 +1,39 @@
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
+ export interface PageInfo {
10
+ continuationToken?: string;
11
+ }
12
+
13
+ const pageMap = new WeakMap<object, PageInfo>();
14
+
15
+ /**
16
+ * Given the last `.value` produced by the `byPage` iterator,
17
+ * returns a continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
20
+ * @returns The continuation token that can be passed into byPage() during future calls.
21
+ */
22
+ export function getContinuationToken(page: unknown): string | undefined {
23
+ if (typeof page !== "object" || page === null) {
24
+ return undefined;
25
+ }
26
+ return pageMap.get(page)?.continuationToken;
27
+ }
28
+
29
+ export function setContinuationToken(
30
+ page: unknown,
31
+ continuationToken: string | undefined
32
+ ): void {
33
+ if (typeof page !== "object" || page === null || !continuationToken) {
34
+ return;
35
+ }
36
+ const pageInfo = pageMap.get(page) ?? {};
37
+ pageInfo.continuationToken = continuationToken;
38
+ pageMap.set(page, pageInfo);
39
+ }
@@ -50,7 +50,7 @@ export class ResourceConnectorManagementClient extends coreClient.ServiceClient
50
50
  credential: credentials
51
51
  };
52
52
 
53
- const packageDetails = `azsdk-js-arm-resourceconnector/1.0.0-beta.1`;
53
+ const packageDetails = `azsdk-js-arm-resourceconnector/1.0.0-beta.2`;
54
54
  const userAgentPrefix =
55
55
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
56
56
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -62,32 +62,41 @@ export class ResourceConnectorManagementClient extends coreClient.ServiceClient
62
62
  userAgentOptions: {
63
63
  userAgentPrefix
64
64
  },
65
- baseUri:
65
+ endpoint:
66
66
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
67
67
  };
68
68
  super(optionsWithDefaults);
69
69
 
70
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
70
71
  if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
71
72
  const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
72
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
73
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
73
74
  (pipelinePolicy) =>
74
75
  pipelinePolicy.name ===
75
76
  coreRestPipeline.bearerTokenAuthenticationPolicyName
76
77
  );
77
- if (!bearerTokenAuthenticationPolicyFound) {
78
- this.pipeline.removePolicy({
79
- name: coreRestPipeline.bearerTokenAuthenticationPolicyName
80
- });
81
- this.pipeline.addPolicy(
82
- coreRestPipeline.bearerTokenAuthenticationPolicy({
83
- scopes: `${optionsWithDefaults.baseUri}/.default`,
84
- challengeCallbacks: {
85
- authorizeRequestOnChallenge:
86
- coreClient.authorizeRequestOnClaimChallenge
87
- }
88
- })
89
- );
90
- }
78
+ }
79
+ if (
80
+ !options ||
81
+ !options.pipeline ||
82
+ options.pipeline.getOrderedPolicies().length == 0 ||
83
+ !bearerTokenAuthenticationPolicyFound
84
+ ) {
85
+ this.pipeline.removePolicy({
86
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
87
+ });
88
+ this.pipeline.addPolicy(
89
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
90
+ credential: credentials,
91
+ scopes:
92
+ optionsWithDefaults.credentialScopes ??
93
+ `${optionsWithDefaults.endpoint}/.default`,
94
+ challengeCallbacks: {
95
+ authorizeRequestOnChallenge:
96
+ coreClient.authorizeRequestOnClaimChallenge
97
+ }
98
+ })
99
+ );
91
100
  }
92
101
  // Parameter assignments
93
102
  this.subscriptionId = subscriptionId;
@@ -414,6 +414,15 @@ export declare interface ErrorResponse {
414
414
  error?: ErrorDetail;
415
415
  }
416
416
 
417
+ /**
418
+ * Given the last `.value` produced by the `byPage` iterator,
419
+ * returns a continuation token that can be used to begin paging from
420
+ * that point later.
421
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
422
+ * @returns The continuation token that can be passed into byPage() during future calls.
423
+ */
424
+ export declare function getContinuationToken(page: unknown): string | undefined;
425
+
417
426
  /** Contains the REP (rendezvous endpoint) and “Listener” access token from notification service (NS). */
418
427
  export declare interface HybridConnectionConfig {
419
428
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.11"
8
+ "packageVersion": "7.34.2"
9
9
  }
10
10
  ]
11
11
  }