@azure/arm-subscriptions 3.1.2 → 5.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 (199) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/{LICENSE.txt → LICENSE} +2 -2
  3. package/README.md +69 -79
  4. package/dist/index.js +2330 -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 +5 -0
  9. package/dist-esm/src/index.d.ts.map +1 -0
  10. package/dist-esm/src/index.js +12 -0
  11. package/dist-esm/src/index.js.map +1 -0
  12. package/dist-esm/src/lroImpl.d.ts +16 -0
  13. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  14. package/dist-esm/src/lroImpl.js +29 -0
  15. package/dist-esm/src/lroImpl.js.map +1 -0
  16. package/dist-esm/src/models/index.d.ts +658 -0
  17. package/dist-esm/src/models/index.d.ts.map +1 -0
  18. package/dist-esm/src/models/index.js +36 -0
  19. package/dist-esm/src/models/index.js.map +1 -0
  20. package/dist-esm/src/models/mappers.d.ts +36 -0
  21. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  22. package/dist-esm/src/models/mappers.js +1057 -0
  23. package/dist-esm/src/models/mappers.js.map +1 -0
  24. package/dist-esm/src/models/parameters.d.ts +15 -0
  25. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  26. package/dist-esm/src/models/parameters.js +121 -0
  27. package/dist-esm/src/models/parameters.js.map +1 -0
  28. package/dist-esm/src/operations/alias.d.ts +53 -0
  29. package/dist-esm/src/operations/alias.d.ts.map +1 -0
  30. package/dist-esm/src/operations/alias.js +180 -0
  31. package/dist-esm/src/operations/alias.js.map +1 -0
  32. package/dist-esm/src/operations/billingAccount.d.ts +19 -0
  33. package/dist-esm/src/operations/billingAccount.d.ts.map +1 -0
  34. package/dist-esm/src/operations/billingAccount.js +47 -0
  35. package/dist-esm/src/operations/billingAccount.js.map +1 -0
  36. package/{esm → dist-esm/src}/operations/index.d.ts +2 -0
  37. package/dist-esm/src/operations/index.d.ts.map +1 -0
  38. package/{esm → dist-esm/src}/operations/index.js +5 -5
  39. package/dist-esm/src/operations/index.js.map +1 -0
  40. package/dist-esm/src/operations/operations.d.ts +32 -0
  41. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  42. package/dist-esm/src/operations/operations.js +120 -0
  43. package/dist-esm/src/operations/operations.js.map +1 -0
  44. package/dist-esm/src/operations/subscriptionOperations.d.ts +53 -0
  45. package/dist-esm/src/operations/subscriptionOperations.d.ts.map +1 -0
  46. package/dist-esm/src/operations/subscriptionOperations.js +201 -0
  47. package/dist-esm/src/operations/subscriptionOperations.js.map +1 -0
  48. package/dist-esm/src/operations/subscriptionPolicy.d.ts +43 -0
  49. package/dist-esm/src/operations/subscriptionPolicy.d.ts.map +1 -0
  50. package/dist-esm/src/operations/subscriptionPolicy.js +169 -0
  51. package/dist-esm/src/operations/subscriptionPolicy.js.map +1 -0
  52. package/dist-esm/src/operations/subscriptions.d.ts +54 -0
  53. package/dist-esm/src/operations/subscriptions.d.ts.map +1 -0
  54. package/dist-esm/src/operations/subscriptions.js +201 -0
  55. package/dist-esm/src/operations/subscriptions.js.map +1 -0
  56. package/dist-esm/src/operations/tenants.d.ts +32 -0
  57. package/dist-esm/src/operations/tenants.d.ts.map +1 -0
  58. package/dist-esm/src/operations/tenants.js +114 -0
  59. package/dist-esm/src/operations/tenants.js.map +1 -0
  60. package/dist-esm/src/operationsInterfaces/alias.d.ts +45 -0
  61. package/dist-esm/src/operationsInterfaces/alias.d.ts.map +1 -0
  62. package/dist-esm/src/operationsInterfaces/alias.js +9 -0
  63. package/dist-esm/src/operationsInterfaces/alias.js.map +1 -0
  64. package/dist-esm/src/operationsInterfaces/billingAccount.d.ts +11 -0
  65. package/dist-esm/src/operationsInterfaces/billingAccount.d.ts.map +1 -0
  66. package/dist-esm/src/operationsInterfaces/billingAccount.js +9 -0
  67. package/dist-esm/src/operationsInterfaces/billingAccount.js.map +1 -0
  68. package/dist-esm/src/operationsInterfaces/index.d.ts +8 -0
  69. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  70. package/dist-esm/src/operationsInterfaces/index.js +15 -0
  71. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  72. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  73. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  74. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  75. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  76. package/dist-esm/src/operationsInterfaces/subscriptionOperations.d.ts +45 -0
  77. package/dist-esm/src/operationsInterfaces/subscriptionOperations.d.ts.map +1 -0
  78. package/dist-esm/src/operationsInterfaces/subscriptionOperations.js +9 -0
  79. package/dist-esm/src/operationsInterfaces/subscriptionOperations.js.map +1 -0
  80. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.d.ts +22 -0
  81. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.d.ts.map +1 -0
  82. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.js +9 -0
  83. package/dist-esm/src/operationsInterfaces/subscriptionPolicy.js.map +1 -0
  84. package/dist-esm/src/operationsInterfaces/subscriptions.d.ts +24 -0
  85. package/dist-esm/src/operationsInterfaces/subscriptions.d.ts.map +1 -0
  86. package/dist-esm/src/operationsInterfaces/subscriptions.js +9 -0
  87. package/dist-esm/src/operationsInterfaces/subscriptions.js.map +1 -0
  88. package/dist-esm/src/operationsInterfaces/tenants.d.ts +11 -0
  89. package/dist-esm/src/operationsInterfaces/tenants.d.ts.map +1 -0
  90. package/dist-esm/src/operationsInterfaces/tenants.js +9 -0
  91. package/dist-esm/src/operationsInterfaces/tenants.js.map +1 -0
  92. package/dist-esm/src/subscriptionClient.d.ts +21 -0
  93. package/dist-esm/src/subscriptionClient.d.ts.map +1 -0
  94. package/dist-esm/src/subscriptionClient.js +50 -0
  95. package/dist-esm/src/subscriptionClient.js.map +1 -0
  96. package/dist-esm/test/sampleTest.d.ts +2 -0
  97. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  98. package/dist-esm/test/sampleTest.js +40 -0
  99. package/dist-esm/test/sampleTest.js.map +1 -0
  100. package/package.json +65 -32
  101. package/review/arm-subscriptions.api.md +559 -0
  102. package/rollup.config.js +181 -30
  103. package/src/index.ts +12 -0
  104. package/src/lroImpl.ts +34 -0
  105. package/src/models/index.ts +551 -489
  106. package/src/models/mappers.ts +685 -190
  107. package/src/models/parameters.ts +94 -27
  108. package/src/operations/alias.ts +170 -170
  109. package/src/operations/billingAccount.ts +65 -0
  110. package/src/operations/index.ts +5 -5
  111. package/src/operations/operations.ts +103 -40
  112. package/src/operations/subscriptionOperations.ts +216 -120
  113. package/src/operations/subscriptionPolicy.ts +207 -0
  114. package/src/operations/subscriptions.ts +163 -153
  115. package/src/operations/tenants.ts +87 -79
  116. package/src/operationsInterfaces/alias.ts +75 -0
  117. package/src/operationsInterfaces/billingAccount.ts +25 -0
  118. package/src/operationsInterfaces/index.ts +15 -0
  119. package/src/operationsInterfaces/operations.ts +22 -0
  120. package/src/operationsInterfaces/subscriptionOperations.ts +92 -0
  121. package/src/operationsInterfaces/subscriptionPolicy.ts +46 -0
  122. package/src/operationsInterfaces/subscriptions.ts +48 -0
  123. package/src/operationsInterfaces/tenants.ts +22 -0
  124. package/src/subscriptionClient.ts +81 -43
  125. package/tsconfig.json +3 -3
  126. package/types/arm-subscriptions.d.ts +925 -0
  127. package/types/tsdoc-metadata.json +11 -0
  128. package/dist/arm-subscriptions.js +0 -1442
  129. package/dist/arm-subscriptions.js.map +0 -1
  130. package/dist/arm-subscriptions.min.js +0 -1
  131. package/dist/arm-subscriptions.min.js.map +0 -1
  132. package/esm/models/aliasMappers.d.ts +0 -2
  133. package/esm/models/aliasMappers.d.ts.map +0 -1
  134. package/esm/models/aliasMappers.js +0 -9
  135. package/esm/models/aliasMappers.js.map +0 -1
  136. package/esm/models/index.d.ts +0 -624
  137. package/esm/models/index.d.ts.map +0 -1
  138. package/esm/models/index.js +0 -8
  139. package/esm/models/index.js.map +0 -1
  140. package/esm/models/mappers.d.ts +0 -25
  141. package/esm/models/mappers.d.ts.map +0 -1
  142. package/esm/models/mappers.js +0 -574
  143. package/esm/models/mappers.js.map +0 -1
  144. package/esm/models/operationsMappers.d.ts +0 -2
  145. package/esm/models/operationsMappers.d.ts.map +0 -1
  146. package/esm/models/operationsMappers.js +0 -9
  147. package/esm/models/operationsMappers.js.map +0 -1
  148. package/esm/models/parameters.d.ts +0 -8
  149. package/esm/models/parameters.d.ts.map +0 -1
  150. package/esm/models/parameters.js +0 -75
  151. package/esm/models/parameters.js.map +0 -1
  152. package/esm/models/subscriptionOperationsMappers.d.ts +0 -2
  153. package/esm/models/subscriptionOperationsMappers.d.ts.map +0 -1
  154. package/esm/models/subscriptionOperationsMappers.js +0 -9
  155. package/esm/models/subscriptionOperationsMappers.js.map +0 -1
  156. package/esm/models/subscriptionsMappers.d.ts +0 -2
  157. package/esm/models/subscriptionsMappers.d.ts.map +0 -1
  158. package/esm/models/subscriptionsMappers.js +0 -9
  159. package/esm/models/subscriptionsMappers.js.map +0 -1
  160. package/esm/models/tenantsMappers.d.ts +0 -2
  161. package/esm/models/tenantsMappers.d.ts.map +0 -1
  162. package/esm/models/tenantsMappers.js +0 -9
  163. package/esm/models/tenantsMappers.js.map +0 -1
  164. package/esm/operations/alias.d.ts +0 -81
  165. package/esm/operations/alias.d.ts.map +0 -1
  166. package/esm/operations/alias.js +0 -161
  167. package/esm/operations/alias.js.map +0 -1
  168. package/esm/operations/index.d.ts.map +0 -1
  169. package/esm/operations/index.js.map +0 -1
  170. package/esm/operations/operations.d.ts +0 -28
  171. package/esm/operations/operations.d.ts.map +0 -1
  172. package/esm/operations/operations.js +0 -51
  173. package/esm/operations/operations.js.map +0 -1
  174. package/esm/operations/subscriptionOperations.d.ts +0 -70
  175. package/esm/operations/subscriptionOperations.d.ts.map +0 -1
  176. package/esm/operations/subscriptionOperations.js +0 -117
  177. package/esm/operations/subscriptionOperations.js.map +0 -1
  178. package/esm/operations/subscriptions.d.ts +0 -84
  179. package/esm/operations/subscriptions.d.ts.map +0 -1
  180. package/esm/operations/subscriptions.js +0 -133
  181. package/esm/operations/subscriptions.js.map +0 -1
  182. package/esm/operations/tenants.d.ts +0 -46
  183. package/esm/operations/tenants.d.ts.map +0 -1
  184. package/esm/operations/tenants.js +0 -77
  185. package/esm/operations/tenants.js.map +0 -1
  186. package/esm/subscriptionClient.d.ts +0 -27
  187. package/esm/subscriptionClient.d.ts.map +0 -1
  188. package/esm/subscriptionClient.js +0 -41
  189. package/esm/subscriptionClient.js.map +0 -1
  190. package/esm/subscriptionClientContext.d.ts +0 -19
  191. package/esm/subscriptionClientContext.d.ts.map +0 -1
  192. package/esm/subscriptionClientContext.js +0 -55
  193. package/esm/subscriptionClientContext.js.map +0 -1
  194. package/src/models/aliasMappers.ts +0 -18
  195. package/src/models/operationsMappers.ts +0 -14
  196. package/src/models/subscriptionOperationsMappers.ts +0 -15
  197. package/src/models/subscriptionsMappers.ts +0 -16
  198. package/src/models/tenantsMappers.ts +0 -13
  199. package/src/subscriptionClientContext.ts +0 -60
