@azure/arm-dashboard 1.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 (105) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +109 -0
  4. package/dist/index.js +1372 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/samples-dev/grafanaCreateSample.d.ts +2 -0
  9. package/dist-esm/samples-dev/grafanaCreateSample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/grafanaCreateSample.js +38 -0
  11. package/dist-esm/samples-dev/grafanaCreateSample.js.map +1 -0
  12. package/dist-esm/samples-dev/grafanaDeleteSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/grafanaDeleteSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/grafanaDeleteSample.js +31 -0
  15. package/dist-esm/samples-dev/grafanaDeleteSample.js.map +1 -0
  16. package/dist-esm/samples-dev/grafanaGetSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/grafanaGetSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/grafanaGetSample.js +31 -0
  19. package/dist-esm/samples-dev/grafanaGetSample.js.map +1 -0
  20. package/dist-esm/samples-dev/grafanaListByResourceGroupSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/grafanaListByResourceGroupSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/grafanaListByResourceGroupSample.js +44 -0
  23. package/dist-esm/samples-dev/grafanaListByResourceGroupSample.js.map +1 -0
  24. package/dist-esm/samples-dev/grafanaListSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/grafanaListSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/grafanaListSample.js +43 -0
  27. package/dist-esm/samples-dev/grafanaListSample.js.map +1 -0
  28. package/dist-esm/samples-dev/grafanaUpdateSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/grafanaUpdateSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/grafanaUpdateSample.js +34 -0
  31. package/dist-esm/samples-dev/grafanaUpdateSample.js.map +1 -0
  32. package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/operationsListSample.js +43 -0
  35. package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
  36. package/dist-esm/src/dashboardManagementClient.d.ts +20 -0
  37. package/dist-esm/src/dashboardManagementClient.d.ts.map +1 -0
  38. package/dist-esm/src/dashboardManagementClient.js +71 -0
  39. package/dist-esm/src/dashboardManagementClient.js.map +1 -0
  40. package/dist-esm/src/index.d.ts +5 -0
  41. package/dist-esm/src/index.d.ts.map +1 -0
  42. package/dist-esm/src/index.js +12 -0
  43. package/dist-esm/src/index.js.map +1 -0
  44. package/dist-esm/src/lroImpl.d.ts +16 -0
  45. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  46. package/dist-esm/src/lroImpl.js +29 -0
  47. package/dist-esm/src/lroImpl.js.map +1 -0
  48. package/dist-esm/src/models/index.d.ts +414 -0
  49. package/dist-esm/src/models/index.d.ts.map +1 -0
  50. package/dist-esm/src/models/index.js +66 -0
  51. package/dist-esm/src/models/index.js.map +1 -0
  52. package/dist-esm/src/models/mappers.d.ts +16 -0
  53. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  54. package/dist-esm/src/models/mappers.js +485 -0
  55. package/dist-esm/src/models/mappers.js.map +1 -0
  56. package/dist-esm/src/models/parameters.d.ts +12 -0
  57. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  58. package/dist-esm/src/models/parameters.js +108 -0
  59. package/dist-esm/src/models/parameters.js.map +1 -0
  60. package/dist-esm/src/operations/grafana.d.ts +101 -0
  61. package/dist-esm/src/operations/grafana.d.ts.map +1 -0
  62. package/dist-esm/src/operations/grafana.js +458 -0
  63. package/dist-esm/src/operations/grafana.js.map +1 -0
  64. package/dist-esm/src/operations/index.d.ts +3 -0
  65. package/dist-esm/src/operations/index.d.ts.map +1 -0
  66. package/dist-esm/src/operations/index.js +10 -0
  67. package/dist-esm/src/operations/index.js.map +1 -0
  68. package/dist-esm/src/operations/operations.d.ts +32 -0
  69. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  70. package/dist-esm/src/operations/operations.js +120 -0
  71. package/dist-esm/src/operations/operations.js.map +1 -0
  72. package/dist-esm/src/operationsInterfaces/grafana.d.ts +65 -0
  73. package/dist-esm/src/operationsInterfaces/grafana.d.ts.map +1 -0
  74. package/dist-esm/src/operationsInterfaces/grafana.js +9 -0
  75. package/dist-esm/src/operationsInterfaces/grafana.js.map +1 -0
  76. package/dist-esm/src/operationsInterfaces/index.d.ts +3 -0
  77. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  78. package/dist-esm/src/operationsInterfaces/index.js +10 -0
  79. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  80. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  81. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  82. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  83. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  84. package/dist-esm/test/sampleTest.d.ts +2 -0
  85. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  86. package/dist-esm/test/sampleTest.js +40 -0
  87. package/dist-esm/test/sampleTest.js.map +1 -0
  88. package/package.json +118 -0
  89. package/review/arm-dashboard.api.md +355 -0
  90. package/rollup.config.js +122 -0
  91. package/src/dashboardManagementClient.ts +103 -0
  92. package/src/index.ts +12 -0
  93. package/src/lroImpl.ts +34 -0
  94. package/src/models/index.ts +467 -0
  95. package/src/models/mappers.ts +500 -0
  96. package/src/models/parameters.ts +126 -0
  97. package/src/operations/grafana.ts +595 -0
  98. package/src/operations/index.ts +10 -0
  99. package/src/operations/operations.ts +137 -0
  100. package/src/operationsInterfaces/grafana.ts +120 -0
  101. package/src/operationsInterfaces/index.ts +10 -0
  102. package/src/operationsInterfaces/operations.ts +22 -0
  103. package/tsconfig.json +33 -0
  104. package/types/arm-dashboard.d.ts +556 -0
  105. package/types/tsdoc-metadata.json +11 -0
