@azure/arm-serialconsole 1.1.1 → 2.0.0

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 (121) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +69 -80
  4. package/dist/index.js +861 -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/src/index.d.ts +4 -0
  9. package/dist-esm/src/index.d.ts.map +1 -0
  10. package/dist-esm/src/index.js +11 -0
  11. package/dist-esm/src/index.js.map +1 -0
  12. package/dist-esm/src/microsoftSerialConsoleClient.d.ts +42 -0
  13. package/dist-esm/src/microsoftSerialConsoleClient.d.ts.map +1 -0
  14. package/dist-esm/src/microsoftSerialConsoleClient.js +160 -0
  15. package/dist-esm/src/microsoftSerialConsoleClient.js.map +1 -0
  16. package/dist-esm/src/models/index.d.ts +150 -0
  17. package/dist-esm/src/models/index.d.ts.map +1 -0
  18. package/dist-esm/src/models/index.js +9 -0
  19. package/dist-esm/src/models/index.js.map +1 -0
  20. package/dist-esm/src/models/mappers.d.ts +16 -0
  21. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  22. package/dist-esm/src/models/mappers.js +285 -0
  23. package/dist-esm/src/models/mappers.js.map +1 -0
  24. package/dist-esm/src/models/parameters.d.ts +14 -0
  25. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  26. package/dist-esm/src/models/parameters.js +128 -0
  27. package/dist-esm/src/models/parameters.js.map +1 -0
  28. package/dist-esm/src/operations/index.d.ts +2 -0
  29. package/dist-esm/src/operations/index.d.ts.map +1 -0
  30. package/dist-esm/src/operations/index.js +9 -0
  31. package/dist-esm/src/operations/index.js.map +1 -0
  32. package/dist-esm/src/operations/serialPorts.d.ts +78 -0
  33. package/dist-esm/src/operations/serialPorts.d.ts.map +1 -0
  34. package/dist-esm/src/operations/serialPorts.js +270 -0
  35. package/dist-esm/src/operations/serialPorts.js.map +1 -0
  36. package/dist-esm/src/operationsInterfaces/index.d.ts +2 -0
  37. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  38. package/dist-esm/src/operationsInterfaces/index.js +9 -0
  39. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  40. package/dist-esm/src/operationsInterfaces/serialPorts.d.ts +70 -0
  41. package/dist-esm/src/operationsInterfaces/serialPorts.d.ts.map +1 -0
  42. package/dist-esm/src/operationsInterfaces/serialPorts.js +9 -0
  43. package/dist-esm/src/operationsInterfaces/serialPorts.js.map +1 -0
  44. package/dist-esm/test/sampleTest.d.ts +2 -0
  45. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  46. package/dist-esm/test/sampleTest.js +40 -0
  47. package/dist-esm/test/sampleTest.js.map +1 -0
  48. package/package.json +71 -33
  49. package/review/arm-serialconsole.api.md +202 -0
  50. package/rollup.config.js +181 -30
  51. package/src/index.ts +11 -0
  52. package/src/microsoftSerialConsoleClient.ts +206 -36
  53. package/src/models/index.ts +163 -126
  54. package/src/models/mappers.ts +238 -26
  55. package/src/models/parameters.ts +110 -19
  56. package/src/operations/index.ts +4 -8
  57. package/src/operations/serialPorts.ts +357 -0
  58. package/src/operationsInterfaces/index.ts +9 -0
  59. package/src/operationsInterfaces/serialPorts.ts +128 -0
  60. package/tsconfig.json +4 -4
  61. package/types/arm-serialconsole.d.ts +294 -0
  62. package/types/tsdoc-metadata.json +11 -0
  63. package/dist/arm-serialconsole.js +0 -532
  64. package/dist/arm-serialconsole.js.map +0 -1
  65. package/dist/arm-serialconsole.min.js +0 -1
  66. package/dist/arm-serialconsole.min.js.map +0 -1
  67. package/esm/microsoftSerialConsoleClient.d.ts +0 -26
  68. package/esm/microsoftSerialConsoleClient.d.ts.map +0 -1
  69. package/esm/microsoftSerialConsoleClient.js +0 -40
  70. package/esm/microsoftSerialConsoleClient.js.map +0 -1
  71. package/esm/microsoftSerialConsoleClientContext.d.ts +0 -22
  72. package/esm/microsoftSerialConsoleClientContext.d.ts.map +0 -1
  73. package/esm/microsoftSerialConsoleClientContext.js +0 -61
  74. package/esm/microsoftSerialConsoleClientContext.js.map +0 -1
  75. package/esm/models/consoleMappers.d.ts +0 -2
  76. package/esm/models/consoleMappers.d.ts.map +0 -1
  77. package/esm/models/consoleMappers.js +0 -9
  78. package/esm/models/consoleMappers.js.map +0 -1
  79. package/esm/models/index.d.ts +0 -133
  80. package/esm/models/index.d.ts.map +0 -1
  81. package/esm/models/index.js +0 -8
  82. package/esm/models/index.js.map +0 -1
  83. package/esm/models/listConsoleMappers.d.ts +0 -2
  84. package/esm/models/listConsoleMappers.d.ts.map +0 -1
  85. package/esm/models/listConsoleMappers.js +0 -9
  86. package/esm/models/listConsoleMappers.js.map +0 -1
  87. package/esm/models/listMappers.d.ts +0 -2
  88. package/esm/models/listMappers.d.ts.map +0 -1
  89. package/esm/models/listMappers.js +0 -9
  90. package/esm/models/listMappers.js.map +0 -1
  91. package/esm/models/mappers.d.ts +0 -9
  92. package/esm/models/mappers.d.ts.map +0 -1
  93. package/esm/models/mappers.js +0 -86
  94. package/esm/models/mappers.js.map +0 -1
  95. package/esm/models/parameters.d.ts +0 -6
  96. package/esm/models/parameters.d.ts.map +0 -1
  97. package/esm/models/parameters.js +0 -52
  98. package/esm/models/parameters.js.map +0 -1
  99. package/esm/operations/console.d.ts +0 -43
  100. package/esm/operations/console.d.ts.map +0 -1
  101. package/esm/operations/console.js +0 -83
  102. package/esm/operations/console.js.map +0 -1
  103. package/esm/operations/index.d.ts +0 -4
  104. package/esm/operations/index.d.ts.map +0 -1
  105. package/esm/operations/index.js +0 -13
  106. package/esm/operations/index.js.map +0 -1
  107. package/esm/operations/list.d.ts +0 -28
  108. package/esm/operations/list.d.ts.map +0 -1
  109. package/esm/operations/list.js +0 -54
  110. package/esm/operations/list.js.map +0 -1
  111. package/esm/operations/listConsole.d.ts +0 -28
  112. package/esm/operations/listConsole.d.ts.map +0 -1
  113. package/esm/operations/listConsole.js +0 -55
  114. package/esm/operations/listConsole.js.map +0 -1
  115. package/src/microsoftSerialConsoleClientContext.ts +0 -68
  116. package/src/models/consoleMappers.ts +0 -12
  117. package/src/models/listConsoleMappers.ts +0 -12
  118. package/src/models/listMappers.ts +0 -12
  119. package/src/operations/console.ts +0 -126
  120. package/src/operations/list.ts +0 -77
  121. package/src/operations/listConsole.ts +0 -78
