@azure/arm-subscriptions 3.1.2 → 4.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.
- package/CHANGELOG.md +11 -0
- package/{LICENSE.txt → LICENSE} +2 -2
- package/README.md +68 -79
- package/dist/index.js +1772 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/dist-esm/src/index.d.ts +5 -0
- package/dist-esm/src/index.d.ts.map +1 -0
- package/dist-esm/src/index.js +12 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/lroImpl.d.ts +16 -0
- package/dist-esm/src/lroImpl.d.ts.map +1 -0
- package/dist-esm/src/lroImpl.js +29 -0
- package/dist-esm/src/lroImpl.js.map +1 -0
- package/dist-esm/src/models/index.d.ts +514 -0
- package/dist-esm/src/models/index.d.ts.map +1 -0
- package/dist-esm/src/models/index.js +36 -0
- package/dist-esm/src/models/index.js.map +1 -0
- package/dist-esm/src/models/mappers.d.ts +29 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -0
- package/dist-esm/src/models/mappers.js +825 -0
- package/dist-esm/src/models/mappers.js.map +1 -0
- package/dist-esm/src/models/parameters.d.ts +14 -0
- package/dist-esm/src/models/parameters.d.ts.map +1 -0
- package/dist-esm/src/models/parameters.js +110 -0
- package/dist-esm/src/models/parameters.js.map +1 -0
- package/dist-esm/src/operations/alias.d.ts +53 -0
- package/dist-esm/src/operations/alias.d.ts.map +1 -0
- package/dist-esm/src/operations/alias.js +180 -0
- package/dist-esm/src/operations/alias.js.map +1 -0
- package/dist-esm/src/operations/billingAccount.d.ts +19 -0
- package/dist-esm/src/operations/billingAccount.d.ts.map +1 -0
- package/dist-esm/src/operations/billingAccount.js +47 -0
- package/dist-esm/src/operations/billingAccount.js.map +1 -0
- package/dist-esm/src/operations/index.d.ts +6 -0
- package/dist-esm/src/operations/index.d.ts.map +1 -0
- package/dist-esm/src/operations/index.js +13 -0
- package/dist-esm/src/operations/index.js.map +1 -0
- package/dist-esm/src/operations/operations.d.ts +32 -0
- package/dist-esm/src/operations/operations.d.ts.map +1 -0
- package/dist-esm/src/operations/operations.js +120 -0
- package/dist-esm/src/operations/operations.js.map +1 -0
- package/dist-esm/src/operations/subscription.d.ts +53 -0
- package/dist-esm/src/operations/subscription.d.ts.map +1 -0
- package/dist-esm/src/operations/subscription.js +201 -0
- package/dist-esm/src/operations/subscription.js.map +1 -0
- package/dist-esm/src/operations/subscriptionPolicy.d.ts +43 -0
- package/dist-esm/src/operations/subscriptionPolicy.d.ts.map +1 -0
- package/dist-esm/src/operations/subscriptionPolicy.js +169 -0
- package/dist-esm/src/operations/subscriptionPolicy.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/alias.d.ts +45 -0
- package/dist-esm/src/operationsInterfaces/alias.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/alias.js +9 -0
- package/dist-esm/src/operationsInterfaces/alias.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/billingAccount.d.ts +11 -0
- package/dist-esm/src/operationsInterfaces/billingAccount.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/billingAccount.js +9 -0
- package/dist-esm/src/operationsInterfaces/billingAccount.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts +6 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.js +13 -0
- package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
- package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/operations.js +9 -0
- package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/subscription.d.ts +45 -0
- package/dist-esm/src/operationsInterfaces/subscription.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/subscription.js +9 -0
- package/dist-esm/src/operationsInterfaces/subscription.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/subscriptionPolicy.d.ts +22 -0
- package/dist-esm/src/operationsInterfaces/subscriptionPolicy.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/subscriptionPolicy.js +9 -0
- package/dist-esm/src/operationsInterfaces/subscriptionPolicy.js.map +1 -0
- package/dist-esm/src/subscriptionClient.d.ts +20 -0
- package/dist-esm/src/subscriptionClient.d.ts.map +1 -0
- package/dist-esm/src/subscriptionClient.js +49 -0
- package/dist-esm/src/subscriptionClient.js.map +1 -0
- package/dist-esm/test/sampleTest.d.ts +2 -0
- package/dist-esm/test/sampleTest.d.ts.map +1 -0
- package/dist-esm/test/sampleTest.js +40 -0
- package/dist-esm/test/sampleTest.js.map +1 -0
- package/package.json +65 -32
- package/review/arm-subscriptions.api.md +446 -0
- package/rollup.config.js +181 -30
- package/src/index.ts +12 -0
- package/src/lroImpl.ts +34 -0
- package/src/models/index.ts +449 -555
- package/src/models/mappers.ts +506 -250
- package/src/models/parameters.ts +82 -27
- package/src/operations/alias.ts +170 -170
- package/src/operations/billingAccount.ts +65 -0
- package/src/operations/index.ts +6 -8
- package/src/operations/operations.ts +103 -40
- package/src/operations/subscription.ts +289 -0
- package/src/operations/subscriptionPolicy.ts +207 -0
- package/src/operationsInterfaces/alias.ts +75 -0
- package/src/operationsInterfaces/billingAccount.ts +25 -0
- package/src/operationsInterfaces/index.ts +13 -0
- package/src/operationsInterfaces/operations.ts +22 -0
- package/src/operationsInterfaces/subscription.ts +92 -0
- package/src/operationsInterfaces/subscriptionPolicy.ts +46 -0
- package/src/subscriptionClient.ts +75 -43
- package/tsconfig.json +3 -3
- package/types/arm-subscriptions.d.ts +727 -0
- package/types/tsdoc-metadata.json +11 -0
- package/dist/arm-subscriptions.js +0 -1442
- package/dist/arm-subscriptions.js.map +0 -1
- package/dist/arm-subscriptions.min.js +0 -1
- package/dist/arm-subscriptions.min.js.map +0 -1
- package/esm/models/aliasMappers.d.ts +0 -2
- package/esm/models/aliasMappers.d.ts.map +0 -1
- package/esm/models/aliasMappers.js +0 -9
- package/esm/models/aliasMappers.js.map +0 -1
- package/esm/models/index.d.ts +0 -624
- package/esm/models/index.d.ts.map +0 -1
- package/esm/models/index.js +0 -8
- package/esm/models/index.js.map +0 -1
- package/esm/models/mappers.d.ts +0 -25
- package/esm/models/mappers.d.ts.map +0 -1
- package/esm/models/mappers.js +0 -574
- package/esm/models/mappers.js.map +0 -1
- package/esm/models/operationsMappers.d.ts +0 -2
- package/esm/models/operationsMappers.d.ts.map +0 -1
- package/esm/models/operationsMappers.js +0 -9
- package/esm/models/operationsMappers.js.map +0 -1
- package/esm/models/parameters.d.ts +0 -8
- package/esm/models/parameters.d.ts.map +0 -1
- package/esm/models/parameters.js +0 -75
- package/esm/models/parameters.js.map +0 -1
- package/esm/models/subscriptionOperationsMappers.d.ts +0 -2
- package/esm/models/subscriptionOperationsMappers.d.ts.map +0 -1
- package/esm/models/subscriptionOperationsMappers.js +0 -9
- package/esm/models/subscriptionOperationsMappers.js.map +0 -1
- package/esm/models/subscriptionsMappers.d.ts +0 -2
- package/esm/models/subscriptionsMappers.d.ts.map +0 -1
- package/esm/models/subscriptionsMappers.js +0 -9
- package/esm/models/subscriptionsMappers.js.map +0 -1
- package/esm/models/tenantsMappers.d.ts +0 -2
- package/esm/models/tenantsMappers.d.ts.map +0 -1
- package/esm/models/tenantsMappers.js +0 -9
- package/esm/models/tenantsMappers.js.map +0 -1
- package/esm/operations/alias.d.ts +0 -81
- package/esm/operations/alias.d.ts.map +0 -1
- package/esm/operations/alias.js +0 -161
- package/esm/operations/alias.js.map +0 -1
- package/esm/operations/index.d.ts +0 -6
- package/esm/operations/index.d.ts.map +0 -1
- package/esm/operations/index.js +0 -15
- package/esm/operations/index.js.map +0 -1
- package/esm/operations/operations.d.ts +0 -28
- package/esm/operations/operations.d.ts.map +0 -1
- package/esm/operations/operations.js +0 -51
- package/esm/operations/operations.js.map +0 -1
- package/esm/operations/subscriptionOperations.d.ts +0 -70
- package/esm/operations/subscriptionOperations.d.ts.map +0 -1
- package/esm/operations/subscriptionOperations.js +0 -117
- package/esm/operations/subscriptionOperations.js.map +0 -1
- package/esm/operations/subscriptions.d.ts +0 -84
- package/esm/operations/subscriptions.d.ts.map +0 -1
- package/esm/operations/subscriptions.js +0 -133
- package/esm/operations/subscriptions.js.map +0 -1
- package/esm/operations/tenants.d.ts +0 -46
- package/esm/operations/tenants.d.ts.map +0 -1
- package/esm/operations/tenants.js +0 -77
- package/esm/operations/tenants.js.map +0 -1
- package/esm/subscriptionClient.d.ts +0 -27
- package/esm/subscriptionClient.d.ts.map +0 -1
- package/esm/subscriptionClient.js +0 -41
- package/esm/subscriptionClient.js.map +0 -1
- package/esm/subscriptionClientContext.d.ts +0 -19
- package/esm/subscriptionClientContext.d.ts.map +0 -1
- package/esm/subscriptionClientContext.js +0 -55
- package/esm/subscriptionClientContext.js.map +0 -1
- package/src/models/aliasMappers.ts +0 -18
- package/src/models/operationsMappers.ts +0 -14
- package/src/models/subscriptionOperationsMappers.ts +0 -15
- package/src/models/subscriptionsMappers.ts +0 -16
- package/src/models/tenantsMappers.ts +0 -13
- package/src/operations/subscriptionOperations.ts +0 -194
- package/src/operations/subscriptions.ts +0 -227
- package/src/operations/tenants.ts +0 -123
- package/src/subscriptionClientContext.ts +0 -60
|
@@ -1,74 +1,137 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
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
|
|
12
|
-
import
|
|
13
|
-
import * as
|
|
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 {
|
|
14
|
+
import { SubscriptionClient } from "../subscriptionClient";
|
|
15
|
+
import {
|
|
16
|
+
Operation,
|
|
17
|
+
OperationsListNextOptionalParams,
|
|
18
|
+
OperationsListOptionalParams,
|
|
19
|
+
OperationsListResponse,
|
|
20
|
+
OperationsListNextResponse
|
|
21
|
+
} from "../models";
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
*
|
|
23
|
-
* @param
|
|
29
|
+
* Initialize a new instance of the class Operations class.
|
|
30
|
+
* @param client Reference to the service client
|
|
24
31
|
*/
|
|
25
|
-
constructor(client:
|
|
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
|
|
32
|
-
* @returns Promise<Models.OperationsListResponse>
|
|
38
|
+
* @param options The options parameters.
|
|
33
39
|
*/
|
|
34
|
-
list(
|
|
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
|
-
*
|
|
79
|
+
* Lists all of the available Microsoft.Subscription API operations.
|
|
80
|
+
* @param options The options parameters.
|
|
37
81
|
*/
|
|
38
|
-
|
|
82
|
+
private _list(
|
|
83
|
+
options?: OperationsListOptionalParams
|
|
84
|
+
): Promise<OperationsListResponse> {
|
|
85
|
+
return this.client.sendOperationRequest({ options }, listOperationSpec);
|
|
86
|
+
}
|
|
87
|
+
|
|
39
88
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @param
|
|
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
|
-
|
|
44
|
-
|
|
93
|
+
private _listNext(
|
|
94
|
+
nextLink: string,
|
|
95
|
+
options?: OperationsListNextOptionalParams
|
|
96
|
+
): Promise<OperationsListNextResponse> {
|
|
45
97
|
return this.client.sendOperationRequest(
|
|
46
|
-
{
|
|
47
|
-
|
|
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 =
|
|
56
|
-
|
|
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.apiVersion],
|
|
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.
|
|
130
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
71
131
|
}
|
|
72
132
|
},
|
|
133
|
+
queryParameters: [Parameters.apiVersion],
|
|
134
|
+
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
135
|
+
headerParameters: [Parameters.accept],
|
|
73
136
|
serializer
|
|
74
137
|
};
|
|
@@ -0,0 +1,289 @@
|
|
|
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 { Subscription } from "../operationsInterfaces";
|
|
10
|
+
import * as coreClient from "@azure/core-client";
|
|
11
|
+
import * as Mappers from "../models/mappers";
|
|
12
|
+
import * as Parameters from "../models/parameters";
|
|
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";
|
|
30
|
+
|
|
31
|
+
/** Class containing Subscription operations. */
|
|
32
|
+
export class SubscriptionImpl implements Subscription {
|
|
33
|
+
private readonly client: SubscriptionClient;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Initialize a new instance of the class Subscription class.
|
|
37
|
+
* @param client Reference to the service client
|
|
38
|
+
*/
|
|
39
|
+
constructor(client: SubscriptionClient) {
|
|
40
|
+
this.client = client;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The operation to cancel a subscription
|
|
45
|
+
* @param subscriptionId Subscription Id.
|
|
46
|
+
* @param options The options parameters.
|
|
47
|
+
*/
|
|
48
|
+
cancel(
|
|
49
|
+
subscriptionId: string,
|
|
50
|
+
options?: SubscriptionCancelOptionalParams
|
|
51
|
+
): Promise<SubscriptionCancelResponse> {
|
|
52
|
+
return this.client.sendOperationRequest(
|
|
53
|
+
{ subscriptionId, options },
|
|
54
|
+
cancelOperationSpec
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The operation to rename a subscription
|
|
60
|
+
* @param subscriptionId Subscription Id.
|
|
61
|
+
* @param body Subscription Name
|
|
62
|
+
* @param options The options parameters.
|
|
63
|
+
*/
|
|
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
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The operation to enable a subscription
|
|
77
|
+
* @param subscriptionId Subscription Id.
|
|
78
|
+
* @param options The options parameters.
|
|
79
|
+
*/
|
|
80
|
+
enable(
|
|
81
|
+
subscriptionId: string,
|
|
82
|
+
options?: SubscriptionEnableOptionalParams
|
|
83
|
+
): Promise<SubscriptionEnableResponse> {
|
|
84
|
+
return this.client.sendOperationRequest(
|
|
85
|
+
{ subscriptionId, options },
|
|
86
|
+
enableOperationSpec
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Accept subscription ownership.
|
|
92
|
+
* @param subscriptionId Subscription Id.
|
|
93
|
+
* @param body The parameters required to accept subscription ownership.
|
|
94
|
+
* @param options The options parameters.
|
|
95
|
+
*/
|
|
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
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Accept subscription ownership.
|
|
158
|
+
* @param subscriptionId Subscription Id.
|
|
159
|
+
* @param body The parameters required to accept subscription ownership.
|
|
160
|
+
* @param options The options parameters.
|
|
161
|
+
*/
|
|
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
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Accept subscription ownership status.
|
|
177
|
+
* @param subscriptionId Subscription Id.
|
|
178
|
+
* @param options The options parameters.
|
|
179
|
+
*/
|
|
180
|
+
acceptOwnershipStatus(
|
|
181
|
+
subscriptionId: string,
|
|
182
|
+
options?: SubscriptionAcceptOwnershipStatusOptionalParams
|
|
183
|
+
): Promise<SubscriptionAcceptOwnershipStatusResponse> {
|
|
184
|
+
return this.client.sendOperationRequest(
|
|
185
|
+
{ subscriptionId, options },
|
|
186
|
+
acceptOwnershipStatusOperationSpec
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// Operation Specifications
|
|
191
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
192
|
+
|
|
193
|
+
const cancelOperationSpec: coreClient.OperationSpec = {
|
|
194
|
+
path:
|
|
195
|
+
"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel",
|
|
196
|
+
httpMethod: "POST",
|
|
197
|
+
responses: {
|
|
198
|
+
200: {
|
|
199
|
+
bodyMapper: Mappers.CanceledSubscriptionId
|
|
200
|
+
},
|
|
201
|
+
default: {
|
|
202
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
queryParameters: [Parameters.apiVersion],
|
|
206
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
207
|
+
headerParameters: [Parameters.accept],
|
|
208
|
+
serializer
|
|
209
|
+
};
|
|
210
|
+
const renameOperationSpec: coreClient.OperationSpec = {
|
|
211
|
+
path:
|
|
212
|
+
"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename",
|
|
213
|
+
httpMethod: "POST",
|
|
214
|
+
responses: {
|
|
215
|
+
200: {
|
|
216
|
+
bodyMapper: Mappers.RenamedSubscriptionId
|
|
217
|
+
},
|
|
218
|
+
default: {
|
|
219
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
requestBody: Parameters.body,
|
|
223
|
+
queryParameters: [Parameters.apiVersion],
|
|
224
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
225
|
+
headerParameters: [Parameters.accept, Parameters.contentType],
|
|
226
|
+
mediaType: "json",
|
|
227
|
+
serializer
|
|
228
|
+
};
|
|
229
|
+
const enableOperationSpec: coreClient.OperationSpec = {
|
|
230
|
+
path:
|
|
231
|
+
"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable",
|
|
232
|
+
httpMethod: "POST",
|
|
233
|
+
responses: {
|
|
234
|
+
200: {
|
|
235
|
+
bodyMapper: Mappers.EnabledSubscriptionId
|
|
236
|
+
},
|
|
237
|
+
default: {
|
|
238
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
queryParameters: [Parameters.apiVersion],
|
|
242
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
243
|
+
headerParameters: [Parameters.accept],
|
|
244
|
+
serializer
|
|
245
|
+
};
|
|
246
|
+
const acceptOwnershipOperationSpec: coreClient.OperationSpec = {
|
|
247
|
+
path: "/providers/Microsoft.Subscription/{subscriptionId}/acceptOwnership",
|
|
248
|
+
httpMethod: "POST",
|
|
249
|
+
responses: {
|
|
250
|
+
200: {
|
|
251
|
+
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
|
|
252
|
+
},
|
|
253
|
+
201: {
|
|
254
|
+
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
|
|
255
|
+
},
|
|
256
|
+
202: {
|
|
257
|
+
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
|
|
258
|
+
},
|
|
259
|
+
204: {
|
|
260
|
+
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
|
|
261
|
+
},
|
|
262
|
+
default: {
|
|
263
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
requestBody: Parameters.body1,
|
|
267
|
+
queryParameters: [Parameters.apiVersion],
|
|
268
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
269
|
+
headerParameters: [Parameters.accept, Parameters.contentType],
|
|
270
|
+
mediaType: "json",
|
|
271
|
+
serializer
|
|
272
|
+
};
|
|
273
|
+
const acceptOwnershipStatusOperationSpec: coreClient.OperationSpec = {
|
|
274
|
+
path:
|
|
275
|
+
"/providers/Microsoft.Subscription/{subscriptionId}/acceptOwnershipStatus",
|
|
276
|
+
httpMethod: "GET",
|
|
277
|
+
responses: {
|
|
278
|
+
200: {
|
|
279
|
+
bodyMapper: Mappers.AcceptOwnershipStatusResponse
|
|
280
|
+
},
|
|
281
|
+
default: {
|
|
282
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
queryParameters: [Parameters.apiVersion],
|
|
286
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
287
|
+
headerParameters: [Parameters.accept],
|
|
288
|
+
serializer
|
|
289
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
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 { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
10
|
+
import { SubscriptionPolicy } from "../operationsInterfaces";
|
|
11
|
+
import * as coreClient from "@azure/core-client";
|
|
12
|
+
import * as Mappers from "../models/mappers";
|
|
13
|
+
import * as Parameters from "../models/parameters";
|
|
14
|
+
import { SubscriptionClient } from "../subscriptionClient";
|
|
15
|
+
import {
|
|
16
|
+
GetTenantPolicyResponse,
|
|
17
|
+
SubscriptionPolicyListPolicyForTenantNextOptionalParams,
|
|
18
|
+
SubscriptionPolicyListPolicyForTenantOptionalParams,
|
|
19
|
+
PutTenantPolicyRequestProperties,
|
|
20
|
+
SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams,
|
|
21
|
+
SubscriptionPolicyAddUpdatePolicyForTenantResponse,
|
|
22
|
+
SubscriptionPolicyGetPolicyForTenantOptionalParams,
|
|
23
|
+
SubscriptionPolicyGetPolicyForTenantResponse,
|
|
24
|
+
SubscriptionPolicyListPolicyForTenantResponse,
|
|
25
|
+
SubscriptionPolicyListPolicyForTenantNextResponse
|
|
26
|
+
} from "../models";
|
|
27
|
+
|
|
28
|
+
/// <reference lib="esnext.asynciterable" />
|
|
29
|
+
/** Class containing SubscriptionPolicy operations. */
|
|
30
|
+
export class SubscriptionPolicyImpl implements SubscriptionPolicy {
|
|
31
|
+
private readonly client: SubscriptionClient;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Initialize a new instance of the class SubscriptionPolicy class.
|
|
35
|
+
* @param client Reference to the service client
|
|
36
|
+
*/
|
|
37
|
+
constructor(client: SubscriptionClient) {
|
|
38
|
+
this.client = client;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get the subscription tenant policy for the user's tenant.
|
|
43
|
+
* @param options The options parameters.
|
|
44
|
+
*/
|
|
45
|
+
public listPolicyForTenant(
|
|
46
|
+
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
|
|
47
|
+
): PagedAsyncIterableIterator<GetTenantPolicyResponse> {
|
|
48
|
+
const iter = this.listPolicyForTenantPagingAll(options);
|
|
49
|
+
return {
|
|
50
|
+
next() {
|
|
51
|
+
return iter.next();
|
|
52
|
+
},
|
|
53
|
+
[Symbol.asyncIterator]() {
|
|
54
|
+
return this;
|
|
55
|
+
},
|
|
56
|
+
byPage: () => {
|
|
57
|
+
return this.listPolicyForTenantPagingPage(options);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private async *listPolicyForTenantPagingPage(
|
|
63
|
+
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
|
|
64
|
+
): AsyncIterableIterator<GetTenantPolicyResponse[]> {
|
|
65
|
+
let result = await this._listPolicyForTenant(options);
|
|
66
|
+
yield result.value || [];
|
|
67
|
+
let continuationToken = result.nextLink;
|
|
68
|
+
while (continuationToken) {
|
|
69
|
+
result = await this._listPolicyForTenantNext(continuationToken, options);
|
|
70
|
+
continuationToken = result.nextLink;
|
|
71
|
+
yield result.value || [];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private async *listPolicyForTenantPagingAll(
|
|
76
|
+
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
|
|
77
|
+
): AsyncIterableIterator<GetTenantPolicyResponse> {
|
|
78
|
+
for await (const page of this.listPolicyForTenantPagingPage(options)) {
|
|
79
|
+
yield* page;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Create or Update Subscription tenant policy for user's tenant.
|
|
85
|
+
* @param body Put tenant policy request properties.
|
|
86
|
+
* @param options The options parameters.
|
|
87
|
+
*/
|
|
88
|
+
addUpdatePolicyForTenant(
|
|
89
|
+
body: PutTenantPolicyRequestProperties,
|
|
90
|
+
options?: SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams
|
|
91
|
+
): Promise<SubscriptionPolicyAddUpdatePolicyForTenantResponse> {
|
|
92
|
+
return this.client.sendOperationRequest(
|
|
93
|
+
{ body, options },
|
|
94
|
+
addUpdatePolicyForTenantOperationSpec
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get the subscription tenant policy for the user's tenant.
|
|
100
|
+
* @param options The options parameters.
|
|
101
|
+
*/
|
|
102
|
+
getPolicyForTenant(
|
|
103
|
+
options?: SubscriptionPolicyGetPolicyForTenantOptionalParams
|
|
104
|
+
): Promise<SubscriptionPolicyGetPolicyForTenantResponse> {
|
|
105
|
+
return this.client.sendOperationRequest(
|
|
106
|
+
{ options },
|
|
107
|
+
getPolicyForTenantOperationSpec
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get the subscription tenant policy for the user's tenant.
|
|
113
|
+
* @param options The options parameters.
|
|
114
|
+
*/
|
|
115
|
+
private _listPolicyForTenant(
|
|
116
|
+
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
|
|
117
|
+
): Promise<SubscriptionPolicyListPolicyForTenantResponse> {
|
|
118
|
+
return this.client.sendOperationRequest(
|
|
119
|
+
{ options },
|
|
120
|
+
listPolicyForTenantOperationSpec
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* ListPolicyForTenantNext
|
|
126
|
+
* @param nextLink The nextLink from the previous successful call to the ListPolicyForTenant method.
|
|
127
|
+
* @param options The options parameters.
|
|
128
|
+
*/
|
|
129
|
+
private _listPolicyForTenantNext(
|
|
130
|
+
nextLink: string,
|
|
131
|
+
options?: SubscriptionPolicyListPolicyForTenantNextOptionalParams
|
|
132
|
+
): Promise<SubscriptionPolicyListPolicyForTenantNextResponse> {
|
|
133
|
+
return this.client.sendOperationRequest(
|
|
134
|
+
{ nextLink, options },
|
|
135
|
+
listPolicyForTenantNextOperationSpec
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Operation Specifications
|
|
140
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
141
|
+
|
|
142
|
+
const addUpdatePolicyForTenantOperationSpec: coreClient.OperationSpec = {
|
|
143
|
+
path: "/providers/Microsoft.Subscription/policies/default",
|
|
144
|
+
httpMethod: "PUT",
|
|
145
|
+
responses: {
|
|
146
|
+
201: {
|
|
147
|
+
bodyMapper: Mappers.GetTenantPolicyResponse
|
|
148
|
+
},
|
|
149
|
+
default: {
|
|
150
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
requestBody: Parameters.body3,
|
|
154
|
+
queryParameters: [Parameters.apiVersion],
|
|
155
|
+
urlParameters: [Parameters.$host],
|
|
156
|
+
headerParameters: [Parameters.accept, Parameters.contentType],
|
|
157
|
+
mediaType: "json",
|
|
158
|
+
serializer
|
|
159
|
+
};
|
|
160
|
+
const getPolicyForTenantOperationSpec: coreClient.OperationSpec = {
|
|
161
|
+
path: "/providers/Microsoft.Subscription/policies/default",
|
|
162
|
+
httpMethod: "GET",
|
|
163
|
+
responses: {
|
|
164
|
+
200: {
|
|
165
|
+
bodyMapper: Mappers.GetTenantPolicyResponse
|
|
166
|
+
},
|
|
167
|
+
default: {
|
|
168
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
queryParameters: [Parameters.apiVersion],
|
|
172
|
+
urlParameters: [Parameters.$host],
|
|
173
|
+
headerParameters: [Parameters.accept],
|
|
174
|
+
serializer
|
|
175
|
+
};
|
|
176
|
+
const listPolicyForTenantOperationSpec: coreClient.OperationSpec = {
|
|
177
|
+
path: "/providers/Microsoft.Subscription/policies",
|
|
178
|
+
httpMethod: "GET",
|
|
179
|
+
responses: {
|
|
180
|
+
200: {
|
|
181
|
+
bodyMapper: Mappers.GetTenantPolicyListResponse
|
|
182
|
+
},
|
|
183
|
+
default: {
|
|
184
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
queryParameters: [Parameters.apiVersion],
|
|
188
|
+
urlParameters: [Parameters.$host],
|
|
189
|
+
headerParameters: [Parameters.accept],
|
|
190
|
+
serializer
|
|
191
|
+
};
|
|
192
|
+
const listPolicyForTenantNextOperationSpec: coreClient.OperationSpec = {
|
|
193
|
+
path: "{nextLink}",
|
|
194
|
+
httpMethod: "GET",
|
|
195
|
+
responses: {
|
|
196
|
+
200: {
|
|
197
|
+
bodyMapper: Mappers.GetTenantPolicyListResponse
|
|
198
|
+
},
|
|
199
|
+
default: {
|
|
200
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
queryParameters: [Parameters.apiVersion],
|
|
204
|
+
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
205
|
+
headerParameters: [Parameters.accept],
|
|
206
|
+
serializer
|
|
207
|
+
};
|