@azure/arm-graphservices 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 (120) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +109 -0
  4. package/dist/index.js +1313 -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/accountCreateAndUpdateSample.d.ts +2 -0
  9. package/dist-esm/samples-dev/accountCreateAndUpdateSample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/accountCreateAndUpdateSample.js +43 -0
  11. package/dist-esm/samples-dev/accountCreateAndUpdateSample.js.map +1 -0
  12. package/dist-esm/samples-dev/accountDeleteSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/accountDeleteSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/accountDeleteSample.js +39 -0
  15. package/dist-esm/samples-dev/accountDeleteSample.js.map +1 -0
  16. package/dist-esm/samples-dev/accountGetSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/accountGetSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/accountGetSample.js +39 -0
  19. package/dist-esm/samples-dev/accountGetSample.js.map +1 -0
  20. package/dist-esm/samples-dev/accountUpdateSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/accountUpdateSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/accountUpdateSample.js +42 -0
  23. package/dist-esm/samples-dev/accountUpdateSample.js.map +1 -0
  24. package/dist-esm/samples-dev/accountsListByResourceGroupSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/accountsListByResourceGroupSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/accountsListByResourceGroupSample.js +52 -0
  27. package/dist-esm/samples-dev/accountsListByResourceGroupSample.js.map +1 -0
  28. package/dist-esm/samples-dev/accountsListBySubscriptionSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/accountsListBySubscriptionSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/accountsListBySubscriptionSample.js +51 -0
  31. package/dist-esm/samples-dev/accountsListBySubscriptionSample.js.map +1 -0
  32. package/dist-esm/samples-dev/operationListSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/operationListSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/operationListSample.js +51 -0
  35. package/dist-esm/samples-dev/operationListSample.js.map +1 -0
  36. package/dist-esm/src/graphServices.d.ts +22 -0
  37. package/dist-esm/src/graphServices.d.ts.map +1 -0
  38. package/dist-esm/src/graphServices.js +102 -0
  39. package/dist-esm/src/graphServices.js.map +1 -0
  40. package/dist-esm/src/index.d.ts +6 -0
  41. package/dist-esm/src/index.d.ts.map +1 -0
  42. package/dist-esm/src/index.js +13 -0
  43. package/dist-esm/src/index.js.map +1 -0
  44. package/dist-esm/src/lroImpl.d.ts +11 -0
  45. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  46. package/dist-esm/src/lroImpl.js +21 -0
  47. package/dist-esm/src/lroImpl.js.map +1 -0
  48. package/dist-esm/src/models/index.d.ts +320 -0
  49. package/dist-esm/src/models/index.d.ts.map +1 -0
  50. package/dist-esm/src/models/index.js +46 -0
  51. package/dist-esm/src/models/index.js.map +1 -0
  52. package/dist-esm/src/models/mappers.d.ts +15 -0
  53. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  54. package/dist-esm/src/models/mappers.js +384 -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 +109 -0
  59. package/dist-esm/src/models/parameters.js.map +1 -0
  60. package/dist-esm/src/operations/account.d.ts +52 -0
  61. package/dist-esm/src/operations/account.d.ts.map +1 -0
  62. package/dist-esm/src/operations/account.js +208 -0
  63. package/dist-esm/src/operations/account.js.map +1 -0
  64. package/dist-esm/src/operations/accounts.d.ts +53 -0
  65. package/dist-esm/src/operations/accounts.d.ts.map +1 -0
  66. package/dist-esm/src/operations/accounts.js +252 -0
  67. package/dist-esm/src/operations/accounts.js.map +1 -0
  68. package/dist-esm/src/operations/index.d.ts +4 -0
  69. package/dist-esm/src/operations/index.d.ts.map +1 -0
  70. package/dist-esm/src/operations/index.js +11 -0
  71. package/dist-esm/src/operations/index.js.map +1 -0
  72. package/dist-esm/src/operations/operationOperations.d.ts +32 -0
  73. package/dist-esm/src/operations/operationOperations.d.ts.map +1 -0
  74. package/dist-esm/src/operations/operationOperations.js +131 -0
  75. package/dist-esm/src/operations/operationOperations.js.map +1 -0
  76. package/dist-esm/src/operationsInterfaces/account.d.ts +44 -0
  77. package/dist-esm/src/operationsInterfaces/account.d.ts.map +1 -0
  78. package/dist-esm/src/operationsInterfaces/account.js +9 -0
  79. package/dist-esm/src/operationsInterfaces/account.js.map +1 -0
  80. package/dist-esm/src/operationsInterfaces/accounts.d.ts +17 -0
  81. package/dist-esm/src/operationsInterfaces/accounts.d.ts.map +1 -0
  82. package/dist-esm/src/operationsInterfaces/accounts.js +9 -0
  83. package/dist-esm/src/operationsInterfaces/accounts.js.map +1 -0
  84. package/dist-esm/src/operationsInterfaces/index.d.ts +4 -0
  85. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  86. package/dist-esm/src/operationsInterfaces/index.js +11 -0
  87. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  88. package/dist-esm/src/operationsInterfaces/operationOperations.d.ts +11 -0
  89. package/dist-esm/src/operationsInterfaces/operationOperations.d.ts.map +1 -0
  90. package/dist-esm/src/operationsInterfaces/operationOperations.js +9 -0
  91. package/dist-esm/src/operationsInterfaces/operationOperations.js.map +1 -0
  92. package/dist-esm/src/pagingHelper.d.ts +13 -0
  93. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  94. package/dist-esm/src/pagingHelper.js +32 -0
  95. package/dist-esm/src/pagingHelper.js.map +1 -0
  96. package/dist-esm/test/graphservices_operations_test.spec.d.ts +4 -0
  97. package/dist-esm/test/graphservices_operations_test.spec.d.ts.map +1 -0
  98. package/dist-esm/test/graphservices_operations_test.spec.js +55 -0
  99. package/dist-esm/test/graphservices_operations_test.spec.js.map +1 -0
  100. package/package.json +123 -0
  101. package/review/arm-graphservices.api.md +262 -0
  102. package/rollup.config.js +122 -0
  103. package/src/graphServices.ts +148 -0
  104. package/src/index.ts +13 -0
  105. package/src/lroImpl.ts +42 -0
  106. package/src/models/index.ts +364 -0
  107. package/src/models/mappers.ts +408 -0
  108. package/src/models/parameters.ts +127 -0
  109. package/src/operations/account.ts +295 -0
  110. package/src/operations/accounts.ts +303 -0
  111. package/src/operations/index.ts +11 -0
  112. package/src/operations/operationOperations.ts +149 -0
  113. package/src/operationsInterfaces/account.ts +90 -0
  114. package/src/operationsInterfaces/accounts.ts +35 -0
  115. package/src/operationsInterfaces/index.ts +11 -0
  116. package/src/operationsInterfaces/operationOperations.ts +22 -0
  117. package/src/pagingHelper.ts +39 -0
  118. package/tsconfig.json +33 -0
  119. package/types/arm-graphservices.d.ts +459 -0
  120. package/types/tsdoc-metadata.json +11 -0
