@azure/arm-portal 1.0.0-beta.3 → 1.0.0-beta.4

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/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,7 +61,7 @@ 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.3`;
64
+ const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.4`;
60
65
  const userAgentPrefix =
61
66
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
62
67
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -110,6 +115,35 @@ export class Portal extends coreClient.ServiceClient {
110
115
  this.listTenantConfigurationViolations = new ListTenantConfigurationViolationsImpl(
111
116
  this
112
117
  );
118
+ this.addCustomApiVersionPolicy(options.apiVersion);
119
+ }
120
+
121
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
122
+ private addCustomApiVersionPolicy(apiVersion?: string) {
123
+ if (!apiVersion) {
124
+ return;
125
+ }
126
+ const apiVersionPolicy = {
127
+ name: "CustomApiVersionPolicy",
128
+ async sendRequest(
129
+ request: PipelineRequest,
130
+ next: SendRequest
131
+ ): Promise<PipelineResponse> {
132
+ const param = request.url.split("?");
133
+ if (param.length > 1) {
134
+ const newParams = param[1].split("&").map((item) => {
135
+ if (item.indexOf("api-version") > -1) {
136
+ return "api-version=" + apiVersion;
137
+ } else {
138
+ return item;
139
+ }
140
+ });
141
+ request.url = param[0] + "?" + newParams.join("&");
142
+ }
143
+ return next(request);
144
+ }
145
+ };
146
+ this.pipeline.addPolicy(apiVersionPolicy);
113
147
  }
114
148
 
115
149
  operations: Operations;
@@ -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 type Configuration = ProxyResource & {
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 {
@@ -235,6 +235,7 @@ export declare interface ErrorResponse {
235
235
 
236
236
  /** Known values of {@link ConfigurationName} that the service accepts. */
237
237
  export declare enum KnownConfigurationName {
238
+ /** Default */
238
239
  Default = "default"
239
240
  }
240
241
 
@@ -262,14 +263,14 @@ export declare interface ListTenantConfigurationViolationsListOptionalParams ext
262
263
  export declare type ListTenantConfigurationViolationsListResponse = ViolationsList;
263
264
 
264
265
  /** Markdown part metadata. */
265
- export declare type MarkdownPartMetadata = DashboardPartMetadata & {
266
+ export declare interface MarkdownPartMetadata extends DashboardPartMetadata {
266
267
  /** Polymorphic discriminator, which specifies the different types this object can be */
267
268
  type: "Extension/HubsExtension/PartType/MarkdownPart";
268
269
  /** Input to dashboard part. */
269
270
  inputs?: Record<string, unknown>[];
270
271
  /** Markdown part settings. */
271
272
  settings?: MarkdownPartMetadataSettings;
272
- };
273
+ }
273
274
 
274
275
  /** Markdown part settings. */
275
276
  export declare interface MarkdownPartMetadataSettings {
@@ -346,6 +347,8 @@ export declare class Portal extends coreClient.ServiceClient {
346
347
  * @param options The parameter options
347
348
  */
348
349
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: PortalOptionalParams);
350
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
351
+ private addCustomApiVersionPolicy;
349
352
  operations: Operations;
350
353
  dashboards: Dashboards;
351
354
  tenantConfigurations: TenantConfigurations;
@@ -363,7 +366,8 @@ export declare interface PortalOptionalParams extends coreClient.ServiceClientOp
363
366
  }
364
367
 
365
368
  /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */
366
- export declare type ProxyResource = Resource & {};
369
+ export declare interface ProxyResource extends Resource {
370
+ }
367
371
 
368
372
  /** Common fields that are returned in the response for all Azure Resource Manager resources */
369
373
  export declare interface Resource {