@azure/arm-confidentialledger 1.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 (109) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +109 -0
  4. package/dist/index.js +1487 -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/checkNameAvailabilitySample.d.ts +2 -0
  9. package/dist-esm/samples-dev/checkNameAvailabilitySample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/checkNameAvailabilitySample.js +33 -0
  11. package/dist-esm/samples-dev/checkNameAvailabilitySample.js.map +1 -0
  12. package/dist-esm/samples-dev/ledgerCreateSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/ledgerCreateSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/ledgerCreateSample.js +51 -0
  15. package/dist-esm/samples-dev/ledgerCreateSample.js.map +1 -0
  16. package/dist-esm/samples-dev/ledgerDeleteSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/ledgerDeleteSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/ledgerDeleteSample.js +31 -0
  19. package/dist-esm/samples-dev/ledgerDeleteSample.js.map +1 -0
  20. package/dist-esm/samples-dev/ledgerGetSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/ledgerGetSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/ledgerGetSample.js +31 -0
  23. package/dist-esm/samples-dev/ledgerGetSample.js.map +1 -0
  24. package/dist-esm/samples-dev/ledgerListByResourceGroupSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/ledgerListByResourceGroupSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/ledgerListByResourceGroupSample.js +44 -0
  27. package/dist-esm/samples-dev/ledgerListByResourceGroupSample.js.map +1 -0
  28. package/dist-esm/samples-dev/ledgerListBySubscriptionSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/ledgerListBySubscriptionSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/ledgerListBySubscriptionSample.js +43 -0
  31. package/dist-esm/samples-dev/ledgerListBySubscriptionSample.js.map +1 -0
  32. package/dist-esm/samples-dev/ledgerUpdateSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/ledgerUpdateSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/ledgerUpdateSample.js +54 -0
  35. package/dist-esm/samples-dev/ledgerUpdateSample.js.map +1 -0
  36. package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
  37. package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
  38. package/dist-esm/samples-dev/operationsListSample.js +43 -0
  39. package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
  40. package/dist-esm/src/confidentialLedgerClient.d.ts +28 -0
  41. package/dist-esm/src/confidentialLedgerClient.d.ts.map +1 -0
  42. package/dist-esm/src/confidentialLedgerClient.js +130 -0
  43. package/dist-esm/src/confidentialLedgerClient.js.map +1 -0
  44. package/dist-esm/src/index.d.ts +5 -0
  45. package/dist-esm/src/index.d.ts.map +1 -0
  46. package/dist-esm/src/index.js +12 -0
  47. package/dist-esm/src/index.js.map +1 -0
  48. package/dist-esm/src/lroImpl.d.ts +16 -0
  49. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  50. package/dist-esm/src/lroImpl.js +29 -0
  51. package/dist-esm/src/lroImpl.js.map +1 -0
  52. package/dist-esm/src/models/index.d.ts +379 -0
  53. package/dist-esm/src/models/index.d.ts.map +1 -0
  54. package/dist-esm/src/models/index.js +47 -0
  55. package/dist-esm/src/models/index.js.map +1 -0
  56. package/dist-esm/src/models/mappers.d.ts +19 -0
  57. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  58. package/dist-esm/src/models/mappers.js +501 -0
  59. package/dist-esm/src/models/mappers.js.map +1 -0
  60. package/dist-esm/src/models/parameters.d.ts +13 -0
  61. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  62. package/dist-esm/src/models/parameters.js +118 -0
  63. package/dist-esm/src/models/parameters.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/ledger.d.ts +107 -0
  69. package/dist-esm/src/operations/ledger.d.ts.map +1 -0
  70. package/dist-esm/src/operations/ledger.js +507 -0
  71. package/dist-esm/src/operations/ledger.js.map +1 -0
  72. package/dist-esm/src/operations/operations.d.ts +32 -0
  73. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  74. package/dist-esm/src/operations/operations.js +120 -0
  75. package/dist-esm/src/operations/operations.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/ledger.d.ts +71 -0
  81. package/dist-esm/src/operationsInterfaces/ledger.d.ts.map +1 -0
  82. package/dist-esm/src/operationsInterfaces/ledger.js +9 -0
  83. package/dist-esm/src/operationsInterfaces/ledger.js.map +1 -0
  84. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  85. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  86. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  87. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  88. package/dist-esm/test/sampleTest.d.ts +2 -0
  89. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  90. package/dist-esm/test/sampleTest.js +38 -0
  91. package/dist-esm/test/sampleTest.js.map +1 -0
  92. package/package.json +122 -0
  93. package/review/arm-confidentialledger.api.md +333 -0
  94. package/rollup.config.js +122 -0
  95. package/src/confidentialLedgerClient.ts +181 -0
  96. package/src/index.ts +12 -0
  97. package/src/lroImpl.ts +34 -0
  98. package/src/models/index.ts +442 -0
  99. package/src/models/mappers.ts +524 -0
  100. package/src/models/parameters.ts +137 -0
  101. package/src/operations/index.ts +10 -0
  102. package/src/operations/ledger.ts +674 -0
  103. package/src/operations/operations.ts +137 -0
  104. package/src/operationsInterfaces/index.ts +10 -0
  105. package/src/operationsInterfaces/ledger.ts +132 -0
  106. package/src/operationsInterfaces/operations.ts +25 -0
  107. package/tsconfig.json +33 -0
  108. package/types/arm-confidentialledger.d.ts +534 -0
  109. package/types/tsdoc-metadata.json +11 -0