@@ -0,0 +1,355 @@
1
+ ## API Report File for "@azure/arm-dashboard"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import * as coreAuth from '@azure/core-auth';
8
+ import * as coreClient from '@azure/core-client';
9
+ import { PagedAsyncIterableIterator } from '@azure/core-paging';
10
+ import { PollerLike } from '@azure/core-lro';
11
+ import { PollOperationState } from '@azure/core-lro';
12
+
13
+ // @public
14
+ export type ActionType = string;
15
+
16
+ // @public
17
+ export type AutoGeneratedDomainNameLabelScope = string;
18
+
19
+ // @public
20
+ export type CreatedByType = string;
21
+
22
+ // @public (undocumented)
23
+ export class DashboardManagementClient extends coreClient.ServiceClient {
24
+ // (undocumented)
25
+ $host: string;
26
+ constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: DashboardManagementClientOptionalParams);
27
+ // (undocumented)
28
+ apiVersion: string;
29
+ // (undocumented)
30
+ grafana: Grafana;
31
+ // (undocumented)
32
+ operations: Operations;
33
+ // (undocumented)
34
+ subscriptionId: string;
35
+ }
36
+
37
+ // @public
38
+ export interface DashboardManagementClientOptionalParams extends coreClient.ServiceClientOptions {
39
+ $host?: string;
40
+ apiVersion?: string;
41
+ endpoint?: string;
42
+ }
43
+
44
+ // @public
45
+ export interface ErrorAdditionalInfo {
46
+ readonly info?: Record<string, unknown>;
47
+ readonly type?: string;
48
+ }
49
+
50
+ // @public
51
+ export interface ErrorDetail {
52
+ readonly additionalInfo?: ErrorAdditionalInfo[];
53
+ readonly code?: string;
54
+ readonly details?: ErrorDetail[];
55
+ readonly message?: string;
56
+ readonly target?: string;
57
+ }
58
+
59
+ // @public
60
+ export interface ErrorResponse {
61
+ error?: ErrorDetail;
62
+ }
63
+
64
+ // @public
65
+ export interface Grafana {
66
+ beginCreate(resourceGroupName: string, workspaceName: string, requestBodyParameters: ManagedGrafana, options?: GrafanaCreateOptionalParams): Promise<PollerLike<PollOperationState<GrafanaCreateResponse>, GrafanaCreateResponse>>;
67
+ beginCreateAndWait(resourceGroupName: string, workspaceName: string, requestBodyParameters: ManagedGrafana, options?: GrafanaCreateOptionalParams): Promise<GrafanaCreateResponse>;
68
+ beginDelete(resourceGroupName: string, workspaceName: string, options?: GrafanaDeleteOptionalParams): Promise<PollerLike<PollOperationState<void>, void>>;
69
+ beginDeleteAndWait(resourceGroupName: string, workspaceName: string, options?: GrafanaDeleteOptionalParams): Promise<void>;
70
+ get(resourceGroupName: string, workspaceName: string, options?: GrafanaGetOptionalParams): Promise<GrafanaGetResponse>;
71
+ list(options?: GrafanaListOptionalParams): PagedAsyncIterableIterator<ManagedGrafana>;
72
+ listByResourceGroup(resourceGroupName: string, options?: GrafanaListByResourceGroupOptionalParams): PagedAsyncIterableIterator<ManagedGrafana>;
73
+ update(resourceGroupName: string, workspaceName: string, requestBodyParameters: ManagedGrafanaUpdateParameters, options?: GrafanaUpdateOptionalParams): Promise<GrafanaUpdateResponse>;
74
+ }
75
+
76
+ // @public
77
+ export interface GrafanaCreateOptionalParams extends coreClient.OperationOptions {
78
+ resumeFrom?: string;
79
+ updateIntervalInMs?: number;
80
+ }
81
+
82
+ // @public
83
+ export type GrafanaCreateResponse = ManagedGrafana;
84
+
85
+ // @public
86
+ export interface GrafanaDeleteOptionalParams extends coreClient.OperationOptions {
87
+ resumeFrom?: string;
88
+ updateIntervalInMs?: number;
89
+ }
90
+
91
+ // @public
92
+ export interface GrafanaGetOptionalParams extends coreClient.OperationOptions {
93
+ }
94
+
95
+ // @public
96
+ export type GrafanaGetResponse = ManagedGrafana;
97
+
98
+ // @public
99
+ export interface GrafanaListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
100
+ }
101
+
102
+ // @public
103
+ export type GrafanaListByResourceGroupNextResponse = ManagedGrafanaListResponse;
104
+
105
+ // @public
106
+ export interface GrafanaListByResourceGroupOptionalParams extends coreClient.OperationOptions {
107
+ }
108
+
109
+ // @public
110
+ export type GrafanaListByResourceGroupResponse = ManagedGrafanaListResponse;
111
+
112
+ // @public
113
+ export interface GrafanaListNextOptionalParams extends coreClient.OperationOptions {
114
+ }
115
+
116
+ // @public
117
+ export type GrafanaListNextResponse = ManagedGrafanaListResponse;
118
+
119
+ // @public
120
+ export interface GrafanaListOptionalParams extends coreClient.OperationOptions {
121
+ }
122
+
123
+ // @public
124
+ export type GrafanaListResponse = ManagedGrafanaListResponse;
125
+
126
+ // @public
127
+ export interface GrafanaUpdateOptionalParams extends coreClient.OperationOptions {
128
+ }
129
+
130
+ // @public
131
+ export type GrafanaUpdateResponse = ManagedGrafana;
132
+
133
+ // @public
134
+ export type IdentityType = string;
135
+
136
+ // @public
137
+ export enum KnownActionType {
138
+ // (undocumented)
139
+ Internal = "Internal"
140
+ }
141
+
142
+ // @public
143
+ export enum KnownAutoGeneratedDomainNameLabelScope {
144
+ // (undocumented)
145
+ TenantReuse = "TenantReuse"
146
+ }
147
+
148
+ // @public
149
+ export enum KnownCreatedByType {
150
+ // (undocumented)
151
+ Application = "Application",
152
+ // (undocumented)
153
+ Key = "Key",
154
+ // (undocumented)
155
+ ManagedIdentity = "ManagedIdentity",
156
+ // (undocumented)
157
+ User = "User"
158
+ }
159
+
160
+ // @public
161
+ export enum KnownIdentityType {
162
+ // (undocumented)
163
+ None = "None",
164
+ // (undocumented)
165
+ SystemAssigned = "SystemAssigned"
166
+ }
167
+
168
+ // @public
169
+ export enum KnownLastModifiedByType {
170
+ // (undocumented)
171
+ Application = "Application",
172
+ // (undocumented)
173
+ Key = "Key",
174
+ // (undocumented)
175
+ ManagedIdentity = "ManagedIdentity",
176
+ // (undocumented)
177
+ User = "User"
178
+ }
179
+
180
+ // @public
181
+ export enum KnownOrigin {
182
+ // (undocumented)
183
+ System = "system",
184
+ // (undocumented)
185
+ User = "user",
186
+ // (undocumented)
187
+ UserSystem = "user,system"
188
+ }
189
+
190
+ // @public
191
+ export enum KnownProvisioningState {
192
+ // (undocumented)
193
+ Accepted = "Accepted",
194
+ // (undocumented)
195
+ Canceled = "Canceled",
196
+ // (undocumented)
197
+ Creating = "Creating",
198
+ // (undocumented)
199
+ Deleted = "Deleted",
200
+ // (undocumented)
201
+ Deleting = "Deleting",
202
+ // (undocumented)
203
+ Failed = "Failed",
204
+ // (undocumented)
205
+ NotSpecified = "NotSpecified",
206
+ // (undocumented)
207
+ Succeeded = "Succeeded",
208
+ // (undocumented)
209
+ Updating = "Updating"
210
+ }
211
+
212
+ // @public
213
+ export enum KnownZoneRedundancy {
214
+ // (undocumented)
215
+ Disabled = "Disabled",
216
+ // (undocumented)
217
+ Enabled = "Enabled"
218
+ }
219
+
220
+ // @public
221
+ export type LastModifiedByType = string;
222
+
223
+ // @public
224
+ export interface ManagedGrafana {
225
+ readonly id?: string;
226
+ identity?: ManagedIdentity;
227
+ location?: string;
228
+ readonly name?: string;
229
+ properties?: ManagedGrafanaProperties;
230
+ sku?: ResourceSku;
231
+ readonly systemData?: SystemData;
232
+ tags?: {
233
+ [propertyName: string]: string;
234
+ };
235
+ readonly type?: string;
236
+ }
237
+
238
+ // @public (undocumented)
239
+ export interface ManagedGrafanaListResponse {
240
+ // (undocumented)
241
+ nextLink?: string;
242
+ // (undocumented)
243
+ value?: ManagedGrafana[];
244
+ }
245
+
246
+ // @public
247
+ export interface ManagedGrafanaProperties {
248
+ // (undocumented)
249
+ autoGeneratedDomainNameLabelScope?: AutoGeneratedDomainNameLabelScope;
250
+ readonly endpoint?: string;
251
+ readonly grafanaVersion?: string;
252
+ provisioningState?: ProvisioningState;
253
+ // (undocumented)
254
+ zoneRedundancy?: ZoneRedundancy;
255
+ }
256
+
257
+ // @public
258
+ export interface ManagedGrafanaUpdateParameters {
259
+ identity?: ManagedIdentity;
260
+ tags?: {
261
+ [propertyName: string]: string;
262
+ };
263
+ }
264
+
265
+ // @public
266
+ export interface ManagedIdentity {
267
+ readonly principalId?: string;
268
+ readonly tenantId?: string;
269
+ type?: IdentityType;
270
+ userAssignedIdentities?: {
271
+ [propertyName: string]: UserAssignedIdentity;
272
+ };
273
+ }
274
+
275
+ // @public
276
+ export interface OperationDisplay {
277
+ readonly description?: string;
278
+ readonly operation?: string;
279
+ readonly provider?: string;
280
+ readonly resource?: string;
281
+ }
282
+
283
+ // @public
284
+ export interface OperationListResult {
285
+ readonly nextLink?: string;
286
+ readonly value?: OperationResult[];
287
+ }
288
+
289
+ // @public
290
+ export interface OperationResult {
291
+ readonly actionType?: ActionType;
292
+ display?: OperationDisplay;
293
+ readonly isDataAction?: boolean;
294
+ readonly name?: string;
295
+ readonly origin?: Origin;
296
+ }
297
+
298
+ // @public
299
+ export interface Operations {
300
+ list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator<OperationResult>;
301
+ }
302
+
303
+ // @public
304
+ export interface OperationsListNextOptionalParams extends coreClient.OperationOptions {
305
+ }
306
+
307
+ // @public
308
+ export type OperationsListNextResponse = OperationListResult;
309
+
310
+ // @public
311
+ export interface OperationsListOptionalParams extends coreClient.OperationOptions {
312
+ }
313
+
314
+ // @public
315
+ export type OperationsListResponse = OperationListResult;
316
+
317
+ // @public
318
+ export type Origin = string;
319
+
320
+ // @public
321
+ export type ProvisioningState = string;
322
+
323
+ // @public (undocumented)
324
+ export interface ResourceSku {
325
+ // (undocumented)
326
+ name: string;
327
+ }
328
+
329
+ // @public (undocumented)
330
+ export interface SystemData {
331
+ // (undocumented)
332
+ createdAt?: Date;
333
+ // (undocumented)
334
+ createdBy?: string;
335
+ createdByType?: CreatedByType;
336
+ // (undocumented)
337
+ lastModifiedAt?: Date;
338
+ // (undocumented)
339
+ lastModifiedBy?: string;
340
+ // (undocumented)
341
+ lastModifiedByType?: LastModifiedByType;
342
+ }
343
+
344
+ // @public (undocumented)
345
+ export interface UserAssignedIdentity {
346
+ readonly clientId?: string;
347
+ readonly principalId?: string;
348
+ }
349
+
350
+ // @public
351
+ export type ZoneRedundancy = string;
352
+
353
+ // (No @packageDocumentation comment for this package)
354
+
355
+ ```
@@ -0,0 +1,122 @@
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 nodeResolve from "@rollup/plugin-node-resolve";
10
+ import cjs from "@rollup/plugin-commonjs";
11
+ import sourcemaps from "rollup-plugin-sourcemaps";
12
+ import multiEntry from "@rollup/plugin-multi-entry";
13
+ import json from "@rollup/plugin-json";
14
+
15
+ import nodeBuiltins from "builtin-modules";
16
+
17
+ // #region Warning Handler
18
+
19
+ /**
20
+ * A function that can determine whether a rollup warning should be ignored. If
21
+ * the function returns `true`, then the warning will not be displayed.
22
+ */
23
+
24
+ function ignoreNiseSinonEval(warning) {
25
+ return (
26
+ warning.code === "EVAL" &&
27
+ warning.id &&
28
+ (warning.id.includes("node_modules/nise") ||
29
+ warning.id.includes("node_modules/sinon")) === true
30
+ );
31
+ }
32
+
33
+ function ignoreChaiCircularDependency(warning) {
34
+ return (
35
+ warning.code === "CIRCULAR_DEPENDENCY" &&
36
+ warning.importer && warning.importer.includes("node_modules/chai") === true
37
+ );
38
+ }
39
+
40
+ const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
41
+
42
+ /**
43
+ * Construct a warning handler for the shared rollup configuration
44
+ * that ignores certain warnings that are not relevant to testing.
45
+ */
46
+ function makeOnWarnForTesting() {
47
+ return (warning, warn) => {
48
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
49
+ if (warningInhibitors.every((inhib) => !inhib(warning))) {
50
+ warn(warning);
51
+ }
52
+ };
53
+ }
54
+
55
+ // #endregion
56
+
57
+ function makeBrowserTestConfig() {
58
+ const config = {
59
+ input: {
60
+ include: ["dist-esm/test/**/*.spec.js"],
61
+ exclude: ["dist-esm/test/**/node/**"]
62
+ },
63
+ output: {
64
+ file: `dist-test/index.browser.js`,
65
+ format: "umd",
66
+ sourcemap: true
67
+ },
68
+ preserveSymlinks: false,
69
+ plugins: [
70
+ multiEntry({ exports: false }),
71
+ nodeResolve({
72
+ mainFields: ["module", "browser"]
73
+ }),
74
+ cjs(),
75
+ json(),
76
+ sourcemaps()
77
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
78
+ ],
79
+ onwarn: makeOnWarnForTesting(),
80
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
81
+ // rollup started respecting the "sideEffects" field in package.json. Since
82
+ // our package.json sets "sideEffects=false", this also applies to test
83
+ // code, which causes all tests to be removed by tree-shaking.
84
+ treeshake: false
85
+ };
86
+
87
+ return config;
88
+ }
89
+
90
+ const defaultConfigurationOptions = {
91
+ disableBrowserBundle: false
92
+ };
93
+
94
+ export function makeConfig(pkg, options) {
95
+ options = {
96
+ ...defaultConfigurationOptions,
97
+ ...(options || {})
98
+ };
99
+
100
+ const baseConfig = {
101
+ // Use the package's module field if it has one
102
+ input: pkg["module"] || "dist-esm/src/index.js",
103
+ external: [
104
+ ...nodeBuiltins,
105
+ ...Object.keys(pkg.dependencies),
106
+ ...Object.keys(pkg.devDependencies)
107
+ ],
108
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
109
+ preserveSymlinks: false,
110
+ plugins: [sourcemaps(), nodeResolve()]
111
+ };
112
+
113
+ const config = [baseConfig];
114
+
115
+ if (!options.disableBrowserBundle) {
116
+ config.push(makeBrowserTestConfig());
117
+ }
118
+
119
+ return config;
120
+ }
121
+
122
+ export default makeConfig(require("./package.json"));
@@ -0,0 +1,103 @@
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 * as coreClient from "@azure/core-client";
10
+ import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import * as coreAuth from "@azure/core-auth";
12
+ import { OperationsImpl, GrafanaImpl } from "./operations";
13
+ import { Operations, Grafana } from "./operationsInterfaces";
14
+ import { DashboardManagementClientOptionalParams } from "./models";
15
+
16
+ export class DashboardManagementClient extends coreClient.ServiceClient {
17
+ $host: string;
18
+ apiVersion: string;
19
+ subscriptionId: string;
20
+
21
+ /**
22
+ * Initializes a new instance of the DashboardManagementClient class.
23
+ * @param credentials Subscription credentials which uniquely identify client subscription.
24
+ * @param subscriptionId Gets subscription credentials which uniquely identify Microsoft Azure
25
+ * subscription. The subscription ID forms part of the URI for every service call.
26
+ * @param options The parameter options
27
+ */
28
+ constructor(
29
+ credentials: coreAuth.TokenCredential,
30
+ subscriptionId: string,
31
+ options?: DashboardManagementClientOptionalParams
32
+ ) {
33
+ if (credentials === undefined) {
34
+ throw new Error("'credentials' cannot be null");
35
+ }
36
+ if (subscriptionId === undefined) {
37
+ throw new Error("'subscriptionId' cannot be null");
38
+ }
39
+
40
+ // Initializing default values for options
41
+ if (!options) {
42
+ options = {};
43
+ }
44
+ const defaults: DashboardManagementClientOptionalParams = {
45
+ requestContentType: "application/json; charset=utf-8",
46
+ credential: credentials
47
+ };
48
+
49
+ const packageDetails = `azsdk-js-arm-dashboard/1.0.0-beta.1`;
50
+ const userAgentPrefix =
51
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
52
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
53
+ : `${packageDetails}`;
54
+
55
+ if (!options.credentialScopes) {
56
+ options.credentialScopes = ["https://management.azure.com/.default"];
57
+ }
58
+ const optionsWithDefaults = {
59
+ ...defaults,
60
+ ...options,
61
+ userAgentOptions: {
62
+ userAgentPrefix
63
+ },
64
+ baseUri:
65
+ options.endpoint ?? options.baseUri ?? "https://management.azure.com"
66
+ };
67
+ super(optionsWithDefaults);
68
+
69
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
70
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
71
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
72
+ (pipelinePolicy) =>
73
+ pipelinePolicy.name ===
74
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
75
+ );
76
+ if (!bearerTokenAuthenticationPolicyFound) {
77
+ this.pipeline.removePolicy({
78
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
79
+ });
80
+ this.pipeline.addPolicy(
81
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
82
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
83
+ challengeCallbacks: {
84
+ authorizeRequestOnChallenge:
85
+ coreClient.authorizeRequestOnClaimChallenge
86
+ }
87
+ })
88
+ );
89
+ }
90
+ }
91
+ // Parameter assignments
92
+ this.subscriptionId = subscriptionId;
93
+
94
+ // Assigning values to Constant parameters
95
+ this.$host = options.$host || "https://management.azure.com";
96
+ this.apiVersion = options.apiVersion || "2021-09-01-preview";
97
+ this.operations = new OperationsImpl(this);
98
+ this.grafana = new GrafanaImpl(this);
99
+ }
100
+
101
+ operations: Operations;
102
+ grafana: Grafana;
103
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
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
+ /// <reference lib="esnext.asynciterable" />
10
+ export * from "./models";
11
+ export { DashboardManagementClient } from "./dashboardManagementClient";
12
+ export * from "./operationsInterfaces";
package/src/lroImpl.ts ADDED
@@ -0,0 +1,34 @@
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 { LongRunningOperation, LroResponse } from "@azure/core-lro";
10
+
11
+ export class LroImpl<T> implements LongRunningOperation<T> {
12
+ constructor(
13
+ private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
14
+ private args: Record<string, unknown>,
15
+ private spec: {
16
+ readonly requestBody?: unknown;
17
+ readonly path?: string;
18
+ readonly httpMethod: string;
19
+ } & Record<string, any>,
20
+ public requestPath: string = spec.path!,
21
+ public requestMethod: string = spec.httpMethod
22
+ ) {}
23
+ public async sendInitialRequest(): Promise<LroResponse<T>> {
24
+ return this.sendOperationFn(this.args, this.spec);
25
+ }
26
+ public async sendPollRequest(path: string): Promise<LroResponse<T>> {
27
+ const { requestBody, ...restSpec } = this.spec;
28
+ return this.sendOperationFn(this.args, {
29
+ ...restSpec,
30
+ path,
31
+ httpMethod: "GET"
32
+ });
33
+ }
34
+ }