@@ -0,0 +1,262 @@
1
+ ## API Report File for "@azure/arm-graphservices"
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 { OperationState } from '@azure/core-lro';
10
+ import { PagedAsyncIterableIterator } from '@azure/core-paging';
11
+ import { SimplePollerLike } from '@azure/core-lro';
12
+
13
+ // @public
14
+ export interface Account {
15
+ beginCreateAndUpdate(resourceGroupName: string, resourceName: string, accountResource: AccountResource, options?: AccountCreateAndUpdateOptionalParams): Promise<SimplePollerLike<OperationState<AccountCreateAndUpdateResponse>, AccountCreateAndUpdateResponse>>;
16
+ beginCreateAndUpdateAndWait(resourceGroupName: string, resourceName: string, accountResource: AccountResource, options?: AccountCreateAndUpdateOptionalParams): Promise<AccountCreateAndUpdateResponse>;
17
+ delete(resourceGroupName: string, resourceName: string, options?: AccountDeleteOptionalParams): Promise<void>;
18
+ get(resourceGroupName: string, resourceName: string, options?: AccountGetOptionalParams): Promise<AccountGetResponse>;
19
+ update(resourceGroupName: string, resourceName: string, accountResource: AccountPatchResource, options?: AccountUpdateOptionalParams): Promise<AccountUpdateResponse>;
20
+ }
21
+
22
+ // @public
23
+ export interface AccountCreateAndUpdateOptionalParams extends coreClient.OperationOptions {
24
+ resumeFrom?: string;
25
+ updateIntervalInMs?: number;
26
+ }
27
+
28
+ // @public
29
+ export type AccountCreateAndUpdateResponse = AccountResource;
30
+
31
+ // @public
32
+ export interface AccountDeleteOptionalParams extends coreClient.OperationOptions {
33
+ }
34
+
35
+ // @public
36
+ export interface AccountGetOptionalParams extends coreClient.OperationOptions {
37
+ }
38
+
39
+ // @public
40
+ export type AccountGetResponse = AccountResource;
41
+
42
+ // @public
43
+ export interface AccountPatchResource extends TagUpdate {
44
+ }
45
+
46
+ // @public
47
+ export interface AccountResource extends Resource {
48
+ properties: AccountResourceProperties;
49
+ readonly systemData?: AccountResourceSystemData;
50
+ }
51
+
52
+ // @public
53
+ export interface AccountResourceList {
54
+ nextLink?: string;
55
+ value?: AccountResource[];
56
+ }
57
+
58
+ // @public
59
+ export interface AccountResourceProperties {
60
+ appId: string;
61
+ readonly billingPlanId?: string;
62
+ readonly provisioningState?: ProvisioningState;
63
+ }
64
+
65
+ // @public
66
+ export interface AccountResourceSystemData {
67
+ createdAt?: Date;
68
+ createdByType?: CreatedByType;
69
+ lastModifiedAt?: Date;
70
+ lastModifiedByType?: CreatedByType;
71
+ }
72
+
73
+ // @public
74
+ export interface Accounts {
75
+ listByResourceGroup(resourceGroupName: string, options?: AccountsListByResourceGroupOptionalParams): PagedAsyncIterableIterator<AccountResource>;
76
+ listBySubscription(options?: AccountsListBySubscriptionOptionalParams): PagedAsyncIterableIterator<AccountResource>;
77
+ }
78
+
79
+ // @public
80
+ export interface AccountsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
81
+ }
82
+
83
+ // @public
84
+ export type AccountsListByResourceGroupNextResponse = AccountResourceList;
85
+
86
+ // @public
87
+ export interface AccountsListByResourceGroupOptionalParams extends coreClient.OperationOptions {
88
+ }
89
+
90
+ // @public
91
+ export type AccountsListByResourceGroupResponse = AccountResourceList;
92
+
93
+ // @public
94
+ export interface AccountsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {
95
+ }
96
+
97
+ // @public
98
+ export type AccountsListBySubscriptionNextResponse = AccountResourceList;
99
+
100
+ // @public
101
+ export interface AccountsListBySubscriptionOptionalParams extends coreClient.OperationOptions {
102
+ }
103
+
104
+ // @public
105
+ export type AccountsListBySubscriptionResponse = AccountResourceList;
106
+
107
+ // @public
108
+ export interface AccountUpdateOptionalParams extends coreClient.OperationOptions {
109
+ }
110
+
111
+ // @public
112
+ export type AccountUpdateResponse = AccountResource;
113
+
114
+ // @public
115
+ export type ActionType = string;
116
+
117
+ // @public
118
+ export type CreatedByType = string;
119
+
120
+ // @public
121
+ export interface ErrorAdditionalInfo {
122
+ readonly info?: Record<string, unknown>;
123
+ readonly type?: string;
124
+ }
125
+
126
+ // @public
127
+ export interface ErrorDetail {
128
+ readonly additionalInfo?: ErrorAdditionalInfo[];
129
+ readonly code?: string;
130
+ readonly details?: ErrorDetail[];
131
+ readonly message?: string;
132
+ readonly target?: string;
133
+ }
134
+
135
+ // @public
136
+ export interface ErrorResponse {
137
+ error?: ErrorDetail;
138
+ }
139
+
140
+ // @public
141
+ export function getContinuationToken(page: unknown): string | undefined;
142
+
143
+ // @public (undocumented)
144
+ export class GraphServices extends coreClient.ServiceClient {
145
+ // (undocumented)
146
+ $host: string;
147
+ constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: GraphServicesOptionalParams);
148
+ // (undocumented)
149
+ account: Account;
150
+ // (undocumented)
151
+ accounts: Accounts;
152
+ // (undocumented)
153
+ apiVersion: string;
154
+ // (undocumented)
155
+ operationOperations: OperationOperations;
156
+ // (undocumented)
157
+ subscriptionId: string;
158
+ }
159
+
160
+ // @public
161
+ export interface GraphServicesOptionalParams extends coreClient.ServiceClientOptions {
162
+ $host?: string;
163
+ apiVersion?: string;
164
+ endpoint?: string;
165
+ }
166
+
167
+ // @public
168
+ export enum KnownActionType {
169
+ Internal = "Internal"
170
+ }
171
+
172
+ // @public
173
+ export enum KnownCreatedByType {
174
+ Application = "Application",
175
+ Key = "Key",
176
+ ManagedIdentity = "ManagedIdentity",
177
+ User = "User"
178
+ }
179
+
180
+ // @public
181
+ export enum KnownOrigin {
182
+ System = "system",
183
+ User = "user",
184
+ UserSystem = "user,system"
185
+ }
186
+
187
+ // @public
188
+ export enum KnownProvisioningState {
189
+ Canceled = "Canceled",
190
+ Failed = "Failed",
191
+ Succeeded = "Succeeded"
192
+ }
193
+
194
+ // @public
195
+ export interface Operation {
196
+ readonly actionType?: ActionType;
197
+ display?: OperationDisplay;
198
+ readonly isDataAction?: boolean;
199
+ readonly name?: string;
200
+ readonly origin?: Origin;
201
+ }
202
+
203
+ // @public
204
+ export interface OperationDisplay {
205
+ readonly description?: string;
206
+ readonly operation?: string;
207
+ readonly provider?: string;
208
+ readonly resource?: string;
209
+ }
210
+
211
+ // @public
212
+ export interface OperationListNextOptionalParams extends coreClient.OperationOptions {
213
+ }
214
+
215
+ // @public
216
+ export type OperationListNextResponse = OperationListResult;
217
+
218
+ // @public
219
+ export interface OperationListOptionalParams extends coreClient.OperationOptions {
220
+ }
221
+
222
+ // @public
223
+ export type OperationListResponse = OperationListResult;
224
+
225
+ // @public
226
+ export interface OperationListResult {
227
+ readonly nextLink?: string;
228
+ readonly value?: Operation[];
229
+ }
230
+
231
+ // @public
232
+ export interface OperationOperations {
233
+ list(options?: OperationListOptionalParams): PagedAsyncIterableIterator<Operation>;
234
+ }
235
+
236
+ // @public
237
+ export type Origin = string;
238
+
239
+ // @public
240
+ export type ProvisioningState = string;
241
+
242
+ // @public
243
+ export interface Resource {
244
+ readonly id?: string;
245
+ location?: string;
246
+ readonly name?: string;
247
+ tags?: {
248
+ [propertyName: string]: string;
249
+ };
250
+ readonly type?: string;
251
+ }
252
+
253
+ // @public
254
+ export interface TagUpdate {
255
+ tags?: {
256
+ [propertyName: string]: string;
257
+ };
258
+ }
259
+
260
+ // (No @packageDocumentation comment for this package)
261
+
262
+ ```
@@ -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,148 @@
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 {
18
+ AccountsImpl,
19
+ AccountImpl,
20
+ OperationOperationsImpl
21
+ } from "./operations";
22
+ import { Accounts, Account, OperationOperations } from "./operationsInterfaces";
23
+ import { GraphServicesOptionalParams } from "./models";
24
+
25
+ export class GraphServices extends coreClient.ServiceClient {
26
+ $host: string;
27
+ apiVersion: string;
28
+ subscriptionId: string;
29
+
30
+ /**
31
+ * Initializes a new instance of the GraphServices class.
32
+ * @param credentials Subscription credentials which uniquely identify client subscription.
33
+ * @param subscriptionId The ID of the target subscription.
34
+ * @param options The parameter options
35
+ */
36
+ constructor(
37
+ credentials: coreAuth.TokenCredential,
38
+ subscriptionId: string,
39
+ options?: GraphServicesOptionalParams
40
+ ) {
41
+ if (credentials === undefined) {
42
+ throw new Error("'credentials' cannot be null");
43
+ }
44
+ if (subscriptionId === undefined) {
45
+ throw new Error("'subscriptionId' cannot be null");
46
+ }
47
+
48
+ // Initializing default values for options
49
+ if (!options) {
50
+ options = {};
51
+ }
52
+ const defaults: GraphServicesOptionalParams = {
53
+ requestContentType: "application/json; charset=utf-8",
54
+ credential: credentials
55
+ };
56
+
57
+ const packageDetails = `azsdk-js-arm-graphservices/1.0.0-beta.1`;
58
+ const userAgentPrefix =
59
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
60
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
61
+ : `${packageDetails}`;
62
+
63
+ const optionsWithDefaults = {
64
+ ...defaults,
65
+ ...options,
66
+ userAgentOptions: {
67
+ userAgentPrefix
68
+ },
69
+ endpoint:
70
+ options.endpoint ?? options.baseUri ?? "https://management.azure.com"
71
+ };
72
+ super(optionsWithDefaults);
73
+
74
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
75
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
76
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
77
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
78
+ (pipelinePolicy) =>
79
+ pipelinePolicy.name ===
80
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
81
+ );
82
+ }
83
+ if (
84
+ !options ||
85
+ !options.pipeline ||
86
+ options.pipeline.getOrderedPolicies().length == 0 ||
87
+ !bearerTokenAuthenticationPolicyFound
88
+ ) {
89
+ this.pipeline.removePolicy({
90
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
91
+ });
92
+ this.pipeline.addPolicy(
93
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
94
+ credential: credentials,
95
+ scopes:
96
+ optionsWithDefaults.credentialScopes ??
97
+ `${optionsWithDefaults.endpoint}/.default`,
98
+ challengeCallbacks: {
99
+ authorizeRequestOnChallenge:
100
+ coreClient.authorizeRequestOnClaimChallenge
101
+ }
102
+ })
103
+ );
104
+ }
105
+ // Parameter assignments
106
+ this.subscriptionId = subscriptionId;
107
+
108
+ // Assigning values to Constant parameters
109
+ this.$host = options.$host || "https://management.azure.com";
110
+ this.apiVersion = options.apiVersion || "2022-09-22-preview";
111
+ this.accounts = new AccountsImpl(this);
112
+ this.account = new AccountImpl(this);
113
+ this.operationOperations = new OperationOperationsImpl(this);
114
+ this.addCustomApiVersionPolicy(options.apiVersion);
115
+ }
116
+
117
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
118
+ private addCustomApiVersionPolicy(apiVersion?: string) {
119
+ if (!apiVersion) {
120
+ return;
121
+ }
122
+ const apiVersionPolicy = {
123
+ name: "CustomApiVersionPolicy",
124
+ async sendRequest(
125
+ request: PipelineRequest,
126
+ next: SendRequest
127
+ ): Promise<PipelineResponse> {
128
+ const param = request.url.split("?");
129
+ if (param.length > 1) {
130
+ const newParams = param[1].split("&").map((item) => {
131
+ if (item.indexOf("api-version") > -1) {
132
+ return "api-version=" + apiVersion;
133
+ } else {
134
+ return item;
135
+ }
136
+ });
137
+ request.url = param[0] + "?" + newParams.join("&");
138
+ }
139
+ return next(request);
140
+ }
141
+ };
142
+ this.pipeline.addPolicy(apiVersionPolicy);
143
+ }
144
+
145
+ accounts: Accounts;
146
+ account: Account;
147
+ operationOperations: OperationOperations;
148
+ }
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
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 { getContinuationToken } from "./pagingHelper";
11
+ export * from "./models";
12
+ export { GraphServices } from "./graphServices";
13
+ export * from "./operationsInterfaces";
package/src/lroImpl.ts ADDED
@@ -0,0 +1,42 @@
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
+ // Copyright (c) Microsoft Corporation.
10
+ // Licensed under the MIT license.
11
+
12
+ import { AbortSignalLike } from "@azure/abort-controller";
13
+ import { LongRunningOperation, LroResponse } from "@azure/core-lro";
14
+
15
+ export function createLroSpec<T>(inputs: {
16
+ sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
17
+ args: Record<string, unknown>;
18
+ spec: {
19
+ readonly requestBody?: unknown;
20
+ readonly path?: string;
21
+ readonly httpMethod: string;
22
+ } & Record<string, any>;
23
+ }): LongRunningOperation<T> {
24
+ const { args, spec, sendOperationFn } = inputs;
25
+ return {
26
+ requestMethod: spec.httpMethod,
27
+ requestPath: spec.path!,
28
+ sendInitialRequest: () => sendOperationFn(args, spec),
29
+ sendPollRequest: (
30
+ path: string,
31
+ options?: { abortSignal?: AbortSignalLike }
32
+ ) => {
33
+ const { requestBody, ...restSpec } = spec;
34
+ return sendOperationFn(args, {
35
+ ...restSpec,
36
+ httpMethod: "GET",
37
+ path,
38
+ abortSignal: options?.abortSignal
39
+ });
40
+ }
41
+ };
42
+ }