@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.
- package/CHANGELOG.md +58 -0
- package/{LICENSE.txt → LICENSE} +2 -2
- package/README.md +69 -79
- package/dist/index.js +2330 -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 +658 -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 +36 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -0
- package/dist-esm/src/models/mappers.js +1057 -0
- package/dist-esm/src/models/mappers.js.map +1 -0
- package/dist-esm/src/models/parameters.d.ts +15 -0
- package/dist-esm/src/models/parameters.d.ts.map +1 -0
- package/dist-esm/src/models/parameters.js +121 -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/{esm → dist-esm/src}/operations/index.d.ts +2 -0
- package/dist-esm/src/operations/index.d.ts.map +1 -0
- package/{esm → dist-esm/src}/operations/index.js +5 -5
- 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/subscriptionOperations.d.ts +53 -0
- package/dist-esm/src/operations/subscriptionOperations.d.ts.map +1 -0
- package/dist-esm/src/operations/subscriptionOperations.js +201 -0
- package/dist-esm/src/operations/subscriptionOperations.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/operations/subscriptions.d.ts +54 -0
- package/dist-esm/src/operations/subscriptions.d.ts.map +1 -0
- package/dist-esm/src/operations/subscriptions.js +201 -0
- package/dist-esm/src/operations/subscriptions.js.map +1 -0
- package/dist-esm/src/operations/tenants.d.ts +32 -0
- package/dist-esm/src/operations/tenants.d.ts.map +1 -0
- package/dist-esm/src/operations/tenants.js +114 -0
- package/dist-esm/src/operations/tenants.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 +8 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.js +15 -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/subscriptionOperations.d.ts +45 -0
- package/dist-esm/src/operationsInterfaces/subscriptionOperations.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/subscriptionOperations.js +9 -0
- package/dist-esm/src/operationsInterfaces/subscriptionOperations.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/operationsInterfaces/subscriptions.d.ts +24 -0
- package/dist-esm/src/operationsInterfaces/subscriptions.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/subscriptions.js +9 -0
- package/dist-esm/src/operationsInterfaces/subscriptions.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/tenants.d.ts +11 -0
- package/dist-esm/src/operationsInterfaces/tenants.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/tenants.js +9 -0
- package/dist-esm/src/operationsInterfaces/tenants.js.map +1 -0
- package/dist-esm/src/subscriptionClient.d.ts +21 -0
- package/dist-esm/src/subscriptionClient.d.ts.map +1 -0
- package/dist-esm/src/subscriptionClient.js +50 -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 +559 -0
- package/rollup.config.js +181 -30
- package/src/index.ts +12 -0
- package/src/lroImpl.ts +34 -0
- package/src/models/index.ts +551 -489
- package/src/models/mappers.ts +685 -190
- package/src/models/parameters.ts +94 -27
- package/src/operations/alias.ts +170 -170
- package/src/operations/billingAccount.ts +65 -0
- package/src/operations/index.ts +5 -5
- package/src/operations/operations.ts +103 -40
- package/src/operations/subscriptionOperations.ts +216 -120
- package/src/operations/subscriptionPolicy.ts +207 -0
- package/src/operations/subscriptions.ts +163 -153
- package/src/operations/tenants.ts +87 -79
- package/src/operationsInterfaces/alias.ts +75 -0
- package/src/operationsInterfaces/billingAccount.ts +25 -0
- package/src/operationsInterfaces/index.ts +15 -0
- package/src/operationsInterfaces/operations.ts +22 -0
- package/src/operationsInterfaces/subscriptionOperations.ts +92 -0
- package/src/operationsInterfaces/subscriptionPolicy.ts +46 -0
- package/src/operationsInterfaces/subscriptions.ts +48 -0
- package/src/operationsInterfaces/tenants.ts +22 -0
- package/src/subscriptionClient.ts +81 -43
- package/tsconfig.json +3 -3
- package/types/arm-subscriptions.d.ts +925 -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.map +0 -1
- 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/subscriptionClientContext.ts +0 -60
|
@@ -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
|
+
200: {
|
|
147
|
+
bodyMapper: Mappers.GetTenantPolicyResponse
|
|
148
|
+
},
|
|
149
|
+
default: {
|
|
150
|
+
bodyMapper: Mappers.ErrorResponseBody
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
requestBody: Parameters.body3,
|
|
154
|
+
queryParameters: [Parameters.apiVersion1],
|
|
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.apiVersion1],
|
|
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.apiVersion1],
|
|
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.apiVersion1],
|
|
204
|
+
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
205
|
+
headerParameters: [Parameters.accept],
|
|
206
|
+
serializer
|
|
207
|
+
};
|
|
@@ -1,227 +1,237 @@
|
|
|
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 { Subscriptions } 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
|
+
Location,
|
|
17
|
+
SubscriptionsListLocationsOptionalParams,
|
|
18
|
+
Subscription,
|
|
19
|
+
SubscriptionsListNextOptionalParams,
|
|
20
|
+
SubscriptionsListOptionalParams,
|
|
21
|
+
SubscriptionsListLocationsResponse,
|
|
22
|
+
SubscriptionsGetOptionalParams,
|
|
23
|
+
SubscriptionsGetResponse,
|
|
24
|
+
SubscriptionsListResponse,
|
|
25
|
+
SubscriptionsListNextResponse
|
|
26
|
+
} from "../models";
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
/// <reference lib="esnext.asynciterable" />
|
|
29
|
+
/** Class containing Subscriptions operations. */
|
|
30
|
+
export class SubscriptionsImpl implements Subscriptions {
|
|
31
|
+
private readonly client: SubscriptionClient;
|
|
20
32
|
|
|
21
33
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @param
|
|
34
|
+
* Initialize a new instance of the class Subscriptions class.
|
|
35
|
+
* @param client Reference to the service client
|
|
24
36
|
*/
|
|
25
|
-
constructor(client:
|
|
37
|
+
constructor(client: SubscriptionClient) {
|
|
26
38
|
this.client = client;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
/**
|
|
30
|
-
* This operation provides all the locations that are available for resource providers; however,
|
|
31
|
-
*
|
|
32
|
-
* @summary Gets all available geo-locations.
|
|
42
|
+
* This operation provides all the locations that are available for resource providers; however, each
|
|
43
|
+
* resource provider may support a subset of this list.
|
|
33
44
|
* @param subscriptionId The ID of the target subscription.
|
|
34
|
-
* @param
|
|
35
|
-
* @returns Promise<Models.SubscriptionsListLocationsResponse>
|
|
45
|
+
* @param options The options parameters.
|
|
36
46
|
*/
|
|
37
|
-
listLocations(
|
|
47
|
+
public listLocations(
|
|
48
|
+
subscriptionId: string,
|
|
49
|
+
options?: SubscriptionsListLocationsOptionalParams
|
|
50
|
+
): PagedAsyncIterableIterator<Location> {
|
|
51
|
+
const iter = this.listLocationsPagingAll(subscriptionId, options);
|
|
52
|
+
return {
|
|
53
|
+
next() {
|
|
54
|
+
return iter.next();
|
|
55
|
+
},
|
|
56
|
+
[Symbol.asyncIterator]() {
|
|
57
|
+
return this;
|
|
58
|
+
},
|
|
59
|
+
byPage: () => {
|
|
60
|
+
return this.listLocationsPagingPage(subscriptionId, options);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private async *listLocationsPagingPage(
|
|
66
|
+
subscriptionId: string,
|
|
67
|
+
options?: SubscriptionsListLocationsOptionalParams
|
|
68
|
+
): AsyncIterableIterator<Location[]> {
|
|
69
|
+
let result = await this._listLocations(subscriptionId, options);
|
|
70
|
+
yield result.value || [];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private async *listLocationsPagingAll(
|
|
74
|
+
subscriptionId: string,
|
|
75
|
+
options?: SubscriptionsListLocationsOptionalParams
|
|
76
|
+
): AsyncIterableIterator<Location> {
|
|
77
|
+
for await (const page of this.listLocationsPagingPage(
|
|
78
|
+
subscriptionId,
|
|
79
|
+
options
|
|
80
|
+
)) {
|
|
81
|
+
yield* page;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
38
85
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param
|
|
86
|
+
* Gets all subscriptions for a tenant.
|
|
87
|
+
* @param options The options parameters.
|
|
41
88
|
*/
|
|
42
|
-
|
|
89
|
+
public list(
|
|
90
|
+
options?: SubscriptionsListOptionalParams
|
|
91
|
+
): PagedAsyncIterableIterator<Subscription> {
|
|
92
|
+
const iter = this.listPagingAll(options);
|
|
93
|
+
return {
|
|
94
|
+
next() {
|
|
95
|
+
return iter.next();
|
|
96
|
+
},
|
|
97
|
+
[Symbol.asyncIterator]() {
|
|
98
|
+
return this;
|
|
99
|
+
},
|
|
100
|
+
byPage: () => {
|
|
101
|
+
return this.listPagingPage(options);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private async *listPagingPage(
|
|
107
|
+
options?: SubscriptionsListOptionalParams
|
|
108
|
+
): AsyncIterableIterator<Subscription[]> {
|
|
109
|
+
let result = await this._list(options);
|
|
110
|
+
yield result.value || [];
|
|
111
|
+
let continuationToken = result.nextLink;
|
|
112
|
+
while (continuationToken) {
|
|
113
|
+
result = await this._listNext(continuationToken, options);
|
|
114
|
+
continuationToken = result.nextLink;
|
|
115
|
+
yield result.value || [];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private async *listPagingAll(
|
|
120
|
+
options?: SubscriptionsListOptionalParams
|
|
121
|
+
): AsyncIterableIterator<Subscription> {
|
|
122
|
+
for await (const page of this.listPagingPage(options)) {
|
|
123
|
+
yield* page;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
43
127
|
/**
|
|
128
|
+
* This operation provides all the locations that are available for resource providers; however, each
|
|
129
|
+
* resource provider may support a subset of this list.
|
|
44
130
|
* @param subscriptionId The ID of the target subscription.
|
|
45
|
-
* @param options The
|
|
46
|
-
* @param callback The callback
|
|
131
|
+
* @param options The options parameters.
|
|
47
132
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
133
|
+
private _listLocations(
|
|
134
|
+
subscriptionId: string,
|
|
135
|
+
options?: SubscriptionsListLocationsOptionalParams
|
|
136
|
+
): Promise<SubscriptionsListLocationsResponse> {
|
|
50
137
|
return this.client.sendOperationRequest(
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
listLocationsOperationSpec,
|
|
56
|
-
callback) as Promise<Models.SubscriptionsListLocationsResponse>;
|
|
138
|
+
{ subscriptionId, options },
|
|
139
|
+
listLocationsOperationSpec
|
|
140
|
+
);
|
|
57
141
|
}
|
|
58
142
|
|
|
59
143
|
/**
|
|
60
144
|
* Gets details about a specified subscription.
|
|
61
145
|
* @param subscriptionId The ID of the target subscription.
|
|
62
|
-
* @param
|
|
63
|
-
* @returns Promise<Models.SubscriptionsGetResponse>
|
|
64
|
-
*/
|
|
65
|
-
get(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise<Models.SubscriptionsGetResponse>;
|
|
66
|
-
/**
|
|
67
|
-
* @param subscriptionId The ID of the target subscription.
|
|
68
|
-
* @param callback The callback
|
|
69
|
-
*/
|
|
70
|
-
get(subscriptionId: string, callback: msRest.ServiceCallback<Models.Subscription>): void;
|
|
71
|
-
/**
|
|
72
|
-
* @param subscriptionId The ID of the target subscription.
|
|
73
|
-
* @param options The optional parameters
|
|
74
|
-
* @param callback The callback
|
|
146
|
+
* @param options The options parameters.
|
|
75
147
|
*/
|
|
76
|
-
get(
|
|
77
|
-
|
|
148
|
+
get(
|
|
149
|
+
subscriptionId: string,
|
|
150
|
+
options?: SubscriptionsGetOptionalParams
|
|
151
|
+
): Promise<SubscriptionsGetResponse> {
|
|
78
152
|
return this.client.sendOperationRequest(
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
getOperationSpec,
|
|
84
|
-
callback) as Promise<Models.SubscriptionsGetResponse>;
|
|
153
|
+
{ subscriptionId, options },
|
|
154
|
+
getOperationSpec
|
|
155
|
+
);
|
|
85
156
|
}
|
|
86
157
|
|
|
87
158
|
/**
|
|
88
159
|
* Gets all subscriptions for a tenant.
|
|
89
|
-
* @param
|
|
90
|
-
* @returns Promise<Models.SubscriptionsListResponse>
|
|
91
|
-
*/
|
|
92
|
-
list(options?: msRest.RequestOptionsBase): Promise<Models.SubscriptionsListResponse>;
|
|
93
|
-
/**
|
|
94
|
-
* @param callback The callback
|
|
95
|
-
*/
|
|
96
|
-
list(callback: msRest.ServiceCallback<Models.SubscriptionListResult>): void;
|
|
97
|
-
/**
|
|
98
|
-
* @param options The optional parameters
|
|
99
|
-
* @param callback The callback
|
|
160
|
+
* @param options The options parameters.
|
|
100
161
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
options
|
|
106
|
-
},
|
|
107
|
-
listOperationSpec,
|
|
108
|
-
callback) as Promise<Models.SubscriptionsListResponse>;
|
|
162
|
+
private _list(
|
|
163
|
+
options?: SubscriptionsListOptionalParams
|
|
164
|
+
): Promise<SubscriptionsListResponse> {
|
|
165
|
+
return this.client.sendOperationRequest({ options }, listOperationSpec);
|
|
109
166
|
}
|
|
110
167
|
|
|
111
168
|
/**
|
|
112
|
-
*
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
* @returns Promise<Models.SubscriptionsListNextResponse>
|
|
116
|
-
*/
|
|
117
|
-
listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise<Models.SubscriptionsListNextResponse>;
|
|
118
|
-
/**
|
|
119
|
-
* @param nextPageLink The NextLink from the previous successful call to List operation.
|
|
120
|
-
* @param callback The callback
|
|
121
|
-
*/
|
|
122
|
-
listNext(nextPageLink: string, callback: msRest.ServiceCallback<Models.SubscriptionListResult>): void;
|
|
123
|
-
/**
|
|
124
|
-
* @param nextPageLink The NextLink from the previous successful call to List operation.
|
|
125
|
-
* @param options The optional parameters
|
|
126
|
-
* @param callback The callback
|
|
169
|
+
* ListNext
|
|
170
|
+
* @param nextLink The nextLink from the previous successful call to the List method.
|
|
171
|
+
* @param options The options parameters.
|
|
127
172
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
173
|
+
private _listNext(
|
|
174
|
+
nextLink: string,
|
|
175
|
+
options?: SubscriptionsListNextOptionalParams
|
|
176
|
+
): Promise<SubscriptionsListNextResponse> {
|
|
130
177
|
return this.client.sendOperationRequest(
|
|
131
|
-
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
listNextOperationSpec,
|
|
136
|
-
callback) as Promise<Models.SubscriptionsListNextResponse>;
|
|
178
|
+
{ nextLink, options },
|
|
179
|
+
listNextOperationSpec
|
|
180
|
+
);
|
|
137
181
|
}
|
|
138
182
|
}
|
|
139
|
-
|
|
140
183
|
// Operation Specifications
|
|
141
|
-
const serializer =
|
|
142
|
-
|
|
184
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
185
|
+
|
|
186
|
+
const listLocationsOperationSpec: coreClient.OperationSpec = {
|
|
187
|
+
path: "/subscriptions/{subscriptionId}/locations",
|
|
143
188
|
httpMethod: "GET",
|
|
144
|
-
path: "subscriptions/{subscriptionId}/locations",
|
|
145
|
-
urlParameters: [
|
|
146
|
-
Parameters.subscriptionId
|
|
147
|
-
],
|
|
148
|
-
queryParameters: [
|
|
149
|
-
Parameters.apiVersion0
|
|
150
|
-
],
|
|
151
|
-
headerParameters: [
|
|
152
|
-
Parameters.acceptLanguage
|
|
153
|
-
],
|
|
154
189
|
responses: {
|
|
155
190
|
200: {
|
|
156
191
|
bodyMapper: Mappers.LocationListResult
|
|
157
|
-
},
|
|
158
|
-
default: {
|
|
159
|
-
bodyMapper: Mappers.CloudError
|
|
160
192
|
}
|
|
161
193
|
},
|
|
194
|
+
queryParameters: [Parameters.apiVersion],
|
|
195
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
196
|
+
headerParameters: [Parameters.accept],
|
|
162
197
|
serializer
|
|
163
198
|
};
|
|
164
|
-
|
|
165
|
-
|
|
199
|
+
const getOperationSpec: coreClient.OperationSpec = {
|
|
200
|
+
path: "/subscriptions/{subscriptionId}",
|
|
166
201
|
httpMethod: "GET",
|
|
167
|
-
path: "subscriptions/{subscriptionId}",
|
|
168
|
-
urlParameters: [
|
|
169
|
-
Parameters.subscriptionId
|
|
170
|
-
],
|
|
171
|
-
queryParameters: [
|
|
172
|
-
Parameters.apiVersion0
|
|
173
|
-
],
|
|
174
|
-
headerParameters: [
|
|
175
|
-
Parameters.acceptLanguage
|
|
176
|
-
],
|
|
177
202
|
responses: {
|
|
178
203
|
200: {
|
|
179
204
|
bodyMapper: Mappers.Subscription
|
|
180
|
-
},
|
|
181
|
-
default: {
|
|
182
|
-
bodyMapper: Mappers.CloudError
|
|
183
205
|
}
|
|
184
206
|
},
|
|
207
|
+
queryParameters: [Parameters.apiVersion],
|
|
208
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
209
|
+
headerParameters: [Parameters.accept],
|
|
185
210
|
serializer
|
|
186
211
|
};
|
|
187
|
-
|
|
188
|
-
|
|
212
|
+
const listOperationSpec: coreClient.OperationSpec = {
|
|
213
|
+
path: "/subscriptions",
|
|
189
214
|
httpMethod: "GET",
|
|
190
|
-
path: "subscriptions",
|
|
191
|
-
queryParameters: [
|
|
192
|
-
Parameters.apiVersion0
|
|
193
|
-
],
|
|
194
|
-
headerParameters: [
|
|
195
|
-
Parameters.acceptLanguage
|
|
196
|
-
],
|
|
197
215
|
responses: {
|
|
198
216
|
200: {
|
|
199
217
|
bodyMapper: Mappers.SubscriptionListResult
|
|
200
|
-
},
|
|
201
|
-
default: {
|
|
202
|
-
bodyMapper: Mappers.CloudError
|
|
203
218
|
}
|
|
204
219
|
},
|
|
220
|
+
queryParameters: [Parameters.apiVersion],
|
|
221
|
+
urlParameters: [Parameters.$host],
|
|
222
|
+
headerParameters: [Parameters.accept],
|
|
205
223
|
serializer
|
|
206
224
|
};
|
|
207
|
-
|
|
208
|
-
const listNextOperationSpec: msRest.OperationSpec = {
|
|
209
|
-
httpMethod: "GET",
|
|
210
|
-
baseUrl: "https://management.azure.com",
|
|
225
|
+
const listNextOperationSpec: coreClient.OperationSpec = {
|
|
211
226
|
path: "{nextLink}",
|
|
212
|
-
|
|
213
|
-
Parameters.nextPageLink
|
|
214
|
-
],
|
|
215
|
-
headerParameters: [
|
|
216
|
-
Parameters.acceptLanguage
|
|
217
|
-
],
|
|
227
|
+
httpMethod: "GET",
|
|
218
228
|
responses: {
|
|
219
229
|
200: {
|
|
220
230
|
bodyMapper: Mappers.SubscriptionListResult
|
|
221
|
-
},
|
|
222
|
-
default: {
|
|
223
|
-
bodyMapper: Mappers.CloudError
|
|
224
231
|
}
|
|
225
232
|
},
|
|
233
|
+
queryParameters: [Parameters.apiVersion],
|
|
234
|
+
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
235
|
+
headerParameters: [Parameters.accept],
|
|
226
236
|
serializer
|
|
227
237
|
};
|