@@ -1,74 +1,137 @@
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 * as Models from "../models";
13
- import * as Mappers from "../models/operationsMappers";
9
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { Operations } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
14
13
  import * as Parameters from "../models/parameters";
15
- import { SubscriptionClientContext } from "../subscriptionClientContext";
14
+ import { SubscriptionClient } from "../subscriptionClient";
15
+ import {
16
+ Operation,
17
+ OperationsListNextOptionalParams,
18
+ OperationsListOptionalParams,
19
+ OperationsListResponse,
20
+ OperationsListNextResponse
21
+ } from "../models";
16
22
 
17
- /** Class representing a Operations. */
18
- export class Operations {
19
- private readonly client: SubscriptionClientContext;
23
+ /// <reference lib="esnext.asynciterable" />
24
+ /** Class containing Operations operations. */
25
+ export class OperationsImpl implements Operations {
26
+ private readonly client: SubscriptionClient;
20
27
 
21
28
  /**
22
- * Create a Operations.
23
- * @param {SubscriptionClientContext} client Reference to the service client.
29
+ * Initialize a new instance of the class Operations class.
30
+ * @param client Reference to the service client
24
31
  */
25
- constructor(client: SubscriptionClientContext) {
32
+ constructor(client: SubscriptionClient) {
26
33
  this.client = client;
27
34
  }
28
35
 
29
36
  /**
30
37
  * Lists all of the available Microsoft.Subscription API operations.
31
- * @param [options] The optional parameters
32
- * @returns Promise<Models.OperationsListResponse>
38
+ * @param options The options parameters.
33
39
  */
34
- list(options?: msRest.RequestOptionsBase): Promise<Models.OperationsListResponse>;
40
+ public list(
41
+ options?: OperationsListOptionalParams
42
+ ): PagedAsyncIterableIterator<Operation> {
43
+ const iter = this.listPagingAll(options);
44
+ return {
45
+ next() {
46
+ return iter.next();
47
+ },
48
+ [Symbol.asyncIterator]() {
49
+ return this;
50
+ },
51
+ byPage: () => {
52
+ return this.listPagingPage(options);
53
+ }
54
+ };
55
+ }
56
+
57
+ private async *listPagingPage(
58
+ options?: OperationsListOptionalParams
59
+ ): AsyncIterableIterator<Operation[]> {
60
+ let result = await this._list(options);
61
+ yield result.value || [];
62
+ let continuationToken = result.nextLink;
63
+ while (continuationToken) {
64
+ result = await this._listNext(continuationToken, options);
65
+ continuationToken = result.nextLink;
66
+ yield result.value || [];
67
+ }
68
+ }
69
+
70
+ private async *listPagingAll(
71
+ options?: OperationsListOptionalParams
72
+ ): AsyncIterableIterator<Operation> {
73
+ for await (const page of this.listPagingPage(options)) {
74
+ yield* page;
75
+ }
76
+ }
77
+
35
78
  /**
36
- * @param callback The callback
79
+ * Lists all of the available Microsoft.Subscription API operations.
80
+ * @param options The options parameters.
37
81
  */
38
- list(callback: msRest.ServiceCallback<Models.OperationListResult>): void;
82
+ private _list(
83
+ options?: OperationsListOptionalParams
84
+ ): Promise<OperationsListResponse> {
85
+ return this.client.sendOperationRequest({ options }, listOperationSpec);
86
+ }
87
+
39
88
  /**
40
- * @param options The optional parameters
41
- * @param callback The callback
89
+ * ListNext
90
+ * @param nextLink The nextLink from the previous successful call to the List method.
91
+ * @param options The options parameters.
42
92
  */
43
- list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.OperationListResult>): void;
44
- list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.OperationListResult>, callback?: msRest.ServiceCallback<Models.OperationListResult>): Promise<Models.OperationsListResponse> {
93
+ private _listNext(
94
+ nextLink: string,
95
+ options?: OperationsListNextOptionalParams
96
+ ): Promise<OperationsListNextResponse> {
45
97
  return this.client.sendOperationRequest(
46
- {
47
- options
48
- },
49
- listOperationSpec,
50
- callback) as Promise<Models.OperationsListResponse>;
98
+ { nextLink, options },
99
+ listNextOperationSpec
100
+ );
51
101
  }
52
102
  }