@@ -0,0 +1,202 @@
1
+ ## API Report File for "@azure/arm-serialconsole"
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
+
10
+ // @public
11
+ export interface CloudError {
12
+ error?: CloudErrorBody;
13
+ }
14
+
15
+ // @public
16
+ export interface CloudErrorBody {
17
+ code?: string;
18
+ details?: CloudErrorBody[];
19
+ message?: string;
20
+ target?: string;
21
+ }
22
+
23
+ // @public
24
+ export interface DisableConsoleOptionalParams extends coreClient.OperationOptions {
25
+ }
26
+
27
+ // @public
28
+ export type DisableConsoleResponse = DisableSerialConsoleResult;
29
+
30
+ // @public
31
+ export interface DisableSerialConsoleResult {
32
+ disabled?: boolean;
33
+ }
34
+
35
+ // @public
36
+ export interface EnableConsoleOptionalParams extends coreClient.OperationOptions {
37
+ }
38
+
39
+ // @public
40
+ export type EnableConsoleResponse = EnableSerialConsoleResult;
41
+
42
+ // @public
43
+ export interface EnableSerialConsoleResult {
44
+ disabled?: boolean;
45
+ }
46
+
47
+ // @public
48
+ export interface GetConsoleStatusOptionalParams extends coreClient.OperationOptions {
49
+ }
50
+
51
+ // @public
52
+ export type GetConsoleStatusResponse = SerialConsoleStatus;
53
+
54
+ // @public
55
+ export interface GetSerialConsoleSubscriptionNotFound {
56
+ code?: string;
57
+ message?: string;
58
+ }
59
+
60
+ // @public
61
+ export interface ListOperationsOptionalParams extends coreClient.OperationOptions {
62
+ }
63
+
64
+ // @public
65
+ export type ListOperationsResponse = SerialConsoleOperations;
66
+
67
+ // @public (undocumented)
68
+ export class MicrosoftSerialConsoleClient extends coreClient.ServiceClient {
69
+ // (undocumented)
70
+ $host: string;
71
+ constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftSerialConsoleClientOptionalParams);
72
+ // (undocumented)
73
+ apiVersion: string;
74
+ disableConsole(defaultParam: string, options?: DisableConsoleOptionalParams): Promise<DisableConsoleResponse>;
75
+ enableConsole(defaultParam: string, options?: EnableConsoleOptionalParams): Promise<EnableConsoleResponse>;
76
+ getConsoleStatus(defaultParam: string, options?: GetConsoleStatusOptionalParams): Promise<GetConsoleStatusResponse>;
77
+ listOperations(options?: ListOperationsOptionalParams): Promise<ListOperationsResponse>;
78
+ // (undocumented)
79
+ serialPorts: SerialPorts;
80
+ // (undocumented)
81
+ subscriptionId: string;
82
+ }
83
+
84
+ // @public
85
+ export interface MicrosoftSerialConsoleClientOptionalParams extends coreClient.ServiceClientOptions {
86
+ $host?: string;
87
+ apiVersion?: string;
88
+ endpoint?: string;
89
+ }
90
+
91
+ // @public
92
+ export type ProxyResource = Resource & {};
93
+
94
+ // @public
95
+ export interface Resource {
96
+ readonly id?: string;
97
+ readonly name?: string;
98
+ readonly type?: string;
99
+ }
100
+
101
+ // @public
102
+ export interface SerialConsoleOperations {
103
+ value?: SerialConsoleOperationsValueItem[];
104
+ }
105
+
106
+ // @public (undocumented)
107
+ export interface SerialConsoleOperationsValueItem {
108
+ // (undocumented)
109
+ display?: SerialConsoleOperationsValueItemDisplay;
110
+ // (undocumented)
111
+ isDataAction?: string;
112
+ // (undocumented)
113
+ name?: string;
114
+ }
115
+
116
+ // @public (undocumented)
117
+ export interface SerialConsoleOperationsValueItemDisplay {
118
+ // (undocumented)
119
+ description?: string;
120
+ // (undocumented)
121
+ operation?: string;
122
+ // (undocumented)
123
+ provider?: string;
124
+ // (undocumented)
125
+ resource?: string;
126
+ }
127
+
128
+ // @public
129
+ export interface SerialConsoleStatus {
130
+ disabled?: boolean;
131
+ }
132
+
133
+ // @public
134
+ export type SerialPort = ProxyResource & {
135
+ state?: SerialPortState;
136
+ };
137
+
138
+ // @public
139
+ export interface SerialPortConnectResult {
140
+ connectionString?: string;
141
+ }
142
+
143
+ // @public
144
+ export interface SerialPortListResult {
145
+ value?: SerialPort[];
146
+ }
147
+
148
+ // @public
149
+ export interface SerialPorts {
150
+ connect(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, options?: SerialPortsConnectOptionalParams): Promise<SerialPortsConnectResponse>;
151
+ create(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, parameters: SerialPort, options?: SerialPortsCreateOptionalParams): Promise<SerialPortsCreateResponse>;
152
+ delete(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, options?: SerialPortsDeleteOptionalParams): Promise<void>;
153
+ get(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, options?: SerialPortsGetOptionalParams): Promise<SerialPortsGetResponse>;
154
+ list(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, options?: SerialPortsListOptionalParams): Promise<SerialPortsListResponse>;
155
+ listBySubscriptions(options?: SerialPortsListBySubscriptionsOptionalParams): Promise<SerialPortsListBySubscriptionsResponse>;
156
+ }
157
+
158
+ // @public
159
+ export interface SerialPortsConnectOptionalParams extends coreClient.OperationOptions {
160
+ }
161
+
162
+ // @public
163
+ export type SerialPortsConnectResponse = SerialPortConnectResult;
164
+
165
+ // @public
166
+ export interface SerialPortsCreateOptionalParams extends coreClient.OperationOptions {
167
+ }
168
+
169
+ // @public
170
+ export type SerialPortsCreateResponse = SerialPort;
171
+
172
+ // @public
173
+ export interface SerialPortsDeleteOptionalParams extends coreClient.OperationOptions {
174
+ }
175
+
176
+ // @public
177
+ export interface SerialPortsGetOptionalParams extends coreClient.OperationOptions {
178
+ }
179
+
180
+ // @public
181
+ export type SerialPortsGetResponse = SerialPort;
182
+
183
+ // @public
184
+ export interface SerialPortsListBySubscriptionsOptionalParams extends coreClient.OperationOptions {
185
+ }
186
+
187
+ // @public
188
+ export type SerialPortsListBySubscriptionsResponse = SerialPortListResult;
189
+
190
+ // @public
191
+ export interface SerialPortsListOptionalParams extends coreClient.OperationOptions {
192
+ }
193
+
194
+ // @public
195
+ export type SerialPortsListResponse = SerialPortListResult;
196
+
197
+ // @public
198
+ export type SerialPortState = "enabled" | "disabled";
199
+
200
+ // (No @packageDocumentation comment for this package)
201
+
202
+ ```
package/rollup.config.js CHANGED
@@ -1,37 +1,188 @@
1
- import rollup from "rollup";
2
- import nodeResolve from "rollup-plugin-node-resolve";
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";
3
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
+ /**
18
+ * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
19
+ *
20
+ * NOTE: this manual configuration is only needed because OpenTelemetry uses an
21
+ * __exportStar downleveled helper function to declare its exports which confuses
22
+ * rollup's automatic discovery mechanism.
23
+ *
24
+ * @returns an object reference that can be `...`'d into your cjs() configuration.
25
+ */
26
+ export function openTelemetryCommonJs() {
27
+ const namedExports = {};
28
+
29
+ for (const key of [
30
+ "@opentelemetry/api",
31
+ "@azure/core-tracing/node_modules/@opentelemetry/api"
32
+ ]) {
33
+ namedExports[key] = [
34
+ "SpanKind",
35
+ "TraceFlags",
36
+ "getSpan",
37
+ "setSpan",
38
+ "SpanStatusCode",
39
+ "getSpanContext",
40
+ "setSpanContext"
41
+ ];
42
+ }
43
+
44
+ const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
45
+
46
+ for (const version of releasedOpenTelemetryVersions) {
47
+ namedExports[
48
+ // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
49
+ `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
50
+ ] = [
51
+ "SpanKind",
52
+ "TraceFlags",
53
+ "getSpan",
54
+ "setSpan",
55
+ "StatusCode",
56
+ "CanonicalCode",
57
+ "getSpanContext",
58
+ "setSpanContext"
59
+ ];
60
+ }
61
+
62
+ return namedExports;
63
+ }
64
+
65
+ // #region Warning Handler
4
66
 
