@azure/arm-portal 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -3
- package/LICENSE +1 -1
- package/README.md +8 -8
- package/dist/index.js +173 -59
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js +11 -3
- package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/dashboardsDeleteSample.js +11 -3
- package/dist-esm/samples-dev/dashboardsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/dashboardsGetSample.js +11 -3
- package/dist-esm/samples-dev/dashboardsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js +11 -3
- package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js +10 -2
- package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js.map +1 -1
- package/dist-esm/samples-dev/dashboardsUpdateSample.js +11 -3
- package/dist-esm/samples-dev/dashboardsUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js +10 -2
- package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js.map +1 -1
- package/dist-esm/samples-dev/operationsListSample.js +10 -2
- package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
- package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js +10 -2
- package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js.map +1 -1
- package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js +10 -2
- package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/tenantConfigurationsGetSample.js +10 -2
- package/dist-esm/samples-dev/tenantConfigurationsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/tenantConfigurationsListSample.js +10 -2
- package/dist-esm/samples-dev/tenantConfigurationsListSample.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +7 -5
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +1 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/operations/dashboards.d.ts.map +1 -1
- package/dist-esm/src/operations/dashboards.js +37 -16
- package/dist-esm/src/operations/dashboards.js.map +1 -1
- package/dist-esm/src/operations/listTenantConfigurationViolations.d.ts.map +1 -1
- package/dist-esm/src/operations/listTenantConfigurationViolations.js +19 -8
- package/dist-esm/src/operations/listTenantConfigurationViolations.js.map +1 -1
- package/dist-esm/src/operations/operations.d.ts.map +1 -1
- package/dist-esm/src/operations/operations.js +19 -8
- package/dist-esm/src/operations/operations.js.map +1 -1
- package/dist-esm/src/operations/tenantConfigurations.d.ts.map +1 -1
- package/dist-esm/src/operations/tenantConfigurations.js +19 -8
- package/dist-esm/src/operations/tenantConfigurations.js.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/src/portal.d.ts +2 -0
- package/dist-esm/src/portal.d.ts.map +1 -1
- package/dist-esm/src/portal.js +49 -18
- package/dist-esm/src/portal.js.map +1 -1
- package/dist-esm/test/sampleTest.js +11 -13
- package/dist-esm/test/sampleTest.js.map +1 -1
- package/package.json +17 -12
- package/review/arm-portal.api.md +10 -7
- package/src/index.ts +1 -0
- package/src/models/index.ts +6 -5
- package/src/operations/dashboards.ts +46 -19
- package/src/operations/listTenantConfigurationViolations.ts +21 -9
- package/src/operations/operations.ts +21 -9
- package/src/operations/tenantConfigurations.ts +21 -9
- package/src/pagingHelper.ts +39 -0
- package/src/portal.ts +60 -20
- package/types/arm-portal.d.ts +18 -5
- 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 { Operations } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -48,22 +49,34 @@ export class OperationsImpl implements Operations {
|
|
|
48
49
|
[Symbol.asyncIterator]() {
|
|
49
50
|
return this;
|
|
50
51
|
},
|
|
51
|
-
byPage: () => {
|
|
52
|
-
|
|
52
|
+
byPage: (settings?: PageSettings) => {
|
|
53
|
+
if (settings?.maxPageSize) {
|
|
54
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
55
|
+
}
|
|
56
|
+
return this.listPagingPage(options, settings);
|
|
53
57
|
}
|
|
54
58
|
};
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
private async *listPagingPage(
|
|
58
|
-
options?: OperationsListOptionalParams
|
|
62
|
+
options?: OperationsListOptionalParams,
|
|
63
|
+
settings?: PageSettings
|
|
59
64
|
): AsyncIterableIterator<ResourceProviderOperation[]> {
|
|
60
|
-
let result
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
let result: OperationsListResponse;
|
|
66
|
+
let continuationToken = settings?.continuationToken;
|
|
67
|
+
if (!continuationToken) {
|
|
68
|
+
result = await this._list(options);
|
|
69
|
+
let page = result.value || [];
|
|
70
|
+
continuationToken = result.nextLink;
|
|
71
|
+
setContinuationToken(page, continuationToken);
|
|
72
|
+
yield page;
|
|
73
|
+
}
|
|
63
74
|
while (continuationToken) {
|
|
64
75
|
result = await this._listNext(continuationToken, options);
|
|
65
76
|
continuationToken = result.nextLink;
|
|
66
|
-
|
|
77
|
+
let page = result.value || [];
|
|
78
|
+
setContinuationToken(page, continuationToken);
|
|
79
|
+
yield page;
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
|
|
@@ -130,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
|
|
|
130
143
|
bodyMapper: Mappers.ErrorResponse
|
|
131
144
|
}
|
|
132
145
|
},
|
|
133
|
-
queryParameters: [Parameters.apiVersion],
|
|
134
146
|
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
135
147
|
headerParameters: [Parameters.accept],
|
|
136
148
|
serializer
|
|
@@ -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 { TenantConfigurations } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -54,22 +55,34 @@ export class TenantConfigurationsImpl implements TenantConfigurations {
|
|
|
54
55
|
[Symbol.asyncIterator]() {
|
|
55
56
|
return this;
|
|
56
57
|
},
|
|
57
|
-
byPage: () => {
|
|
58
|
-
|
|
58
|
+
byPage: (settings?: PageSettings) => {
|
|
59
|
+
if (settings?.maxPageSize) {
|
|
60
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
61
|
+
}
|
|
62
|
+
return this.listPagingPage(options, settings);
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
private async *listPagingPage(
|
|
64
|
-
options?: TenantConfigurationsListOptionalParams
|
|
68
|
+
options?: TenantConfigurationsListOptionalParams,
|
|
69
|
+
settings?: PageSettings
|
|
65
70
|
): AsyncIterableIterator<Configuration[]> {
|
|
66
|
-
let result
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
let result: TenantConfigurationsListResponse;
|
|
72
|
+
let continuationToken = settings?.continuationToken;
|
|
73
|
+
if (!continuationToken) {
|
|
74
|
+
result = await this._list(options);
|
|
75
|
+
let page = result.value || [];
|
|
76
|
+
continuationToken = result.nextLink;
|
|
77
|
+
setContinuationToken(page, continuationToken);
|
|
78
|
+
yield page;
|
|
79
|
+
}
|
|
69
80
|
while (continuationToken) {
|
|
70
81
|
result = await this._listNext(continuationToken, options);
|
|
71
82
|
continuationToken = result.nextLink;
|
|
72
|
-
|
|
83
|
+
let page = result.value || [];
|
|
84
|
+
setContinuationToken(page, continuationToken);
|
|
85
|
+
yield page;
|
|
73
86
|
}
|
|
74
87
|
}
|
|
75
88
|
|
|
@@ -237,7 +250,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
|
|
|
237
250
|
bodyMapper: Mappers.ErrorResponse
|
|
238
251
|
}
|
|
239
252
|
},
|
|
240
|
-
queryParameters: [Parameters.apiVersion],
|
|
241
253
|
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
242
254
|
headerParameters: [Parameters.accept],
|
|
243
255
|
serializer
|
|
@@ -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
|
+
}
|
package/src/portal.ts
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import * as coreClient from "@azure/core-client";
|
|
10
10
|
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
11
|
+
import {
|
|
12
|
+
PipelineRequest,
|
|
13
|
+
PipelineResponse,
|
|
14
|
+
SendRequest
|
|
15
|
+
} from "@azure/core-rest-pipeline";
|
|
11
16
|
import * as coreAuth from "@azure/core-auth";
|
|
12
17
|
import {
|
|
13
18
|
OperationsImpl,
|
|
@@ -56,47 +61,53 @@ export class Portal extends coreClient.ServiceClient {
|
|
|
56
61
|
credential: credentials
|
|
57
62
|
};
|
|
58
63
|
|
|
59
|
-
const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.
|
|
64
|
+
const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.5`;
|
|
60
65
|
const userAgentPrefix =
|
|
61
66
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
62
67
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
63
68
|
: `${packageDetails}`;
|
|
64
69
|
|
|
65
|
-
if (!options.credentialScopes) {
|
|
66
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
67
|
-
}
|
|
68
70
|
const optionsWithDefaults = {
|
|
69
71
|
...defaults,
|
|
70
72
|
...options,
|
|
71
73
|
userAgentOptions: {
|
|
72
74
|
userAgentPrefix
|
|
73
75
|
},
|
|
74
|
-
|
|
76
|
+
endpoint:
|
|
75
77
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
76
78
|
};
|
|
77
79
|
super(optionsWithDefaults);
|
|
78
80
|
|
|
81
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
79
82
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
80
83
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
81
|
-
|
|
84
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
82
85
|
(pipelinePolicy) =>
|
|
83
86
|
pipelinePolicy.name ===
|
|
84
87
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
85
88
|
);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
}
|
|
90
|
+
if (
|
|
91
|
+
!options ||
|
|
92
|
+
!options.pipeline ||
|
|
93
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
94
|
+
!bearerTokenAuthenticationPolicyFound
|
|
95
|
+
) {
|
|
96
|
+
this.pipeline.removePolicy({
|
|
97
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
98
|
+
});
|
|
99
|
+
this.pipeline.addPolicy(
|
|
100
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
101
|
+
credential: credentials,
|
|
102
|
+
scopes:
|
|
103
|
+
optionsWithDefaults.credentialScopes ??
|
|
104
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
105
|
+
challengeCallbacks: {
|
|
106
|
+
authorizeRequestOnChallenge:
|
|
107
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
);
|
|
100
111
|
}
|
|
101
112
|
// Parameter assignments
|
|
102
113
|
this.subscriptionId = subscriptionId;
|
|
@@ -110,6 +121,35 @@ export class Portal extends coreClient.ServiceClient {
|
|
|
110
121
|
this.listTenantConfigurationViolations = new ListTenantConfigurationViolationsImpl(
|
|
111
122
|
this
|
|
112
123
|
);
|
|
124
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
128
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
|
129
|
+
if (!apiVersion) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const apiVersionPolicy = {
|
|
133
|
+
name: "CustomApiVersionPolicy",
|
|
134
|
+
async sendRequest(
|
|
135
|
+
request: PipelineRequest,
|
|
136
|
+
next: SendRequest
|
|
137
|
+
): Promise<PipelineResponse> {
|
|
138
|
+
const param = request.url.split("?");
|
|
139
|
+
if (param.length > 1) {
|
|
140
|
+
const newParams = param[1].split("&").map((item) => {
|
|
141
|
+
if (item.indexOf("api-version") > -1) {
|
|
142
|
+
return "api-version=" + apiVersion;
|
|
143
|
+
} else {
|
|
144
|
+
return item;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
148
|
+
}
|
|
149
|
+
return next(request);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
113
153
|
}
|
|
114
154
|
|
|
115
155
|
operations: Operations;
|
package/types/arm-portal.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import * as coreClient from '@azure/core-client';
|
|
|
3
3
|
import { PagedAsyncIterableIterator } from '@azure/core-paging';
|
|
4
4
|
|
|
5
5
|
/** Tenant configuration. */
|
|
6
|
-
export declare
|
|
6
|
+
export declare interface Configuration extends ProxyResource {
|
|
7
7
|
/** When flag is set to true Markdown tile will require external storage configuration (URI). The inline content configuration will be prohibited. */
|
|
8
8
|
enforcePrivateMarkdownStorage?: boolean;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
/** List of tenant configurations. */
|
|
12
12
|
export declare interface ConfigurationList {
|
|
@@ -233,8 +233,18 @@ export declare interface ErrorResponse {
|
|
|
233
233
|
error?: ErrorDefinition;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Given the last `.value` produced by the `byPage` iterator,
|
|
238
|
+
* returns a continuation token that can be used to begin paging from
|
|
239
|
+
* that point later.
|
|
240
|
+
* @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
|
|
241
|
+
* @returns The continuation token that can be passed into byPage() during future calls.
|
|
242
|
+
*/
|
|
243
|
+
export declare function getContinuationToken(page: unknown): string | undefined;
|
|
244
|
+
|
|
236
245
|
/** Known values of {@link ConfigurationName} that the service accepts. */
|
|
237
246
|
export declare enum KnownConfigurationName {
|
|
247
|
+
/** Default */
|
|
238
248
|
Default = "default"
|
|
239
249
|
}
|
|
240
250
|
|
|
@@ -262,14 +272,14 @@ export declare interface ListTenantConfigurationViolationsListOptionalParams ext
|
|
|
262
272
|
export declare type ListTenantConfigurationViolationsListResponse = ViolationsList;
|
|
263
273
|
|
|
264
274
|
/** Markdown part metadata. */
|
|
265
|
-
export declare
|
|
275
|
+
export declare interface MarkdownPartMetadata extends DashboardPartMetadata {
|
|
266
276
|
/** Polymorphic discriminator, which specifies the different types this object can be */
|
|
267
277
|
type: "Extension/HubsExtension/PartType/MarkdownPart";
|
|
268
278
|
/** Input to dashboard part. */
|
|
269
279
|
inputs?: Record<string, unknown>[];
|
|
270
280
|
/** Markdown part settings. */
|
|
271
281
|
settings?: MarkdownPartMetadataSettings;
|
|
272
|
-
}
|
|
282
|
+
}
|
|
273
283
|
|
|
274
284
|
/** Markdown part settings. */
|
|
275
285
|
export declare interface MarkdownPartMetadataSettings {
|
|
@@ -346,6 +356,8 @@ export declare class Portal extends coreClient.ServiceClient {
|
|
|
346
356
|
* @param options The parameter options
|
|
347
357
|
*/
|
|
348
358
|
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: PortalOptionalParams);
|
|
359
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
360
|
+
private addCustomApiVersionPolicy;
|
|
349
361
|
operations: Operations;
|
|
350
362
|
dashboards: Dashboards;
|
|
351
363
|
tenantConfigurations: TenantConfigurations;
|
|
@@ -363,7 +375,8 @@ export declare interface PortalOptionalParams extends coreClient.ServiceClientOp
|
|
|
363
375
|
}
|
|
364
376
|
|
|
365
377
|
/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */
|
|
366
|
-
export declare
|
|
378
|
+
export declare interface ProxyResource extends Resource {
|
|
379
|
+
}
|
|
367
380
|
|
|
368
381
|
/** Common fields that are returned in the response for all Azure Resource Manager resources */
|
|
369
382
|
export declare interface Resource {
|