@azure/arm-reservations 9.0.1-alpha.20250718.1 → 9.0.1-alpha.20250730.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/azureReservationAPI.js +42 -45
- package/dist/browser/azureReservationAPI.js.map +1 -1
- package/dist/browser/lroImpl.js +7 -3
- package/dist/browser/lroImpl.js.map +1 -1
- package/dist/browser/models/mappers.js +21 -9
- package/dist/browser/models/mappers.js.map +1 -1
- package/dist/browser/operations/calculateExchange.js +12 -6
- package/dist/browser/operations/calculateExchange.js.map +1 -1
- package/dist/browser/operations/calculateRefund.js +1 -0
- package/dist/browser/operations/calculateRefund.js.map +1 -1
- package/dist/browser/operations/exchange.js +12 -6
- package/dist/browser/operations/exchange.js.map +1 -1
- package/dist/browser/operations/operation.js +23 -40
- package/dist/browser/operations/operation.js.map +1 -1
- package/dist/browser/operations/quota.js +45 -52
- package/dist/browser/operations/quota.js.map +1 -1
- package/dist/browser/operations/quotaRequestStatus.js +23 -40
- package/dist/browser/operations/quotaRequestStatus.js.map +1 -1
- package/dist/browser/operations/reservation.js +111 -142
- package/dist/browser/operations/reservation.js.map +1 -1
- package/dist/browser/operations/reservationOrder.js +34 -46
- package/dist/browser/operations/reservationOrder.js.map +1 -1
- package/dist/browser/operations/return.js +12 -6
- package/dist/browser/operations/return.js.map +1 -1
- package/dist/browser/pagingHelper.js +2 -4
- package/dist/browser/pagingHelper.js.map +1 -1
- package/dist/commonjs/azureReservationAPI.js +42 -44
- package/dist/commonjs/azureReservationAPI.js.map +1 -1
- package/dist/commonjs/lroImpl.js +7 -3
- package/dist/commonjs/lroImpl.js.map +1 -1
- package/dist/commonjs/models/mappers.js +21 -9
- package/dist/commonjs/models/mappers.js.map +1 -1
- package/dist/commonjs/operations/calculateExchange.js +12 -6
- package/dist/commonjs/operations/calculateExchange.js.map +1 -1
- package/dist/commonjs/operations/calculateRefund.js +1 -0
- package/dist/commonjs/operations/calculateRefund.js.map +1 -1
- package/dist/commonjs/operations/exchange.js +12 -6
- package/dist/commonjs/operations/exchange.js.map +1 -1
- package/dist/commonjs/operations/operation.js +23 -39
- package/dist/commonjs/operations/operation.js.map +1 -1
- package/dist/commonjs/operations/quota.js +45 -51
- package/dist/commonjs/operations/quota.js.map +1 -1
- package/dist/commonjs/operations/quotaRequestStatus.js +23 -39
- package/dist/commonjs/operations/quotaRequestStatus.js.map +1 -1
- package/dist/commonjs/operations/reservation.js +111 -141
- package/dist/commonjs/operations/reservation.js.map +1 -1
- package/dist/commonjs/operations/reservationOrder.js +34 -45
- package/dist/commonjs/operations/reservationOrder.js.map +1 -1
- package/dist/commonjs/operations/return.js +12 -6
- package/dist/commonjs/operations/return.js.map +1 -1
- package/dist/commonjs/pagingHelper.js +2 -4
- package/dist/commonjs/pagingHelper.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/azureReservationAPI.js +42 -45
- package/dist/esm/azureReservationAPI.js.map +1 -1
- package/dist/esm/lroImpl.js +7 -3
- package/dist/esm/lroImpl.js.map +1 -1
- package/dist/esm/models/mappers.js +21 -9
- package/dist/esm/models/mappers.js.map +1 -1
- package/dist/esm/operations/calculateExchange.js +12 -6
- package/dist/esm/operations/calculateExchange.js.map +1 -1
- package/dist/esm/operations/calculateRefund.js +1 -0
- package/dist/esm/operations/calculateRefund.js.map +1 -1
- package/dist/esm/operations/exchange.js +12 -6
- package/dist/esm/operations/exchange.js.map +1 -1
- package/dist/esm/operations/operation.js +23 -40
- package/dist/esm/operations/operation.js.map +1 -1
- package/dist/esm/operations/quota.js +45 -52
- package/dist/esm/operations/quota.js.map +1 -1
- package/dist/esm/operations/quotaRequestStatus.js +23 -40
- package/dist/esm/operations/quotaRequestStatus.js.map +1 -1
- package/dist/esm/operations/reservation.js +111 -142
- package/dist/esm/operations/reservation.js.map +1 -1
- package/dist/esm/operations/reservationOrder.js +34 -46
- package/dist/esm/operations/reservationOrder.js.map +1 -1
- package/dist/esm/operations/return.js +12 -6
- package/dist/esm/operations/return.js.map +1 -1
- package/dist/esm/pagingHelper.js +2 -4
- package/dist/esm/pagingHelper.js.map +1 -1
- package/dist/react-native/azureReservationAPI.js +42 -45
- package/dist/react-native/azureReservationAPI.js.map +1 -1
- package/dist/react-native/lroImpl.js +7 -3
- package/dist/react-native/lroImpl.js.map +1 -1
- package/dist/react-native/models/mappers.js +21 -9
- package/dist/react-native/models/mappers.js.map +1 -1
- package/dist/react-native/operations/calculateExchange.js +12 -6
- package/dist/react-native/operations/calculateExchange.js.map +1 -1
- package/dist/react-native/operations/calculateRefund.js +1 -0
- package/dist/react-native/operations/calculateRefund.js.map +1 -1
- package/dist/react-native/operations/exchange.js +12 -6
- package/dist/react-native/operations/exchange.js.map +1 -1
- package/dist/react-native/operations/operation.js +23 -40
- package/dist/react-native/operations/operation.js.map +1 -1
- package/dist/react-native/operations/quota.js +45 -52
- package/dist/react-native/operations/quota.js.map +1 -1
- package/dist/react-native/operations/quotaRequestStatus.js +23 -40
- package/dist/react-native/operations/quotaRequestStatus.js.map +1 -1
- package/dist/react-native/operations/reservation.js +111 -142
- package/dist/react-native/operations/reservation.js.map +1 -1
- package/dist/react-native/operations/reservationOrder.js +34 -46
- package/dist/react-native/operations/reservationOrder.js.map +1 -1
- package/dist/react-native/operations/return.js +12 -6
- package/dist/react-native/operations/return.js.map +1 -1
- package/dist/react-native/pagingHelper.js +2 -4
- package/dist/react-native/pagingHelper.js.map +1 -1
- package/package.json +2 -2
- package/review/arm-reservations-node.api.md +1675 -1675
|
@@ -17,13 +17,13 @@ const Parameters = tslib_1.__importStar(require("./models/parameters.js"));
|
|
|
17
17
|
const Mappers = tslib_1.__importStar(require("./models/mappers.js"));
|
|
18
18
|
/// <reference lib="esnext.asynciterable" />
|
|
19
19
|
class AzureReservationAPI extends coreClient.ServiceClient {
|
|
20
|
+
$host;
|
|
20
21
|
/**
|
|
21
22
|
* Initializes a new instance of the AzureReservationAPI class.
|
|
22
23
|
* @param credentials Subscription credentials which uniquely identify client subscription.
|
|
23
24
|
* @param options The parameter options
|
|
24
25
|
*/
|
|
25
26
|
constructor(credentials, options) {
|
|
26
|
-
var _a, _b, _c;
|
|
27
27
|
if (credentials === undefined) {
|
|
28
28
|
throw new Error("'credentials' cannot be null");
|
|
29
29
|
}
|
|
@@ -39,12 +39,17 @@ class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
39
39
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
40
40
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
41
41
|
: `${packageDetails}`;
|
|
42
|
-
const optionsWithDefaults =
|
|
42
|
+
const optionsWithDefaults = {
|
|
43
|
+
...defaults,
|
|
44
|
+
...options,
|
|
45
|
+
userAgentOptions: {
|
|
43
46
|
userAgentPrefix
|
|
44
|
-
},
|
|
47
|
+
},
|
|
48
|
+
endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
49
|
+
};
|
|
45
50
|
super(optionsWithDefaults);
|
|
46
51
|
let bearerTokenAuthenticationPolicyFound = false;
|
|
47
|
-
if (
|
|
52
|
+
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
48
53
|
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
|
49
54
|
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
|
|
50
55
|
coreRestPipeline.bearerTokenAuthenticationPolicyName);
|
|
@@ -58,7 +63,8 @@ class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
58
63
|
});
|
|
59
64
|
this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
60
65
|
credential: credentials,
|
|
61
|
-
scopes:
|
|
66
|
+
scopes: optionsWithDefaults.credentialScopes ??
|
|
67
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
62
68
|
challengeCallbacks: {
|
|
63
69
|
authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge
|
|
64
70
|
}
|
|
@@ -91,52 +97,35 @@ class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
91
97
|
return this;
|
|
92
98
|
},
|
|
93
99
|
byPage: (settings) => {
|
|
94
|
-
if (settings
|
|
100
|
+
if (settings?.maxPageSize) {
|
|
95
101
|
throw new Error("maxPageSize is not supported by this operation.");
|
|
96
102
|
}
|
|
97
103
|
return this.getCatalogPagingPage(subscriptionId, options, settings);
|
|
98
104
|
}
|
|
99
105
|
};
|
|
100
106
|
}
|
|
101
|
-
getCatalogPagingPage(subscriptionId, options, settings) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
});
|
|
107
|
+
async *getCatalogPagingPage(subscriptionId, options, settings) {
|
|
108
|
+
let result;
|
|
109
|
+
let continuationToken = settings?.continuationToken;
|
|
110
|
+
if (!continuationToken) {
|
|
111
|
+
result = await this._getCatalog(subscriptionId, options);
|
|
112
|
+
let page = result.value || [];
|
|
113
|
+
continuationToken = result.nextLink;
|
|
114
|
+
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
|
|
115
|
+
yield page;
|
|
116
|
+
}
|
|
117
|
+
while (continuationToken) {
|
|
118
|
+
result = await this._getCatalogNext(subscriptionId, continuationToken, options);
|
|
119
|
+
continuationToken = result.nextLink;
|
|
120
|
+
let page = result.value || [];
|
|
121
|
+
(0, pagingHelper_js_1.setContinuationToken)(page, continuationToken);
|
|
122
|
+
yield page;
|
|
123
|
+
}
|
|
120
124
|
}
|
|
121
|
-
getCatalogPagingAll(subscriptionId, options) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
for (var _d = true, _e = tslib_1.__asyncValues(this.getCatalogPagingPage(subscriptionId, options)), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
126
|
-
_c = _f.value;
|
|
127
|
-
_d = false;
|
|
128
|
-
const page = _c;
|
|
129
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page)));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
133
|
-
finally {
|
|
134
|
-
try {
|
|
135
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
|
136
|
-
}
|
|
137
|
-
finally { if (e_1) throw e_1.error; }
|
|
138
|
-
}
|
|
139
|
-
});
|
|
125
|
+
async *getCatalogPagingAll(subscriptionId, options) {
|
|
126
|
+
for await (const page of this.getCatalogPagingPage(subscriptionId, options)) {
|
|
127
|
+
yield* page;
|
|
128
|
+
}
|
|
140
129
|
}
|
|
141
130
|
/**
|
|
142
131
|
* Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
|
@@ -164,6 +153,15 @@ class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
164
153
|
_getCatalogNext(subscriptionId, nextLink, options) {
|
|
165
154
|
return this.sendOperationRequest({ subscriptionId, nextLink, options }, getCatalogNextOperationSpec);
|
|
166
155
|
}
|
|
156
|
+
reservation;
|
|
157
|
+
reservationOrder;
|
|
158
|
+
operation;
|
|
159
|
+
calculateRefund;
|
|
160
|
+
return;
|
|
161
|
+
calculateExchange;
|
|
162
|
+
exchange;
|
|
163
|
+
quota;
|
|
164
|
+
quotaRequestStatus;
|
|
167
165
|
}
|
|
168
166
|
exports.AzureReservationAPI = AzureReservationAPI;
|
|
169
167
|
// Operation Specifications
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azureReservationAPI.js","sourceRoot":"","sources":["../../src/azureReservationAPI.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,uEAAiD;AACj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H,UAAU,EAAE,OAAO,CAAC,cAAc;SACnC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;KACF;IACD,aAAa,EAAE;QACb,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,QAAQ;QACnB,UAAU,CAAC,cAAc;KAC1B;IACD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as coreAuth from \"@azure/core-auth\";\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\nimport { setContinuationToken } from \"./pagingHelper.js\";\nimport {\n ReservationImpl,\n ReservationOrderImpl,\n OperationImpl,\n CalculateRefundImpl,\n ReturnImpl,\n CalculateExchangeImpl,\n ExchangeImpl,\n QuotaImpl,\n QuotaRequestStatusImpl\n} from \"./operations/index.js\";\nimport {\n Reservation,\n ReservationOrder,\n Operation,\n CalculateRefund,\n Return,\n CalculateExchange,\n Exchange,\n Quota,\n QuotaRequestStatus\n} from \"./operationsInterfaces/index.js\";\nimport * as Parameters from \"./models/parameters.js\";\nimport * as Mappers from \"./models/mappers.js\";\nimport {\n AzureReservationAPIOptionalParams,\n Catalog,\n GetCatalogNextOptionalParams,\n GetCatalogOptionalParams,\n GetCatalogResponse,\n GetAppliedReservationListOptionalParams,\n GetAppliedReservationListResponse,\n GetCatalogNextResponse\n} from \"./models/index.js\";\n\n/// <reference lib=\"esnext.asynciterable\" />\nexport class AzureReservationAPI extends coreClient.ServiceClient {\n $host: string;\n\n /**\n * Initializes a new instance of the AzureReservationAPI class.\n * @param credentials Subscription credentials which uniquely identify client subscription.\n * @param options The parameter options\n */\n constructor(\n credentials: coreAuth.TokenCredential,\n options?: AzureReservationAPIOptionalParams\n ) {\n if (credentials === undefined) {\n throw new Error(\"'credentials' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: AzureReservationAPIOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n credential: credentials\n };\n\n const packageDetails = `azsdk-js-arm-reservations/9.0.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n endpoint:\n options.endpoint ?? options.baseUri ?? \"https://management.azure.com\"\n };\n super(optionsWithDefaults);\n\n let bearerTokenAuthenticationPolicyFound: boolean = false;\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n }\n if (\n !options ||\n !options.pipeline ||\n options.pipeline.getOrderedPolicies().length == 0 ||\n !bearerTokenAuthenticationPolicyFound\n ) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n credential: credentials,\n scopes:\n optionsWithDefaults.credentialScopes ??\n `${optionsWithDefaults.endpoint}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n\n // Assigning values to Constant parameters\n this.$host = options.$host || \"https://management.azure.com\";\n this.reservation = new ReservationImpl(this);\n this.reservationOrder = new ReservationOrderImpl(this);\n this.operation = new OperationImpl(this);\n this.calculateRefund = new CalculateRefundImpl(this);\n this.return = new ReturnImpl(this);\n this.calculateExchange = new CalculateExchangeImpl(this);\n this.exchange = new ExchangeImpl(this);\n this.quota = new QuotaImpl(this);\n this.quotaRequestStatus = new QuotaRequestStatusImpl(this);\n }\n\n /**\n * Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n * @param subscriptionId Id of the subscription\n * @param options The options parameters.\n */\n public listCatalog(\n subscriptionId: string,\n options?: GetCatalogOptionalParams\n ): PagedAsyncIterableIterator<Catalog> {\n const iter = this.getCatalogPagingAll(subscriptionId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n if (settings?.maxPageSize) {\n throw new Error(\"maxPageSize is not supported by this operation.\");\n }\n return this.getCatalogPagingPage(subscriptionId, options, settings);\n }\n };\n }\n\n private async *getCatalogPagingPage(\n subscriptionId: string,\n options?: GetCatalogOptionalParams,\n settings?: PageSettings\n ): AsyncIterableIterator<Catalog[]> {\n let result: GetCatalogResponse;\n let continuationToken = settings?.continuationToken;\n if (!continuationToken) {\n result = await this._getCatalog(subscriptionId, options);\n let page = result.value || [];\n continuationToken = result.nextLink;\n setContinuationToken(page, continuationToken);\n yield page;\n }\n while (continuationToken) {\n result = await this._getCatalogNext(\n subscriptionId,\n continuationToken,\n options\n );\n continuationToken = result.nextLink;\n let page = result.value || [];\n setContinuationToken(page, continuationToken);\n yield page;\n }\n }\n\n private async *getCatalogPagingAll(\n subscriptionId: string,\n options?: GetCatalogOptionalParams\n ): AsyncIterableIterator<Catalog> {\n for await (const page of this.getCatalogPagingPage(\n subscriptionId,\n options\n )) {\n yield* page;\n }\n }\n\n /**\n * Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n * @param subscriptionId Id of the subscription\n * @param options The options parameters.\n */\n private _getCatalog(\n subscriptionId: string,\n options?: GetCatalogOptionalParams\n ): Promise<GetCatalogResponse> {\n return this.sendOperationRequest(\n { subscriptionId, options },\n getCatalogOperationSpec\n );\n }\n\n /**\n * Get applicable `Reservation`s that are applied to this subscription or a resource group under this\n * subscription.\n * @param subscriptionId Id of the subscription\n * @param options The options parameters.\n */\n getAppliedReservationList(\n subscriptionId: string,\n options?: GetAppliedReservationListOptionalParams\n ): Promise<GetAppliedReservationListResponse> {\n return this.sendOperationRequest(\n { subscriptionId, options },\n getAppliedReservationListOperationSpec\n );\n }\n\n /**\n * GetCatalogNext\n * @param subscriptionId Id of the subscription\n * @param nextLink The nextLink from the previous successful call to the GetCatalog method.\n * @param options The options parameters.\n */\n private _getCatalogNext(\n subscriptionId: string,\n nextLink: string,\n options?: GetCatalogNextOptionalParams\n ): Promise<GetCatalogNextResponse> {\n return this.sendOperationRequest(\n { subscriptionId, nextLink, options },\n getCatalogNextOperationSpec\n );\n }\n\n reservation: Reservation;\n reservationOrder: ReservationOrder;\n operation: Operation;\n calculateRefund: CalculateRefund;\n return: Return;\n calculateExchange: CalculateExchange;\n exchange: Exchange;\n quota: Quota;\n quotaRequestStatus: QuotaRequestStatus;\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getCatalogOperationSpec: coreClient.OperationSpec = {\n path: \"/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.CatalogsResult\n },\n default: {\n bodyMapper: Mappers.ErrorModel\n }\n },\n queryParameters: [\n Parameters.apiVersion,\n Parameters.filter,\n Parameters.reservedResourceType,\n Parameters.location,\n Parameters.publisherId,\n Parameters.offerId,\n Parameters.planId,\n Parameters.skip,\n Parameters.take1\n ],\n urlParameters: [Parameters.$host, Parameters.subscriptionId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getAppliedReservationListOperationSpec: coreClient.OperationSpec = {\n path:\n \"/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AppliedReservations\n },\n default: {\n bodyMapper: Mappers.ErrorModel\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.$host, Parameters.subscriptionId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getCatalogNextOperationSpec: coreClient.OperationSpec = {\n path: \"{nextLink}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.CatalogsResult\n },\n default: {\n bodyMapper: Mappers.ErrorModel\n }\n },\n urlParameters: [\n Parameters.$host,\n Parameters.nextLink,\n Parameters.subscriptionId\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\n"]}
|
|
1
|
+
{"version":3,"file":"azureReservationAPI.js","sourceRoot":"","sources":["../../src/azureReservationAPI.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,uEAAiD;AACjD,oFAA8D;AAG9D,uDAAyD;AACzD,oDAU+B;AAY/B,2EAAqD;AACrD,qEAA+C;AAY/C,4CAA4C;AAC5C,MAAa,mBAAoB,SAAQ,UAAU,CAAC,aAAa;IAC/D,KAAK,CAAS;IAEd;;;;OAIG;IACH,YACE,WAAqC,EACrC,OAA2C;QAE3C,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,MAAM,QAAQ,GAAsC;YAClD,kBAAkB,EAAE,iCAAiC;YACrD,UAAU,EAAE,WAAW;SACxB,CAAC;QAEF,MAAM,cAAc,GAAG,iCAAiC,CAAC;QACzD,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,GAAG;YA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EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,mBAAmB;SACxC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;KACF;IACD,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC;IAC5D,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC;AACF,MAAM,2BAA2B,GAA6B;IAC5D,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,cAAc;SACnC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;KACF;IACD,aAAa,EAAE;QACb,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,QAAQ;QACnB,UAAU,CAAC,cAAc;KAC1B;IACD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as coreAuth from \"@azure/core-auth\";\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\nimport { setContinuationToken } from \"./pagingHelper.js\";\nimport {\n ReservationImpl,\n ReservationOrderImpl,\n OperationImpl,\n CalculateRefundImpl,\n ReturnImpl,\n CalculateExchangeImpl,\n ExchangeImpl,\n QuotaImpl,\n QuotaRequestStatusImpl\n} from \"./operations/index.js\";\nimport {\n Reservation,\n ReservationOrder,\n Operation,\n CalculateRefund,\n Return,\n CalculateExchange,\n Exchange,\n Quota,\n QuotaRequestStatus\n} from \"./operationsInterfaces/index.js\";\nimport * as Parameters from \"./models/parameters.js\";\nimport * as Mappers from \"./models/mappers.js\";\nimport {\n AzureReservationAPIOptionalParams,\n Catalog,\n GetCatalogNextOptionalParams,\n GetCatalogOptionalParams,\n GetCatalogResponse,\n GetAppliedReservationListOptionalParams,\n GetAppliedReservationListResponse,\n GetCatalogNextResponse\n} from \"./models/index.js\";\n\n/// <reference lib=\"esnext.asynciterable\" />\nexport class AzureReservationAPI extends coreClient.ServiceClient {\n $host: string;\n\n /**\n * Initializes a new instance of the AzureReservationAPI class.\n * @param credentials Subscription credentials which uniquely identify client subscription.\n * @param options The parameter options\n */\n constructor(\n credentials: coreAuth.TokenCredential,\n options?: AzureReservationAPIOptionalParams\n ) {\n if (credentials === undefined) {\n throw new Error(\"'credentials' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: AzureReservationAPIOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n credential: credentials\n };\n\n const packageDetails = `azsdk-js-arm-reservations/9.0.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n endpoint:\n options.endpoint ?? options.baseUri ?? \"https://management.azure.com\"\n };\n super(optionsWithDefaults);\n\n let bearerTokenAuthenticationPolicyFound: boolean = false;\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n }\n if (\n !options ||\n !options.pipeline ||\n options.pipeline.getOrderedPolicies().length == 0 ||\n !bearerTokenAuthenticationPolicyFound\n ) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n credential: credentials,\n scopes:\n optionsWithDefaults.credentialScopes ??\n `${optionsWithDefaults.endpoint}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n\n // Assigning values to Constant parameters\n this.$host = options.$host || \"https://management.azure.com\";\n this.reservation = new ReservationImpl(this);\n this.reservationOrder = new ReservationOrderImpl(this);\n this.operation = new OperationImpl(this);\n this.calculateRefund = new CalculateRefundImpl(this);\n this.return = new ReturnImpl(this);\n this.calculateExchange = new CalculateExchangeImpl(this);\n this.exchange = new ExchangeImpl(this);\n this.quota = new QuotaImpl(this);\n this.quotaRequestStatus = new QuotaRequestStatusImpl(this);\n }\n\n /**\n * Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n * @param subscriptionId Id of the subscription\n * @param options The options parameters.\n */\n public listCatalog(\n subscriptionId: string,\n options?: GetCatalogOptionalParams\n ): PagedAsyncIterableIterator<Catalog> {\n const iter = this.getCatalogPagingAll(subscriptionId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n if (settings?.maxPageSize) {\n throw new Error(\"maxPageSize is not supported by this operation.\");\n }\n return this.getCatalogPagingPage(subscriptionId, options, settings);\n }\n };\n }\n\n private async *getCatalogPagingPage(\n subscriptionId: string,\n options?: GetCatalogOptionalParams,\n settings?: PageSettings\n ): AsyncIterableIterator<Catalog[]> {\n let result: GetCatalogResponse;\n let continuationToken = settings?.continuationToken;\n if (!continuationToken) {\n result = await this._getCatalog(subscriptionId, options);\n let page = result.value || [];\n continuationToken = result.nextLink;\n setContinuationToken(page, continuationToken);\n yield page;\n }\n while (continuationToken) {\n result = await this._getCatalogNext(\n subscriptionId,\n continuationToken,\n options\n );\n continuationToken = result.nextLink;\n let page = result.value || [];\n setContinuationToken(page, continuationToken);\n yield page;\n }\n }\n\n private async *getCatalogPagingAll(\n subscriptionId: string,\n options?: GetCatalogOptionalParams\n ): AsyncIterableIterator<Catalog> {\n for await (const page of this.getCatalogPagingPage(\n subscriptionId,\n options\n )) {\n yield* page;\n }\n }\n\n /**\n * Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n * @param subscriptionId Id of the subscription\n * @param options The options parameters.\n */\n private _getCatalog(\n subscriptionId: string,\n options?: GetCatalogOptionalParams\n ): Promise<GetCatalogResponse> {\n return this.sendOperationRequest(\n { subscriptionId, options },\n getCatalogOperationSpec\n );\n }\n\n /**\n * Get applicable `Reservation`s that are applied to this subscription or a resource group under this\n * subscription.\n * @param subscriptionId Id of the subscription\n * @param options The options parameters.\n */\n getAppliedReservationList(\n subscriptionId: string,\n options?: GetAppliedReservationListOptionalParams\n ): Promise<GetAppliedReservationListResponse> {\n return this.sendOperationRequest(\n { subscriptionId, options },\n getAppliedReservationListOperationSpec\n );\n }\n\n /**\n * GetCatalogNext\n * @param subscriptionId Id of the subscription\n * @param nextLink The nextLink from the previous successful call to the GetCatalog method.\n * @param options The options parameters.\n */\n private _getCatalogNext(\n subscriptionId: string,\n nextLink: string,\n options?: GetCatalogNextOptionalParams\n ): Promise<GetCatalogNextResponse> {\n return this.sendOperationRequest(\n { subscriptionId, nextLink, options },\n getCatalogNextOperationSpec\n );\n }\n\n reservation: Reservation;\n reservationOrder: ReservationOrder;\n operation: Operation;\n calculateRefund: CalculateRefund;\n return: Return;\n calculateExchange: CalculateExchange;\n exchange: Exchange;\n quota: Quota;\n quotaRequestStatus: QuotaRequestStatus;\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getCatalogOperationSpec: coreClient.OperationSpec = {\n path: \"/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.CatalogsResult\n },\n default: {\n bodyMapper: Mappers.ErrorModel\n }\n },\n queryParameters: [\n Parameters.apiVersion,\n Parameters.filter,\n Parameters.reservedResourceType,\n Parameters.location,\n Parameters.publisherId,\n Parameters.offerId,\n Parameters.planId,\n Parameters.skip,\n Parameters.take1\n ],\n urlParameters: [Parameters.$host, Parameters.subscriptionId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getAppliedReservationListOperationSpec: coreClient.OperationSpec = {\n path:\n \"/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AppliedReservations\n },\n default: {\n bodyMapper: Mappers.ErrorModel\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.$host, Parameters.subscriptionId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst getCatalogNextOperationSpec: coreClient.OperationSpec = {\n path: \"{nextLink}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.CatalogsResult\n },\n default: {\n bodyMapper: Mappers.ErrorModel\n }\n },\n urlParameters: [\n Parameters.$host,\n Parameters.nextLink,\n Parameters.subscriptionId\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\n"]}
|
package/dist/commonjs/lroImpl.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLroSpec = createLroSpec;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
function createLroSpec(inputs) {
|
|
6
5
|
const { args, spec, sendOperationFn } = inputs;
|
|
7
6
|
return {
|
|
@@ -9,8 +8,13 @@ function createLroSpec(inputs) {
|
|
|
9
8
|
requestPath: spec.path,
|
|
10
9
|
sendInitialRequest: () => sendOperationFn(args, spec),
|
|
11
10
|
sendPollRequest: (path, options) => {
|
|
12
|
-
const { requestBody
|
|
13
|
-
return sendOperationFn(args,
|
|
11
|
+
const { requestBody, ...restSpec } = spec;
|
|
12
|
+
return sendOperationFn(args, {
|
|
13
|
+
...restSpec,
|
|
14
|
+
httpMethod: "GET",
|
|
15
|
+
path,
|
|
16
|
+
abortSignal: options?.abortSignal
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
19
|
};
|
|
16
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../src/lroImpl.ts"],"names":[],"mappings":";;AAUA,sCA2BC
|
|
1
|
+
{"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../src/lroImpl.ts"],"names":[],"mappings":";;AAUA,sCA2BC;AA3BD,SAAgB,aAAa,CAAI,MAQhC;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,UAAU;QAC9B,WAAW,EAAE,IAAI,CAAC,IAAK;QACvB,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrD,eAAe,EAAE,CACf,IAAY,EACZ,OAA2C,EAC3C,EAAE;YACF,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;YAC1C,OAAO,eAAe,CAAC,IAAI,EAAE;gBAC3B,GAAG,QAAQ;gBACX,UAAU,EAAE,KAAK;gBACjB,IAAI;gBACJ,WAAW,EAAE,OAAO,EAAE,WAAW;aAClC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport function createLroSpec<T>(inputs: {\n sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;\n args: Record<string, unknown>;\n spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>;\n}): LongRunningOperation<T> {\n const { args, spec, sendOperationFn } = inputs;\n return {\n requestMethod: spec.httpMethod,\n requestPath: spec.path!,\n sendInitialRequest: () => sendOperationFn(args, spec),\n sendPollRequest: (\n path: string,\n options?: { abortSignal?: AbortSignalLike }\n ) => {\n const { requestBody, ...restSpec } = spec;\n return sendOperationFn(args, {\n ...restSpec,\n httpMethod: \"GET\",\n path,\n abortSignal: options?.abortSignal\n });\n }\n };\n}\n"]}
|
|
@@ -3653,55 +3653,67 @@ exports.Commitment = {
|
|
|
3653
3653
|
type: {
|
|
3654
3654
|
name: "Composite",
|
|
3655
3655
|
className: "Commitment",
|
|
3656
|
-
modelProperties:
|
|
3656
|
+
modelProperties: {
|
|
3657
|
+
...exports.Price.type.modelProperties,
|
|
3658
|
+
grain: {
|
|
3657
3659
|
serializedName: "grain",
|
|
3658
3660
|
type: {
|
|
3659
3661
|
name: "String"
|
|
3660
3662
|
}
|
|
3661
|
-
}
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3662
3665
|
}
|
|
3663
3666
|
};
|
|
3664
3667
|
exports.ProxyResource = {
|
|
3665
3668
|
type: {
|
|
3666
3669
|
name: "Composite",
|
|
3667
3670
|
className: "ProxyResource",
|
|
3668
|
-
modelProperties:
|
|
3671
|
+
modelProperties: {
|
|
3672
|
+
...exports.Resource.type.modelProperties
|
|
3673
|
+
}
|
|
3669
3674
|
}
|
|
3670
3675
|
};
|
|
3671
3676
|
exports.ReservationResponse = {
|
|
3672
3677
|
type: {
|
|
3673
3678
|
name: "Composite",
|
|
3674
3679
|
className: "ReservationResponse",
|
|
3675
|
-
modelProperties:
|
|
3680
|
+
modelProperties: {
|
|
3681
|
+
...exports.ProxyResource.type.modelProperties,
|
|
3682
|
+
location: {
|
|
3676
3683
|
serializedName: "location",
|
|
3677
3684
|
type: {
|
|
3678
3685
|
name: "String"
|
|
3679
3686
|
}
|
|
3680
|
-
},
|
|
3687
|
+
},
|
|
3688
|
+
etag: {
|
|
3681
3689
|
serializedName: "etag",
|
|
3682
3690
|
type: {
|
|
3683
3691
|
name: "Number"
|
|
3684
3692
|
}
|
|
3685
|
-
},
|
|
3693
|
+
},
|
|
3694
|
+
sku: {
|
|
3686
3695
|
serializedName: "sku",
|
|
3687
3696
|
type: {
|
|
3688
3697
|
name: "Composite",
|
|
3689
3698
|
className: "SkuName"
|
|
3690
3699
|
}
|
|
3691
|
-
},
|
|
3700
|
+
},
|
|
3701
|
+
properties: {
|
|
3692
3702
|
serializedName: "properties",
|
|
3693
3703
|
type: {
|
|
3694
3704
|
name: "Composite",
|
|
3695
3705
|
className: "ReservationsProperties"
|
|
3696
3706
|
}
|
|
3697
|
-
},
|
|
3707
|
+
},
|
|
3708
|
+
kind: {
|
|
3698
3709
|
defaultValue: "Microsoft.Compute",
|
|
3699
3710
|
isConstant: true,
|
|
3700
3711
|
serializedName: "kind",
|
|
3701
3712
|
type: {
|
|
3702
3713
|
name: "String"
|
|
3703
3714
|
}
|
|
3704
|
-
}
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3705
3717
|
}
|
|
3706
3718
|
};
|
|
3707
3719
|
exports.ReservationSplitHeaders = {
|