@@ -0,0 +1,333 @@
1
+ ## API Report File for "@azure/arm-confidentialledger"
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 interface AADBasedSecurityPrincipal {
15
+ ledgerRoleName?: LedgerRoleName;
16
+ principalId?: string;
17
+ tenantId?: string;
18
+ }
19
+
20
+ // @public
21
+ export interface CertBasedSecurityPrincipal {
22
+ cert?: string;
23
+ ledgerRoleName?: LedgerRoleName;
24
+ }
25
+
26
+ // @public
27
+ export type CheckNameAvailabilityOperationResponse = CheckNameAvailabilityResponse;
28
+
29
+ // @public
30
+ export interface CheckNameAvailabilityOptionalParams extends coreClient.OperationOptions {
31
+ }
32
+
33
+ // @public
34
+ export type CheckNameAvailabilityReason = string;
35
+
36
+ // @public
37
+ export interface CheckNameAvailabilityRequest {
38
+ name?: string;
39
+ type?: string;
40
+ }
41
+
42
+ // @public
43
+ export interface CheckNameAvailabilityResponse {
44
+ message?: string;
45
+ nameAvailable?: boolean;
46
+ reason?: CheckNameAvailabilityReason;
47
+ }
48
+
49
+ // @public
50
+ export type ConfidentialLedger = Resource & ResourceLocation & Tags & {
51
+ properties?: LedgerProperties;
52
+ };
53
+
54
+ // @public (undocumented)
55
+ export class ConfidentialLedgerClient extends coreClient.ServiceClient {
56
+ // (undocumented)
57
+ $host: string;
58
+ constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ConfidentialLedgerClientOptionalParams);
59
+ // (undocumented)
60
+ apiVersion: string;
61
+ checkNameAvailability(nameAvailabilityRequest: CheckNameAvailabilityRequest, options?: CheckNameAvailabilityOptionalParams): Promise<CheckNameAvailabilityOperationResponse>;
62
+ // (undocumented)
63
+ ledger: Ledger;
64
+ // (undocumented)
65
+ operations: Operations;
66
+ // (undocumented)
67
+ subscriptionId: string;
68
+ }
69
+
70
+ // @public
71
+ export interface ConfidentialLedgerClientOptionalParams extends coreClient.ServiceClientOptions {
72
+ $host?: string;
73
+ apiVersion?: string;
74
+ endpoint?: string;
75
+ }
76
+
77
+ // @public
78
+ export interface ConfidentialLedgerList {
79
+ nextLink?: string;
80
+ value?: ConfidentialLedger[];
81
+ }
82
+
83
+ // @public
84
+ export type CreatedByType = string;
85
+
86
+ // @public
87
+ export interface ErrorAdditionalInfo {
88
+ readonly info?: Record<string, unknown>;
89
+ readonly type?: string;
90
+ }
91
+
92
+ // @public
93
+ export interface ErrorDetail {
94
+ readonly additionalInfo?: ErrorAdditionalInfo[];
95
+ readonly code?: string;
96
+ readonly details?: ErrorDetail[];
97
+ readonly message?: string;
98
+ readonly target?: string;
99
+ }
100
+
101
+ // @public
102
+ export interface ErrorResponse {
103
+ error?: ErrorDetail;
104
+ }
105
+
106
+ // @public
107
+ export enum KnownCheckNameAvailabilityReason {
108
+ // (undocumented)
109
+ AlreadyExists = "AlreadyExists",
110
+ // (undocumented)
111
+ Invalid = "Invalid"
112
+ }
113
+
114
+ // @public
115
+ export enum KnownCreatedByType {
116
+ // (undocumented)
117
+ Application = "Application",
118
+ // (undocumented)
119
+ Key = "Key",
120
+ // (undocumented)
121
+ ManagedIdentity = "ManagedIdentity",
122
+ // (undocumented)
123
+ User = "User"
124
+ }
125
+
126
+ // @public
127
+ export enum KnownLedgerRoleName {
128
+ // (undocumented)
129
+ Administrator = "Administrator",
130
+ // (undocumented)
131
+ Contributor = "Contributor",
132
+ // (undocumented)
133
+ Reader = "Reader"
134
+ }
135
+
136
+ // @public
137
+ export enum KnownLedgerType {
138
+ // (undocumented)
139
+ Private = "Private",
140
+ // (undocumented)
141
+ Public = "Public",
142
+ // (undocumented)
143
+ Unknown = "Unknown"
144
+ }
145
+
146
+ // @public
147
+ export enum KnownProvisioningState {
148
+ // (undocumented)
149
+ Canceled = "Canceled",
150
+ // (undocumented)
151
+ Creating = "Creating",
152
+ // (undocumented)
153
+ Deleting = "Deleting",
154
+ // (undocumented)
155
+ Failed = "Failed",
156
+ // (undocumented)
157
+ Succeeded = "Succeeded",
158
+ // (undocumented)
159
+ Unknown = "Unknown",
160
+ // (undocumented)
161
+ Updating = "Updating"
162
+ }
163
+
164
+ // @public
165
+ export interface Ledger {
166
+ beginCreate(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerCreateOptionalParams): Promise<PollerLike<PollOperationState<LedgerCreateResponse>, LedgerCreateResponse>>;
167
+ beginCreateAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerCreateOptionalParams): Promise<LedgerCreateResponse>;
168
+ beginDelete(resourceGroupName: string, ledgerName: string, options?: LedgerDeleteOptionalParams): Promise<PollerLike<PollOperationState<void>, void>>;
169
+ beginDeleteAndWait(resourceGroupName: string, ledgerName: string, options?: LedgerDeleteOptionalParams): Promise<void>;
170
+ beginUpdate(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams): Promise<PollerLike<PollOperationState<LedgerUpdateResponse>, LedgerUpdateResponse>>;
171
+ beginUpdateAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams): Promise<LedgerUpdateResponse>;
172
+ get(resourceGroupName: string, ledgerName: string, options?: LedgerGetOptionalParams): Promise<LedgerGetResponse>;
173
+ listByResourceGroup(resourceGroupName: string, options?: LedgerListByResourceGroupOptionalParams): PagedAsyncIterableIterator<ConfidentialLedger>;
174
+ listBySubscription(options?: LedgerListBySubscriptionOptionalParams): PagedAsyncIterableIterator<ConfidentialLedger>;
175
+ }
176
+
177
+ // @public
178
+ export interface LedgerCreateOptionalParams extends coreClient.OperationOptions {
179
+ resumeFrom?: string;
180
+ updateIntervalInMs?: number;
181
+ }
182
+
183
+ // @public
184
+ export type LedgerCreateResponse = ConfidentialLedger;
185
+
186
+ // @public
187
+ export interface LedgerDeleteOptionalParams extends coreClient.OperationOptions {
188
+ resumeFrom?: string;
189
+ updateIntervalInMs?: number;
190
+ }
191
+
192
+ // @public
193
+ export interface LedgerGetOptionalParams extends coreClient.OperationOptions {
194
+ }
195
+
196
+ // @public
197
+ export type LedgerGetResponse = ConfidentialLedger;
198
+
199
+ // @public
200
+ export interface LedgerListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
201
+ filter?: string;
202
+ }
203
+
204
+ // @public
205
+ export type LedgerListByResourceGroupNextResponse = ConfidentialLedgerList;
206
+
207
+ // @public
208
+ export interface LedgerListByResourceGroupOptionalParams extends coreClient.OperationOptions {
209
+ filter?: string;
210
+ }
211
+
212
+ // @public
213
+ export type LedgerListByResourceGroupResponse = ConfidentialLedgerList;
214
+
215
+ // @public
216
+ export interface LedgerListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {
217
+ filter?: string;
218
+ }
219
+
220
+ // @public
221
+ export type LedgerListBySubscriptionNextResponse = ConfidentialLedgerList;
222
+
223
+ // @public
224
+ export interface LedgerListBySubscriptionOptionalParams extends coreClient.OperationOptions {
225
+ filter?: string;
226
+ }
227
+
228
+ // @public
229
+ export type LedgerListBySubscriptionResponse = ConfidentialLedgerList;
230
+
231
+ // @public
232
+ export interface LedgerProperties {
233
+ aadBasedSecurityPrincipals?: AADBasedSecurityPrincipal[];
234
+ certBasedSecurityPrincipals?: CertBasedSecurityPrincipal[];
235
+ readonly identityServiceUri?: string;
236
+ readonly ledgerInternalNamespace?: string;
237
+ readonly ledgerName?: string;
238
+ ledgerType?: LedgerType;
239
+ readonly ledgerUri?: string;
240
+ readonly provisioningState?: ProvisioningState;
241
+ }
242
+
243
+ // @public
244
+ export type LedgerRoleName = string;
245
+
246
+ // @public
247
+ export type LedgerType = string;
248
+
249
+ // @public
250
+ export interface LedgerUpdateOptionalParams extends coreClient.OperationOptions {
251
+ resumeFrom?: string;
252
+ updateIntervalInMs?: number;
253
+ }
254
+
255
+ // @public
256
+ export type LedgerUpdateResponse = ConfidentialLedger;
257
+
258
+ // @public
259
+ export interface Operations {
260
+ list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator<ResourceProviderOperationDefinition>;
261
+ }
262
+
263
+ // @public
264
+ export interface OperationsListNextOptionalParams extends coreClient.OperationOptions {
265
+ }
266
+
267
+ // @public
268
+ export type OperationsListNextResponse = ResourceProviderOperationList;
269
+
270
+ // @public
271
+ export interface OperationsListOptionalParams extends coreClient.OperationOptions {
272
+ }
273
+
274
+ // @public
275
+ export type OperationsListResponse = ResourceProviderOperationList;
276
+
277
+ // @public
278
+ export type ProvisioningState = string;
279
+
280
+ // @public
281
+ export interface Resource {
282
+ readonly id?: string;
283
+ readonly name?: string;
284
+ readonly systemData?: SystemData;
285
+ readonly type?: string;
286
+ }
287
+
288
+ // @public
289
+ export interface ResourceLocation {
290
+ location?: string;
291
+ }
292
+
293
+ // @public
294
+ export interface ResourceProviderOperationDefinition {
295
+ display?: ResourceProviderOperationDisplay;
296
+ isDataAction?: boolean;
297
+ name?: string;
298
+ }
299
+
300
+ // @public
301
+ export interface ResourceProviderOperationDisplay {
302
+ description?: string;
303
+ operation?: string;
304
+ provider?: string;
305
+ resource?: string;
306
+ }
307
+
308
+ // @public
309
+ export interface ResourceProviderOperationList {
310
+ readonly nextLink?: string;
311
+ readonly value?: ResourceProviderOperationDefinition[];
312
+ }
313
+
314
+ // @public
315
+ export interface SystemData {
316
+ createdAt?: Date;
317
+ createdBy?: string;
318
+ createdByType?: CreatedByType;
319
+ lastModifiedAt?: Date;
320
+ lastModifiedBy?: string;
321
+ lastModifiedByType?: CreatedByType;
322
+ }
323
+
324
+ // @public
325
+ export interface Tags {
326
+ tags?: {
327
+ [propertyName: string]: string;
328
+ };
329
+ }
330
+
331
+ // (No @packageDocumentation comment for this package)
332
+
333
+ ```
@@ -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,181 @@
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 {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
16
+ import * as coreAuth from "@azure/core-auth";
17
+ import { OperationsImpl, LedgerImpl } from "./operations";
18
+ import { Operations, Ledger } from "./operationsInterfaces";
19
+ import * as Parameters from "./models/parameters";
20
+ import * as Mappers from "./models/mappers";
21
+ import {
22
+ ConfidentialLedgerClientOptionalParams,
23
+ CheckNameAvailabilityRequest,
24
+ CheckNameAvailabilityOptionalParams,
25
+ CheckNameAvailabilityOperationResponse
26
+ } from "./models";
27
+
28
+ export class ConfidentialLedgerClient extends coreClient.ServiceClient {
29
+ $host: string;
30
+ apiVersion: string;
31
+ subscriptionId: string;
32
+
33
+ /**
34
+ * Initializes a new instance of the ConfidentialLedgerClient class.
35
+ * @param credentials Subscription credentials which uniquely identify client subscription.
36
+ * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g.
37
+ * 00000000-0000-0000-0000-000000000000)
38
+ * @param options The parameter options
39
+ */
40
+ constructor(
41
+ credentials: coreAuth.TokenCredential,
42
+ subscriptionId: string,
43
+ options?: ConfidentialLedgerClientOptionalParams
44
+ ) {
45
+ if (credentials === undefined) {
46
+ throw new Error("'credentials' cannot be null");
47
+ }
48
+ if (subscriptionId === undefined) {
49
+ throw new Error("'subscriptionId' cannot be null");
50
+ }
51
+
52
+ // Initializing default values for options
53
+ if (!options) {
54
+ options = {};
55
+ }
56
+ const defaults: ConfidentialLedgerClientOptionalParams = {
57
+ requestContentType: "application/json; charset=utf-8",
58
+ credential: credentials
59
+ };
60
+
61
+ const packageDetails = `azsdk-js-arm-confidentialledger/1.0.0`;
62
+ const userAgentPrefix =
63
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
64
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
65
+ : `${packageDetails}`;
66
+
67
+ if (!options.credentialScopes) {
68
+ options.credentialScopes = ["https://management.azure.com/.default"];
69
+ }
70
+ const optionsWithDefaults = {
71
+ ...defaults,
72
+ ...options,
73
+ userAgentOptions: {
74
+ userAgentPrefix
75
+ },
76
+ baseUri:
77
+ options.endpoint ?? options.baseUri ?? "https://management.azure.com"
78
+ };
79
+ super(optionsWithDefaults);
80
+
81
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
82
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
83
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
84
+ (pipelinePolicy) =>
85
+ pipelinePolicy.name ===
86
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
87
+ );
88
+ if (!bearerTokenAuthenticationPolicyFound) {
89
+ this.pipeline.removePolicy({
90
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
91
+ });
92
+ this.pipeline.addPolicy(
93
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
94
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
95
+ challengeCallbacks: {
96
+ authorizeRequestOnChallenge:
97
+ coreClient.authorizeRequestOnClaimChallenge
98
+ }
99
+ })
100
+ );
101
+ }
102
+ }
103
+ // Parameter assignments
104
+ this.subscriptionId = subscriptionId;
105
+
106
+ // Assigning values to Constant parameters
107
+ this.$host = options.$host || "https://management.azure.com";
108
+ this.apiVersion = options.apiVersion || "2022-05-13";
109
+ this.operations = new OperationsImpl(this);
110
+ this.ledger = new LedgerImpl(this);
111
+ this.addCustomApiVersionPolicy(options.apiVersion);
112
+ }
113
+
114
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
115
+ private addCustomApiVersionPolicy(apiVersion?: string) {
116
+ if (!apiVersion) {
117
+ return;
118
+ }
119
+ const apiVersionPolicy = {
120
+ name: "CustomApiVersionPolicy",
121
+ async sendRequest(
122
+ request: PipelineRequest,
123
+ next: SendRequest
124
+ ): Promise<PipelineResponse> {
125
+ const param = request.url.split("?");
126
+ if (param.length > 1) {
127
+ const newParams = param[1].split("&").map((item) => {
128
+ if (item.indexOf("api-version") > -1) {
129
+ return item.replace(/(?<==).*$/, apiVersion);
130
+ } else {
131
+ return item;
132
+ }
133
+ });
134
+ request.url = param[0] + "?" + newParams.join("&");
135
+ }
136
+ return next(request);
137
+ }
138
+ };
139
+ this.pipeline.addPolicy(apiVersionPolicy);
140
+ }
141
+
142
+ /**
143
+ * To check whether a resource name is available.
144
+ * @param nameAvailabilityRequest Name availability request payload.
145
+ * @param options The options parameters.
146
+ */
147
+ checkNameAvailability(
148
+ nameAvailabilityRequest: CheckNameAvailabilityRequest,
149
+ options?: CheckNameAvailabilityOptionalParams
150
+ ): Promise<CheckNameAvailabilityOperationResponse> {
151
+ return this.sendOperationRequest(
152
+ { nameAvailabilityRequest, options },
153
+ checkNameAvailabilityOperationSpec
154
+ );
155
+ }
156
+
157
+ operations: Operations;
158
+ ledger: Ledger;
159
+ }
160
+ // Operation Specifications
161
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
162
+
163
+ const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = {
164
+ path:
165
+ "/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability",
166
+ httpMethod: "POST",
167
+ responses: {
168
+ 200: {
169
+ bodyMapper: Mappers.CheckNameAvailabilityResponse
170
+ },
171
+ default: {
172
+ bodyMapper: Mappers.ErrorResponse
173
+ }
174
+ },
175
+ requestBody: Parameters.nameAvailabilityRequest,
176
+ queryParameters: [Parameters.apiVersion],
177
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
178
+ headerParameters: [Parameters.accept, Parameters.contentType],
179
+ mediaType: "json",
180
+ serializer
181
+ };
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 { ConfidentialLedgerClient } from "./confidentialLedgerClient";
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
+ }