53
-
54
103
  // Operation Specifications
55
- const serializer = new msRest.Serializer(Mappers);
56
- const listOperationSpec: msRest.OperationSpec = {
104
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
105
+
106
+ const listOperationSpec: coreClient.OperationSpec = {
107
+ path: "/providers/Microsoft.Subscription/operations",
108
+ httpMethod: "GET",
109
+ responses: {
110
+ 200: {
111
+ bodyMapper: Mappers.OperationListResult
112
+ },
113
+ default: {
114
+ bodyMapper: Mappers.ErrorResponseBody
115
+ }
116
+ },
117
+ queryParameters: [Parameters.apiVersion1],
118
+ urlParameters: [Parameters.$host],
119
+ headerParameters: [Parameters.accept],
120
+ serializer
121
+ };
122
+ const listNextOperationSpec: coreClient.OperationSpec = {
123
+ path: "{nextLink}",
57
124
  httpMethod: "GET",
58
- path: "providers/Microsoft.Subscription/operations",
59
- queryParameters: [
60
- Parameters.apiVersion1
61
- ],
62
- headerParameters: [
63
- Parameters.acceptLanguage
64
- ],
65
125
  responses: {
66
126
  200: {
67
127
  bodyMapper: Mappers.OperationListResult
68
128
  },
69
129
  default: {
70
- bodyMapper: Mappers.ErrorResponse
130
+ bodyMapper: Mappers.ErrorResponseBody
71
131
  }
72
132
  },
133
+ queryParameters: [Parameters.apiVersion1],
134
+ urlParameters: [Parameters.$host, Parameters.nextLink],
135
+ headerParameters: [Parameters.accept],
73
136
  serializer
74
137
  };
@@ -1,194 +1,290 @@
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 * as Models from "../models";
13
- import * as Mappers from "../models/subscriptionOperationsMappers";
9
+ import { SubscriptionOperations } from "../operationsInterfaces";
10
+ import * as coreClient from "@azure/core-client";
11
+ import * as Mappers from "../models/mappers";
14
12
  import * as Parameters from "../models/parameters";
15
- import { SubscriptionClientContext } from "../subscriptionClientContext";
13
+ import { SubscriptionClient } from "../subscriptionClient";
14
+ import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
15
+ import { LroImpl } from "../lroImpl";
16
+ import {
17
+ SubscriptionCancelOptionalParams,
18
+ SubscriptionCancelResponse,
19
+ SubscriptionName,
20
+ SubscriptionRenameOptionalParams,
21
+ SubscriptionRenameResponse,
22
+ SubscriptionEnableOptionalParams,
23
+ SubscriptionEnableResponse,
24
+ AcceptOwnershipRequest,
25
+ SubscriptionAcceptOwnershipOptionalParams,
26
+ SubscriptionAcceptOwnershipResponse,
27
+ SubscriptionAcceptOwnershipStatusOptionalParams,
28
+ SubscriptionAcceptOwnershipStatusResponse
29
+ } from "../models";
16
30
 
17
- /** Class representing a SubscriptionOperations. */
18
- export class SubscriptionOperations {
19
- private readonly client: SubscriptionClientContext;
31
+ /** Class containing SubscriptionOperations operations. */
32
+ export class SubscriptionOperationsImpl implements SubscriptionOperations {
33
+ private readonly client: SubscriptionClient;
20
34
 
21
35
  /**
22
- * Create a SubscriptionOperations.
23
- * @param {SubscriptionClientContext} client Reference to the service client.
36
+ * Initialize a new instance of the class SubscriptionOperations class.
37
+ * @param client Reference to the service client
24
38
  */
25
- constructor(client: SubscriptionClientContext) {
39
+ constructor(client: SubscriptionClient) {
26
40
  this.client = client;
27
41
  }
28
42
 
29
43
  /**
30
44
  * The operation to cancel a subscription
31
45
  * @param subscriptionId Subscription Id.
32
- * @param [options] The optional parameters
33
- * @returns Promise<Models.SubscriptionCancelResponse>
46
+ * @param options The options parameters.
34
47
  */
35
- cancel(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise<Models.SubscriptionCancelResponse>;
36
- /**
37
- * @param subscriptionId Subscription Id.
38
- * @param callback The callback
39
- */
40
- cancel(subscriptionId: string, callback: msRest.ServiceCallback<Models.CanceledSubscriptionId>): void;
41
- /**
42
- * @param subscriptionId Subscription Id.
43
- * @param options The optional parameters
44
- * @param callback The callback
45
- */
46
- cancel(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.CanceledSubscriptionId>): void;
47
- cancel(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.CanceledSubscriptionId>, callback?: msRest.ServiceCallback<Models.CanceledSubscriptionId>): Promise<Models.SubscriptionCancelResponse> {
48
+ cancel(
49
+ subscriptionId: string,
50
+ options?: SubscriptionCancelOptionalParams
51
+ ): Promise<SubscriptionCancelResponse> {
48
52
  return this.client.sendOperationRequest(
49
- {
50
- subscriptionId,
51
- options
52
- },
53
- cancelOperationSpec,
54
- callback) as Promise<Models.SubscriptionCancelResponse>;
53
+ { subscriptionId, options },
54
+ cancelOperationSpec
55
+ );
55
56
  }
56
57
 
57
58
  /**
58
59
  * The operation to rename a subscription
59
60
  * @param subscriptionId Subscription Id.
60
61
  * @param body Subscription Name
61
- * @param [options] The optional parameters
62
- * @returns Promise<Models.SubscriptionRenameResponse>
62
+ * @param options The options parameters.
63
63
  */
64
- rename(subscriptionId: string, body: Models.SubscriptionName, options?: msRest.RequestOptionsBase): Promise<Models.SubscriptionRenameResponse>;
65
- /**
66
- * @param subscriptionId Subscription Id.
67
- * @param body Subscription Name
68
- * @param callback The callback
69
- */
70
- rename(subscriptionId: string, body: Models.SubscriptionName, callback: msRest.ServiceCallback<Models.RenamedSubscriptionId>): void;
64
+ rename(
65
+ subscriptionId: string,
66
+ body: SubscriptionName,
67
+ options?: SubscriptionRenameOptionalParams
68
+ ): Promise<SubscriptionRenameResponse> {
69
+ return this.client.sendOperationRequest(
70
+ { subscriptionId, body, options },
71
+ renameOperationSpec
72
+ );
73
+ }
74
+
71
75
  /**
76
+ * The operation to enable a subscription
72
77
  * @param subscriptionId Subscription Id.
73
- * @param body Subscription Name
74
- * @param options The optional parameters
75
- * @param callback The callback
78
+ * @param options The options parameters.
76
79
  */
77
- rename(subscriptionId: string, body: Models.SubscriptionName, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.RenamedSubscriptionId>): void;
78
- rename(subscriptionId: string, body: Models.SubscriptionName, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.RenamedSubscriptionId>, callback?: msRest.ServiceCallback<Models.RenamedSubscriptionId>): Promise<Models.SubscriptionRenameResponse> {
80
+ enable(
81
+ subscriptionId: string,
82
+ options?: SubscriptionEnableOptionalParams
83
+ ): Promise<SubscriptionEnableResponse> {
79
84
  return this.client.sendOperationRequest(
80
- {
81
- subscriptionId,
82
- body,
83
- options
84
- },
85
- renameOperationSpec,
86
- callback) as Promise<Models.SubscriptionRenameResponse>;
85
+ { subscriptionId, options },
86
+ enableOperationSpec
87
+ );
87
88
  }
88
89
 
89
90
  /**
90
- * The operation to enable a subscription
91
+ * Accept subscription ownership.
91
92
  * @param subscriptionId Subscription Id.
92
- * @param [options] The optional parameters
93
- * @returns Promise<Models.SubscriptionEnableResponse>
93
+ * @param body The parameters required to accept subscription ownership.
94
+ * @param options The options parameters.
94
95
  */
95
- enable(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise<Models.SubscriptionEnableResponse>;
96
+ async beginAcceptOwnership(
97
+ subscriptionId: string,
98
+ body: AcceptOwnershipRequest,
99
+ options?: SubscriptionAcceptOwnershipOptionalParams
100
+ ): Promise<
101
+ PollerLike<
102
+ PollOperationState<SubscriptionAcceptOwnershipResponse>,
103
+ SubscriptionAcceptOwnershipResponse
104
+ >
105
+ > {
106
+ const directSendOperation = async (
107
+ args: coreClient.OperationArguments,
108
+ spec: coreClient.OperationSpec
109
+ ): Promise<SubscriptionAcceptOwnershipResponse> => {
110
+ return this.client.sendOperationRequest(args, spec);
111
+ };
112
+ const sendOperation = async (
113
+ args: coreClient.OperationArguments,
114
+ spec: coreClient.OperationSpec
115
+ ) => {
116
+ let currentRawResponse:
117
+ | coreClient.FullOperationResponse
118
+ | undefined = undefined;
119
+ const providedCallback = args.options?.onResponse;
120
+ const callback: coreClient.RawResponseCallback = (
121
+ rawResponse: coreClient.FullOperationResponse,
122
+ flatResponse: unknown
123
+ ) => {
124
+ currentRawResponse = rawResponse;
125
+ providedCallback?.(rawResponse, flatResponse);
126
+ };
127
+ const updatedArgs = {
128
+ ...args,
129
+ options: {
130
+ ...args.options,
131
+ onResponse: callback
132
+ }
133
+ };
134
+ const flatResponse = await directSendOperation(updatedArgs, spec);
135
+ return {
136
+ flatResponse,
137
+ rawResponse: {
138
+ statusCode: currentRawResponse!.status,
139
+ body: currentRawResponse!.parsedBody,
140
+ headers: currentRawResponse!.headers.toJSON()
141
+ }
142
+ };
143
+ };
144
+
145
+ const lro = new LroImpl(
146
+ sendOperation,
147
+ { subscriptionId, body, options },
148
+ acceptOwnershipOperationSpec
149
+ );
150
+ return new LroEngine(lro, {
151
+ resumeFrom: options?.resumeFrom,
152
+ intervalInMs: options?.updateIntervalInMs
153
+ });
154
+ }
155
+
96
156
  /**
157
+ * Accept subscription ownership.
97
158
  * @param subscriptionId Subscription Id.
98
- * @param callback The callback
159
+ * @param body The parameters required to accept subscription ownership.
160
+ * @param options The options parameters.
99
161
  */
100
- enable(subscriptionId: string, callback: msRest.ServiceCallback<Models.EnabledSubscriptionId>): void;
162
+ async beginAcceptOwnershipAndWait(
163
+ subscriptionId: string,
164
+ body: AcceptOwnershipRequest,
165
+ options?: SubscriptionAcceptOwnershipOptionalParams
166
+ ): Promise<SubscriptionAcceptOwnershipResponse> {
167
+ const poller = await this.beginAcceptOwnership(
168
+ subscriptionId,
169
+ body,
170
+ options
171
+ );
172
+ return poller.pollUntilDone();
173
+ }
174
+
101
175
  /**
176
+ * Accept subscription ownership status.
102
177
  * @param subscriptionId Subscription Id.
103
- * @param options The optional parameters
104
- * @param callback The callback
178
+ * @param options The options parameters.
105
179
  */
106
- enable(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.EnabledSubscriptionId>): void;
107
- enable(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.EnabledSubscriptionId>, callback?: msRest.ServiceCallback<Models.EnabledSubscriptionId>): Promise<Models.SubscriptionEnableResponse> {
180
+ acceptOwnershipStatus(
181
+ subscriptionId: string,
182
+ options?: SubscriptionAcceptOwnershipStatusOptionalParams
183
+ ): Promise<SubscriptionAcceptOwnershipStatusResponse> {
108
184
  return this.client.sendOperationRequest(
109
- {
110
- subscriptionId,
111
- options
112
- },
113
- enableOperationSpec,
114
- callback) as Promise<Models.SubscriptionEnableResponse>;
185
+ { subscriptionId, options },
186
+ acceptOwnershipStatusOperationSpec
187
+ );
115
188
  }
116
189
  }
117
-
118
190
  // Operation Specifications
119
- const serializer = new msRest.Serializer(Mappers);
120
- const cancelOperationSpec: msRest.OperationSpec = {
191
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
192
+
193
+ const cancelOperationSpec: coreClient.OperationSpec = {
194
+ path:
195
+ "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel",
121
196
  httpMethod: "POST",
122
- path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel",
123
- urlParameters: [
124
- Parameters.subscriptionId
125
- ],
126
- queryParameters: [
127
- Parameters.apiVersion1
128
- ],
129
- headerParameters: [
130
- Parameters.acceptLanguage
131
- ],
132
197
  responses: {
133
198
  200: {
134
199
  bodyMapper: Mappers.CanceledSubscriptionId
135
200
  },
136
201
  default: {
137
- bodyMapper: Mappers.ErrorResponse
202
+ bodyMapper: Mappers.ErrorResponseBody
138
203
  }
139
204
  },
205
+ queryParameters: [Parameters.apiVersion1],
206
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
207
+ headerParameters: [Parameters.accept],
140
208
  serializer
141
209
  };
142
-
143
- const renameOperationSpec: msRest.OperationSpec = {
210
+ const renameOperationSpec: coreClient.OperationSpec = {
211
+ path:
212
+ "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename",
144
213
  httpMethod: "POST",
145
- path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename",
146
- urlParameters: [
147
- Parameters.subscriptionId
148
- ],
149
- queryParameters: [
150
- Parameters.apiVersion1
151
- ],
152
- headerParameters: [
153
- Parameters.acceptLanguage
154
- ],
155
- requestBody: {
156
- parameterPath: "body",
157
- mapper: {
158
- ...Mappers.SubscriptionName,
159
- required: true
160
- }
161
- },
162
214
  responses: {
163
215
  200: {
164
216
  bodyMapper: Mappers.RenamedSubscriptionId
165
217
  },
166
218
  default: {
167
- bodyMapper: Mappers.ErrorResponse
219
+ bodyMapper: Mappers.ErrorResponseBody
168
220
  }
169
221
  },
222
+ requestBody: Parameters.body,
223
+ queryParameters: [Parameters.apiVersion1],
224
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
225
+ headerParameters: [Parameters.accept, Parameters.contentType],
226
+ mediaType: "json",
170
227
  serializer
171
228
  };
172
-
173
- const enableOperationSpec: msRest.OperationSpec = {
229
+ const enableOperationSpec: coreClient.OperationSpec = {
230
+ path:
231
+ "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable",
174
232
  httpMethod: "POST",
175
- path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable",
176
- urlParameters: [
177
- Parameters.subscriptionId
178
- ],
179
- queryParameters: [
180
- Parameters.apiVersion1
181
- ],
182
- headerParameters: [
183
- Parameters.acceptLanguage
184
- ],
185
233
  responses: {
186
234
  200: {
187
235
  bodyMapper: Mappers.EnabledSubscriptionId
188
236
  },
189
237
  default: {
190
- bodyMapper: Mappers.ErrorResponse
238
+ bodyMapper: Mappers.ErrorResponseBody
239
+ }
240
+ },
241
+ queryParameters: [Parameters.apiVersion1],
242
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
243
+ headerParameters: [Parameters.accept],
244
+ serializer
245
+ };
246
+ const acceptOwnershipOperationSpec: coreClient.OperationSpec = {
247
+ path:
248
+ "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership",
249
+ httpMethod: "POST",
250
+ responses: {
251
+ 200: {
252
+ headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
253
+ },
254
+ 201: {
255
+ headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
256
+ },
257
+ 202: {
258
+ headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
259
+ },
260
+ 204: {
261
+ headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
262
+ },
263
+ default: {
264
+ bodyMapper: Mappers.ErrorResponseBody
265
+ }
266
+ },
267
+ requestBody: Parameters.body1,
268
+ queryParameters: [Parameters.apiVersion1],
269
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
270
+ headerParameters: [Parameters.accept, Parameters.contentType],
271
+ mediaType: "json",
272
+ serializer
273
+ };
274
+ const acceptOwnershipStatusOperationSpec: coreClient.OperationSpec = {
275
+ path:
276
+ "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus",
277
+ httpMethod: "GET",
278
+ responses: {
279
+ 200: {
280
+ bodyMapper: Mappers.AcceptOwnershipStatusResponse
281
+ },
282
+ default: {
283
+ bodyMapper: Mappers.ErrorResponseBody
191
284
  }
192
285
  },
286
+ queryParameters: [Parameters.apiVersion1],
287
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
288
+ headerParameters: [Parameters.accept],
193
289
  serializer
194
290
  };