5
67
  /**
6
- * @type {rollup.RollupFileOptions}
68
+ * A function that can determine whether a rollupwarning should be ignored. If
69
+ * the function returns `true`, then the warning will not be displayed.
7
70
  */
8
- const config = {
9
- input: "./esm/microsoftSerialConsoleClient.js",
10
- external: [
11
- "@azure/ms-rest-js",
12
- "@azure/ms-rest-azure-js"
13
- ],
14
- output: {
15
- file: "./dist/arm-serialconsole.js",
16
- format: "umd",
17
- name: "Azure.ArmSerialconsole",
18
- sourcemap: true,
19
- globals: {
20
- "@azure/ms-rest-js": "msRest",
21
- "@azure/ms-rest-azure-js": "msRestAzure"
71
+
72
+ function ignoreNiseSinonEvalWarnings(warning) {
73
+ return (
74
+ warning.code === "EVAL" &&
75
+ warning.id &&
76
+ (warning.id.includes("node_modules/nise") ||
77
+ warning.id.includes("node_modules/sinon")) === true
78
+ );
79
+ }
80
+
81
+ function ignoreChaiCircularDependencyWarnings(warning) {
82
+ return (
83
+ warning.code === "CIRCULAR_DEPENDENCY" &&
84
+ warning.importer && warning.importer.includes("node_modules/chai") === true
85
+ );
86
+ }
87
+
88
+ const warningInhibitors = [
89
+ ignoreChaiCircularDependencyWarnings,
90
+ ignoreNiseSinonEvalWarnings
91
+ ];
92
+
93
+ /**
94
+ * Construct a warning handler for the shared rollup configuration
95
+ * that ignores certain warnings that are not relevant to testing.
96
+ */
97
+ function makeOnWarnForTesting() {
98
+ return (warning, warn) => {
99
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
100
+ if (warningInhibitors.every((inhib) => !inhib(warning))) {
101
+ warn(warning);
102
+ }
103
+ };
104
+ }
105
+
106
+ // #endregion
107
+
108
+ function makeBrowserTestConfig() {
109
+ const config = {
110
+ input: {
111
+ include: ["dist-esm/test/**/*.spec.js"],
112
+ exclude: ["dist-esm/test/**/node/**"]
22
113
  },
23
- banner: `/*
24
- * Copyright (c) Microsoft Corporation. All rights reserved.
25
- * Licensed under the MIT License. See License.txt in the project root for license information.
26
- *
27
- * Code generated by Microsoft (R) AutoRest Code Generator.
28
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
29
- */`
30
- },
31
- plugins: [
32
- nodeResolve({ module: true }),
33
- sourcemaps()
34
- ]
114
+ output: {
115
+ file: `dist-test/index.browser.js`,
116
+ format: "umd",
117
+ sourcemap: true
118
+ },
119
+ preserveSymlinks: false,
120
+ plugins: [
121
+ multiEntry({ exports: false }),
122
+ nodeResolve({
123
+ mainFields: ["module", "browser"]
124
+ }),
125
+ cjs({
126
+ namedExports: {
127
+ // Chai's strange internal architecture makes it impossible to statically
128
+ // analyze its exports.
129
+ chai: [
130
+ "version",
131
+ "use",
132
+ "util",
133
+ "config",
134
+ "expect",
135
+ "should",
136
+ "assert"
137
+ ],
138
+ ...openTelemetryCommonJs()
139
+ }
140
+ }),
141
+ json(),
142
+ sourcemaps()
143
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
144
+ ],
145
+ onwarn: makeOnWarnForTesting(),
146
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
147
+ // rollup started respecting the "sideEffects" field in package.json. Since
148
+ // our package.json sets "sideEffects=false", this also applies to test
149
+ // code, which causes all tests to be removed by tree-shaking.
150
+ treeshake: false
151
+ };
152
+
153
+ return config;
154
+ }
155
+
156
+ const defaultConfigurationOptions = {
157
+ disableBrowserBundle: false
35
158
  };
36
159
 
37
- export default config;
160
+ export function makeConfig(pkg, options) {
161
+ options = {
162
+ ...defaultConfigurationOptions,
163
+ ...(options || {})
164
+ };
165
+
166
+ const baseConfig = {
167
+ // Use the package's module field if it has one
168
+ input: pkg["module"] || "dist-esm/src/index.js",
169
+ external: [
170
+ ...nodeBuiltins,
171
+ ...Object.keys(pkg.dependencies),
172
+ ...Object.keys(pkg.devDependencies)
173
+ ],
174
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
175
+ preserveSymlinks: false,
176
+ plugins: [sourcemaps(), nodeResolve(), cjs()]
177
+ };
178
+
179
+ const config = [baseConfig];
180
+
181
+ if (!options.disableBrowserBundle) {
182
+ config.push(makeBrowserTestConfig());
183
+ }
184
+
185
+ return config;
186
+ }
187
+
188
+ export default makeConfig(require("./package.json"));
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
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 * from "./models";
10
+ export { MicrosoftSerialConsoleClient } from "./microsoftSerialConsoleClient";
11
+ export * from "./operationsInterfaces";
@@ -1,52 +1,222 @@
1
1
  /*
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for
4
- * license information.
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
5
4
  *
6
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
7
- * Changes may cause incorrect behavior and will be lost if the code is
8
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
9
7
  */
10
8
 
11
- import * as msRest from "@azure/ms-rest-js";
12
- import { TokenCredential } from "@azure/core-auth";
13
- import * as Models from "./models";
9
+ import * as coreClient from "@azure/core-client";
10
+ import * as coreAuth from "@azure/core-auth";
11
+ import { SerialPortsImpl } from "./operations";
12
+ import { SerialPorts } from "./operationsInterfaces";
13
+ import * as Parameters from "./models/parameters";
14
14
  import * as Mappers from "./models/mappers";
15
- import * as operations from "./operations";
16
- import { MicrosoftSerialConsoleClientContext } from "./microsoftSerialConsoleClientContext";
15
+ import {
16
+ MicrosoftSerialConsoleClientOptionalParams,
17
+ ListOperationsOptionalParams,
18
+ ListOperationsResponse,
19
+ GetConsoleStatusOptionalParams,
20
+ GetConsoleStatusResponse,
21
+ DisableConsoleOptionalParams,
22
+ DisableConsoleResponse,
23
+ EnableConsoleOptionalParams,
24
+ EnableConsoleResponse
25
+ } from "./models";
17
26
 
18
-
19
- class MicrosoftSerialConsoleClient extends MicrosoftSerialConsoleClientContext {
20
- // Operation groups
21
- list: operations.List;
22
- listConsole: operations.ListConsole;
23
- console: operations.Console;
27
+ export class MicrosoftSerialConsoleClient extends coreClient.ServiceClient {
28
+ $host: string;
29
+ apiVersion: string;
30
+ subscriptionId: string;
24
31
 
25
32
  /**
26
33
  * Initializes a new instance of the MicrosoftSerialConsoleClient class.
27
- * @param credentials Credentials needed for the client to connect to Azure. Credentials
28
- * implementing the TokenCredential interface from the @azure/identity package are recommended. For
29
- * more information about these credentials, see
30
- * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
31
- * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
32
- * @azure/ms-rest-browserauth are also supported.
33
- * @param subscriptionId The ID of the target subscription.
34
- * @param [options] The parameter options
34
+ * @param credentials Subscription credentials which uniquely identify client subscription.
35
+ * @param subscriptionId Subscription ID which uniquely identifies the Microsoft Azure subscription.
36
+ * The subscription ID forms part of the URI for every service call requiring it.
37
+ * @param options The parameter options
35
38
  */
36
- constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.MicrosoftSerialConsoleClientOptions) {
37
- super(credentials, subscriptionId, options);
38
- this.list = new operations.List(this);
39
- this.listConsole = new operations.ListConsole(this);
40
- this.console = new operations.Console(this);
39
+ constructor(
40
+ credentials: coreAuth.TokenCredential,
41
+ subscriptionId: string,
42
+ options?: MicrosoftSerialConsoleClientOptionalParams
43
+ ) {
44
+ if (credentials === undefined) {
45
+ throw new Error("'credentials' cannot be null");
46
+ }
47
+ if (subscriptionId === undefined) {
48
+ throw new Error("'subscriptionId' cannot be null");
49
+ }
50
+
51
+ // Initializing default values for options
52
+ if (!options) {
53
+ options = {};
54
+ }
55
+ const defaults: MicrosoftSerialConsoleClientOptionalParams = {
56
+ requestContentType: "application/json; charset=utf-8",
57
+ credential: credentials
58
+ };
59
+
60
+ const packageDetails = `azsdk-js-arm-serialconsole/2.0.0`;
61
+ const userAgentPrefix =
62
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
63
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
64
+ : `${packageDetails}`;
65
+
66
+ if (!options.credentialScopes) {
67
+ options.credentialScopes = ["https://management.azure.com/.default"];
68
+ }
69
+ const optionsWithDefaults = {
70
+ ...defaults,
71
+ ...options,
72
+ userAgentOptions: {
73
+ userAgentPrefix
74
+ },
75
+ baseUri: options.endpoint || "https://management.azure.com"
76
+ };
77
+ super(optionsWithDefaults);
78
+ // Parameter assignments
79
+ this.subscriptionId = subscriptionId;
80
+
81
+ // Assigning values to Constant parameters
82
+ this.$host = options.$host || "https://management.azure.com";
83
+ this.apiVersion = options.apiVersion || "2018-05-01";
84
+ this.serialPorts = new SerialPortsImpl(this);
85
+ }
86
+
87
+ /**
88
+ * Gets a list of Serial Console API operations.
89
+ * @param options The options parameters.
90
+ */
91
+ listOperations(
92
+ options?: ListOperationsOptionalParams
93
+ ): Promise<ListOperationsResponse> {
94
+ return this.sendOperationRequest({ options }, listOperationsOperationSpec);
95
+ }
96
+
97
+ /**
98
+ * Gets whether or not Serial Console is disabled for a given subscription
99
+ * @param defaultParam Default parameter. Leave the value as "default".
100
+ * @param options The options parameters.
101
+ */
102
+ getConsoleStatus(
103
+ defaultParam: string,
104
+ options?: GetConsoleStatusOptionalParams
105
+ ): Promise<GetConsoleStatusResponse> {
106
+ return this.sendOperationRequest(
107
+ { defaultParam, options },
108
+ getConsoleStatusOperationSpec
109
+ );
41
110
  }
42
- }
43
111
 
112
+ /**
113
+ * Disables the Serial Console service for all VMs and VM scale sets in the provided subscription
114
+ * @param defaultParam Default parameter. Leave the value as "default".
115
+ * @param options The options parameters.
116
+ */
117
+ disableConsole(
118
+ defaultParam: string,
119
+ options?: DisableConsoleOptionalParams
120
+ ): Promise<DisableConsoleResponse> {
121
+ return this.sendOperationRequest(
122
+ { defaultParam, options },
123
+ disableConsoleOperationSpec
124
+ );
125
+ }
126
+
127
+ /**
128
+ * Enables the Serial Console service for all VMs and VM scale sets in the provided subscription
129
+ * @param defaultParam Default parameter. Leave the value as "default".
130
+ * @param options The options parameters.
131
+ */
132
+ enableConsole(
133
+ defaultParam: string,
134
+ options?: EnableConsoleOptionalParams
135
+ ): Promise<EnableConsoleResponse> {
136
+ return this.sendOperationRequest(
137
+ { defaultParam, options },
138
+ enableConsoleOperationSpec
139
+ );
140
+ }
141
+
142
+ serialPorts: SerialPorts;
143
+ }
44
144
  // Operation Specifications
145
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
45
146
 
46
- export {
47
- MicrosoftSerialConsoleClient,
48
- MicrosoftSerialConsoleClientContext,
49
- Models as MicrosoftSerialConsoleModels,
50
- Mappers as MicrosoftSerialConsoleMappers
147
+ const listOperationsOperationSpec: coreClient.OperationSpec = {
148
+ path: "/providers/Microsoft.SerialConsole/operations",
149
+ httpMethod: "GET",
150
+ responses: {
151
+ 200: {
152
+ bodyMapper: Mappers.SerialConsoleOperations
153
+ }
154
+ },
155
+ queryParameters: [Parameters.apiVersion],
156
+ urlParameters: [Parameters.$host],
157
+ headerParameters: [Parameters.accept],
158
+ serializer
159
+ };
160
+ const getConsoleStatusOperationSpec: coreClient.OperationSpec = {
161
+ path:
162
+ "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}",
163
+ httpMethod: "GET",
164
+ responses: {
165
+ 200: {
166
+ bodyMapper: Mappers.SerialConsoleStatus
167
+ },
168
+ 404: {
169
+ bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound
170
+ }
171
+ },
172
+ queryParameters: [Parameters.apiVersion],
173
+ urlParameters: [
174
+ Parameters.$host,
175
+ Parameters.subscriptionId,
176
+ Parameters.defaultParam
177
+ ],
178
+ headerParameters: [Parameters.accept],
179
+ serializer
180
+ };
181
+ const disableConsoleOperationSpec: coreClient.OperationSpec = {
182
+ path:
183
+ "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/disableConsole",
184
+ httpMethod: "POST",
185
+ responses: {
186
+ 200: {
187
+ bodyMapper: Mappers.DisableSerialConsoleResult
188
+ },
189
+ 404: {
190
+ bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound
191
+ }
192
+ },
193
+ queryParameters: [Parameters.apiVersion],
194
+ urlParameters: [
195
+ Parameters.$host,
196
+ Parameters.subscriptionId,
197
+ Parameters.defaultParam
198
+ ],
199
+ headerParameters: [Parameters.accept],
200
+ serializer
201
+ };
202
+ const enableConsoleOperationSpec: coreClient.OperationSpec = {
203
+ path:
204
+ "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole",
205
+ httpMethod: "POST",
206
+ responses: {
207
+ 200: {
208
+ bodyMapper: Mappers.EnableSerialConsoleResult
209
+ },
210
+ 404: {
211
+ bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound
212
+ }
213
+ },
214
+ queryParameters: [Parameters.apiVersion],
215
+ urlParameters: [
216
+ Parameters.$host,
217
+ Parameters.subscriptionId,
218
+ Parameters.defaultParam
219
+ ],
220
+ headerParameters: [Parameters.accept],
221
+ serializer
51
222
  };
52
- export * from "./operations";