oci-osubsubscription 2.12.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/LICENSE.txt +89 -0
- package/NOTICE.txt +1 -0
- package/README.md +22 -0
- package/THIRD_PARTY_LICENSES.txt +1521 -0
- package/index.d.ts +23 -0
- package/index.js +46 -0
- package/index.js.map +1 -0
- package/lib/client.d.ts +274 -0
- package/lib/client.js +681 -0
- package/lib/client.js.map +1 -0
- package/lib/model/commitment-detail.d.ts +59 -0
- package/lib/model/commitment-detail.js +30 -0
- package/lib/model/commitment-detail.js.map +1 -0
- package/lib/model/commitment-summary.d.ts +59 -0
- package/lib/model/commitment-summary.js +30 -0
- package/lib/model/commitment-summary.js.map +1 -0
- package/lib/model/commitment.d.ts +53 -0
- package/lib/model/commitment.js +30 -0
- package/lib/model/commitment.js.map +1 -0
- package/lib/model/currency.d.ts +38 -0
- package/lib/model/currency.js +30 -0
- package/lib/model/currency.js.map +1 -0
- package/lib/model/index.d.ts +33 -0
- package/lib/model/index.js +56 -0
- package/lib/model/index.js.map +1 -0
- package/lib/model/product.d.ts +53 -0
- package/lib/model/product.js +30 -0
- package/lib/model/product.js.map +1 -0
- package/lib/model/rate-card-summary.d.ts +61 -0
- package/lib/model/rate-card-summary.js +66 -0
- package/lib/model/rate-card-summary.js.map +1 -0
- package/lib/model/rate-card-tier.d.ts +38 -0
- package/lib/model/rate-card-tier.js +30 -0
- package/lib/model/rate-card-tier.js.map +1 -0
- package/lib/model/subscribed-service-summary.d.ts +131 -0
- package/lib/model/subscribed-service-summary.js +66 -0
- package/lib/model/subscribed-service-summary.js.map +1 -0
- package/lib/model/subscription-product.d.ts +43 -0
- package/lib/model/subscription-product.js +30 -0
- package/lib/model/subscription-product.js.map +1 -0
- package/lib/model/subscription-summary.d.ts +50 -0
- package/lib/model/subscription-summary.js +64 -0
- package/lib/model/subscription-summary.js.map +1 -0
- package/lib/request/get-commitment-request.d.ts +38 -0
- package/lib/request/get-commitment-request.js +15 -0
- package/lib/request/get-commitment-request.js.map +1 -0
- package/lib/request/index.d.ts +21 -0
- package/lib/request/index.js +42 -0
- package/lib/request/index.js.map +1 -0
- package/lib/request/list-commitments-request.d.ts +75 -0
- package/lib/request/list-commitments-request.js +29 -0
- package/lib/request/list-commitments-request.js.map +1 -0
- package/lib/request/list-rate-cards-request.d.ts +80 -0
- package/lib/request/list-rate-cards-request.js +29 -0
- package/lib/request/list-rate-cards-request.js.map +1 -0
- package/lib/request/list-subscriptions-request.d.ts +86 -0
- package/lib/request/list-subscriptions-request.js +29 -0
- package/lib/request/list-subscriptions-request.js.map +1 -0
- package/lib/response/get-commitment-response.d.ts +25 -0
- package/lib/response/get-commitment-response.js +15 -0
- package/lib/response/get-commitment-response.js.map +1 -0
- package/lib/response/index.d.ts +21 -0
- package/lib/response/index.js +16 -0
- package/lib/response/index.js.map +1 -0
- package/lib/response/list-commitments-response.d.ts +32 -0
- package/lib/response/list-commitments-response.js +15 -0
- package/lib/response/list-commitments-response.js.map +1 -0
- package/lib/response/list-rate-cards-response.d.ts +27 -0
- package/lib/response/list-rate-cards-response.js +15 -0
- package/lib/response/list-rate-cards-response.js.map +1 -0
- package/lib/response/list-subscriptions-response.d.ts +32 -0
- package/lib/response/list-subscriptions-response.js +15 -0
- package/lib/response/list-subscriptions-response.js.map +1 -0
- package/package.json +29 -0
package/lib/client.js
ADDED
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OneSubscription API Subscription, Commitment and and Rate Card Details
|
|
4
|
+
* Set of APIs that return the Subscription Details, Commitment and Effective Rate Card Details
|
|
5
|
+
|
|
6
|
+
* OpenAPI spec version: 20210501
|
|
7
|
+
* Contact: kuaskum_org_ww@oracle.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OracleSDKGenerator.
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
|
13
|
+
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
35
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
36
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
37
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
38
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
40
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.SubscriptionClient = exports.SubscriptionApiKeys = exports.RatecardClient = exports.RatecardApiKeys = exports.CommitmentClient = exports.CommitmentApiKeys = void 0;
|
|
45
|
+
const common = require("oci-common");
|
|
46
|
+
const model = __importStar(require("./model"));
|
|
47
|
+
const oci_common_1 = require("oci-common");
|
|
48
|
+
const oci_common_2 = require("oci-common");
|
|
49
|
+
// ===============================================
|
|
50
|
+
// This file is autogenerated - Please do not edit
|
|
51
|
+
// ===============================================
|
|
52
|
+
var CommitmentApiKeys;
|
|
53
|
+
(function (CommitmentApiKeys) {
|
|
54
|
+
})(CommitmentApiKeys = exports.CommitmentApiKeys || (exports.CommitmentApiKeys = {}));
|
|
55
|
+
/**
|
|
56
|
+
* This service client uses {@link common.CircuitBreaker.DefaultConfiguration} for all the operations by default if no circuit breaker configuration is defined by the user.
|
|
57
|
+
*/
|
|
58
|
+
class CommitmentClient {
|
|
59
|
+
constructor(params, clientConfiguration) {
|
|
60
|
+
this["_endpoint"] = "";
|
|
61
|
+
this["_defaultHeaders"] = {};
|
|
62
|
+
this._circuitBreaker = null;
|
|
63
|
+
const requestSigner = params.authenticationDetailsProvider
|
|
64
|
+
? new common.DefaultRequestSigner(params.authenticationDetailsProvider)
|
|
65
|
+
: null;
|
|
66
|
+
if (clientConfiguration) {
|
|
67
|
+
this._clientConfiguration = clientConfiguration;
|
|
68
|
+
this._circuitBreaker = clientConfiguration.circuitBreaker
|
|
69
|
+
? clientConfiguration.circuitBreaker.circuit
|
|
70
|
+
: null;
|
|
71
|
+
}
|
|
72
|
+
// if circuit breaker is not created, check if circuit breaker system is enabled to use default circuit breaker
|
|
73
|
+
const specCircuitBreakerEnabled = true;
|
|
74
|
+
if (!this._circuitBreaker &&
|
|
75
|
+
common.utils.isCircuitBreakerSystemEnabled(clientConfiguration) &&
|
|
76
|
+
(specCircuitBreakerEnabled || common.CircuitBreaker.DefaultCircuitBreakerOverriden)) {
|
|
77
|
+
this._circuitBreaker = new common.CircuitBreaker().circuit;
|
|
78
|
+
}
|
|
79
|
+
this._httpClient =
|
|
80
|
+
params.httpClient || new common.FetchHttpClient(requestSigner, this._circuitBreaker);
|
|
81
|
+
if (params.authenticationDetailsProvider &&
|
|
82
|
+
common.isRegionProvider(params.authenticationDetailsProvider)) {
|
|
83
|
+
const provider = params.authenticationDetailsProvider;
|
|
84
|
+
if (provider.getRegion()) {
|
|
85
|
+
this.region = provider.getRegion();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the endpoint that is being used to call (ex, https://www.example.com).
|
|
91
|
+
*/
|
|
92
|
+
get endpoint() {
|
|
93
|
+
return this._endpoint;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Sets the endpoint to call (ex, https://www.example.com).
|
|
97
|
+
* @param endpoint The endpoint of the service.
|
|
98
|
+
*/
|
|
99
|
+
set endpoint(endpoint) {
|
|
100
|
+
this._endpoint = endpoint;
|
|
101
|
+
this._endpoint = this._endpoint + "/oalapp/service/onesubs/proxy/20210501";
|
|
102
|
+
if (this.logger)
|
|
103
|
+
this.logger.info(`CommitmentClient endpoint set to ${this._endpoint}`);
|
|
104
|
+
}
|
|
105
|
+
get logger() {
|
|
106
|
+
return common.LOG.logger;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Sets the region to call (ex, Region.US_PHOENIX_1).
|
|
110
|
+
* Note, this will call {@link #endpoint(String) endpoint} after resolving the endpoint.
|
|
111
|
+
* @param region The region of the service.
|
|
112
|
+
*/
|
|
113
|
+
set region(region) {
|
|
114
|
+
this.endpoint = common.EndpointBuilder.createEndpointFromRegion(CommitmentClient.serviceEndpointTemplate, region);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sets the regionId to call (ex, 'us-phoenix-1').
|
|
118
|
+
*
|
|
119
|
+
* Note, this will first try to map the region ID to a known Region and call {@link #region(Region) region}.
|
|
120
|
+
* If no known Region could be determined, it will create an endpoint assuming its in default Realm OC1
|
|
121
|
+
* and then call {@link #endpoint(String) endpoint}.
|
|
122
|
+
* @param regionId The public region ID.
|
|
123
|
+
*/
|
|
124
|
+
set regionId(regionId) {
|
|
125
|
+
this.endpoint = common.EndpointBuilder.createEndpointFromRegionId(CommitmentClient.serviceEndpointTemplate, regionId);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* This API returns the commitment details corresponding to the id provided
|
|
129
|
+
*
|
|
130
|
+
* This operation does not retry by default if the user has not defined a retry configuration.
|
|
131
|
+
* @param GetCommitmentRequest
|
|
132
|
+
* @return GetCommitmentResponse
|
|
133
|
+
* @throws OciError when an error occurs
|
|
134
|
+
* @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/2.12.0/osubsubscription/GetCommitment.ts.html |here} to see how to use GetCommitment API.
|
|
135
|
+
*/
|
|
136
|
+
getCommitment(getCommitmentRequest) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
if (this.logger)
|
|
139
|
+
this.logger.debug("Calling operation CommitmentClient#getCommitment.");
|
|
140
|
+
const pathParams = {
|
|
141
|
+
"{commitmentId}": getCommitmentRequest.commitmentId
|
|
142
|
+
};
|
|
143
|
+
const queryParams = {};
|
|
144
|
+
let headerParams = {
|
|
145
|
+
"Content-Type": common.Constants.APPLICATION_JSON,
|
|
146
|
+
"opc-request-id": getCommitmentRequest.opcRequestId,
|
|
147
|
+
"x-one-gateway-subscription-id": getCommitmentRequest.xOneGatewaySubscriptionId,
|
|
148
|
+
"x-one-origin-region": getCommitmentRequest.xOneOriginRegion
|
|
149
|
+
};
|
|
150
|
+
const specRetryConfiguration = common.NoRetryConfigurationDetails;
|
|
151
|
+
const retrier = oci_common_2.GenericRetrier.createPreferredRetrier(this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, getCommitmentRequest.retryConfiguration, specRetryConfiguration);
|
|
152
|
+
if (this.logger)
|
|
153
|
+
retrier.logger = this.logger;
|
|
154
|
+
const request = yield oci_common_2.composeRequest({
|
|
155
|
+
baseEndpoint: this._endpoint,
|
|
156
|
+
defaultHeaders: this._defaultHeaders,
|
|
157
|
+
path: "/commitments/{commitmentId}",
|
|
158
|
+
method: "GET",
|
|
159
|
+
pathParams: pathParams,
|
|
160
|
+
headerParams: headerParams,
|
|
161
|
+
queryParams: queryParams
|
|
162
|
+
});
|
|
163
|
+
try {
|
|
164
|
+
const response = yield retrier.makeServiceCall(this._httpClient, request);
|
|
165
|
+
const sdkResponse = oci_common_2.composeResponse({
|
|
166
|
+
responseObject: {},
|
|
167
|
+
body: yield response.json(),
|
|
168
|
+
bodyKey: "commitmentDetail",
|
|
169
|
+
bodyModel: model.CommitmentDetail,
|
|
170
|
+
type: "model.CommitmentDetail",
|
|
171
|
+
responseHeaders: [
|
|
172
|
+
{
|
|
173
|
+
value: response.headers.get("opc-request-id"),
|
|
174
|
+
key: "opcRequestId",
|
|
175
|
+
dataType: "string"
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
return sdkResponse;
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
throw err;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* This list API returns all commitments for a particular Subscribed Service
|
|
188
|
+
*
|
|
189
|
+
* This operation does not retry by default if the user has not defined a retry configuration.
|
|
190
|
+
* @param ListCommitmentsRequest
|
|
191
|
+
* @return ListCommitmentsResponse
|
|
192
|
+
* @throws OciError when an error occurs
|
|
193
|
+
* @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/2.12.0/osubsubscription/ListCommitments.ts.html |here} to see how to use ListCommitments API.
|
|
194
|
+
*/
|
|
195
|
+
listCommitments(listCommitmentsRequest) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
if (this.logger)
|
|
198
|
+
this.logger.debug("Calling operation CommitmentClient#listCommitments.");
|
|
199
|
+
const pathParams = {};
|
|
200
|
+
const queryParams = {
|
|
201
|
+
"subscribedServiceId": listCommitmentsRequest.subscribedServiceId,
|
|
202
|
+
"compartmentId": listCommitmentsRequest.compartmentId,
|
|
203
|
+
"limit": listCommitmentsRequest.limit,
|
|
204
|
+
"page": listCommitmentsRequest.page,
|
|
205
|
+
"sortOrder": listCommitmentsRequest.sortOrder,
|
|
206
|
+
"sortBy": listCommitmentsRequest.sortBy
|
|
207
|
+
};
|
|
208
|
+
let headerParams = {
|
|
209
|
+
"Content-Type": common.Constants.APPLICATION_JSON,
|
|
210
|
+
"opc-request-id": listCommitmentsRequest.opcRequestId,
|
|
211
|
+
"x-one-gateway-subscription-id": listCommitmentsRequest.xOneGatewaySubscriptionId,
|
|
212
|
+
"x-one-origin-region": listCommitmentsRequest.xOneOriginRegion
|
|
213
|
+
};
|
|
214
|
+
const specRetryConfiguration = common.NoRetryConfigurationDetails;
|
|
215
|
+
const retrier = oci_common_2.GenericRetrier.createPreferredRetrier(this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, listCommitmentsRequest.retryConfiguration, specRetryConfiguration);
|
|
216
|
+
if (this.logger)
|
|
217
|
+
retrier.logger = this.logger;
|
|
218
|
+
const request = yield oci_common_2.composeRequest({
|
|
219
|
+
baseEndpoint: this._endpoint,
|
|
220
|
+
defaultHeaders: this._defaultHeaders,
|
|
221
|
+
path: "/commitments",
|
|
222
|
+
method: "GET",
|
|
223
|
+
pathParams: pathParams,
|
|
224
|
+
headerParams: headerParams,
|
|
225
|
+
queryParams: queryParams
|
|
226
|
+
});
|
|
227
|
+
try {
|
|
228
|
+
const response = yield retrier.makeServiceCall(this._httpClient, request);
|
|
229
|
+
const sdkResponse = oci_common_2.composeResponse({
|
|
230
|
+
responseObject: {},
|
|
231
|
+
body: yield response.json(),
|
|
232
|
+
bodyKey: "items",
|
|
233
|
+
bodyModel: model.CommitmentSummary,
|
|
234
|
+
type: "Array<model.CommitmentSummary>",
|
|
235
|
+
responseHeaders: [
|
|
236
|
+
{
|
|
237
|
+
value: response.headers.get("opc-next-page"),
|
|
238
|
+
key: "opcNextPage",
|
|
239
|
+
dataType: "string"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
value: response.headers.get("opc-request-id"),
|
|
243
|
+
key: "opcRequestId",
|
|
244
|
+
dataType: "string"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
});
|
|
248
|
+
return sdkResponse;
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
throw err;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* NOTE: This function is deprecated in favor of listCommitmentsRecordIterator function.
|
|
257
|
+
* Creates a new async iterator which will iterate over the models.CommitmentSummary objects
|
|
258
|
+
* contained in responses from the listCommitments operation. This iterator will fetch more data from the
|
|
259
|
+
* server as needed.
|
|
260
|
+
*
|
|
261
|
+
* @param request a request which can be sent to the service operation
|
|
262
|
+
*/
|
|
263
|
+
listAllCommitments(request) {
|
|
264
|
+
return oci_common_1.paginateRecords(request, req => this.listCommitments(req));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* NOTE: This function is deprecated in favor of listCommitmentsResponseIterator function.
|
|
268
|
+
* Creates a new async iterator which will iterate over the responses received from the listCommitments operation. This iterator
|
|
269
|
+
* will fetch more data from the server as needed.
|
|
270
|
+
*
|
|
271
|
+
* @param request a request which can be sent to the service operation
|
|
272
|
+
*/
|
|
273
|
+
listAllCommitmentsResponses(request) {
|
|
274
|
+
return oci_common_1.paginateResponses(request, req => this.listCommitments(req));
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Creates a new async iterator which will iterate over the models.CommitmentSummary objects
|
|
278
|
+
* contained in responses from the listCommitments operation. This iterator will fetch more data from the
|
|
279
|
+
* server as needed.
|
|
280
|
+
*
|
|
281
|
+
* @param request a request which can be sent to the service operation
|
|
282
|
+
*/
|
|
283
|
+
listCommitmentsRecordIterator(request) {
|
|
284
|
+
return oci_common_1.paginateRecords(request, req => this.listCommitments(req));
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Creates a new async iterator which will iterate over the responses received from the listCommitments operation. This iterator
|
|
288
|
+
* will fetch more data from the server as needed.
|
|
289
|
+
*
|
|
290
|
+
* @param request a request which can be sent to the service operation
|
|
291
|
+
*/
|
|
292
|
+
listCommitmentsResponseIterator(request) {
|
|
293
|
+
return oci_common_1.paginateResponses(request, req => this.listCommitments(req));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
exports.CommitmentClient = CommitmentClient;
|
|
297
|
+
CommitmentClient.serviceEndpointTemplate = "https://csaap-e.oracle.com";
|
|
298
|
+
var RatecardApiKeys;
|
|
299
|
+
(function (RatecardApiKeys) {
|
|
300
|
+
})(RatecardApiKeys = exports.RatecardApiKeys || (exports.RatecardApiKeys = {}));
|
|
301
|
+
/**
|
|
302
|
+
* This service client uses {@link common.CircuitBreaker.DefaultConfiguration} for all the operations by default if no circuit breaker configuration is defined by the user.
|
|
303
|
+
*/
|
|
304
|
+
class RatecardClient {
|
|
305
|
+
constructor(params, clientConfiguration) {
|
|
306
|
+
this["_endpoint"] = "";
|
|
307
|
+
this["_defaultHeaders"] = {};
|
|
308
|
+
this._circuitBreaker = null;
|
|
309
|
+
const requestSigner = params.authenticationDetailsProvider
|
|
310
|
+
? new common.DefaultRequestSigner(params.authenticationDetailsProvider)
|
|
311
|
+
: null;
|
|
312
|
+
if (clientConfiguration) {
|
|
313
|
+
this._clientConfiguration = clientConfiguration;
|
|
314
|
+
this._circuitBreaker = clientConfiguration.circuitBreaker
|
|
315
|
+
? clientConfiguration.circuitBreaker.circuit
|
|
316
|
+
: null;
|
|
317
|
+
}
|
|
318
|
+
// if circuit breaker is not created, check if circuit breaker system is enabled to use default circuit breaker
|
|
319
|
+
const specCircuitBreakerEnabled = true;
|
|
320
|
+
if (!this._circuitBreaker &&
|
|
321
|
+
common.utils.isCircuitBreakerSystemEnabled(clientConfiguration) &&
|
|
322
|
+
(specCircuitBreakerEnabled || common.CircuitBreaker.DefaultCircuitBreakerOverriden)) {
|
|
323
|
+
this._circuitBreaker = new common.CircuitBreaker().circuit;
|
|
324
|
+
}
|
|
325
|
+
this._httpClient =
|
|
326
|
+
params.httpClient || new common.FetchHttpClient(requestSigner, this._circuitBreaker);
|
|
327
|
+
if (params.authenticationDetailsProvider &&
|
|
328
|
+
common.isRegionProvider(params.authenticationDetailsProvider)) {
|
|
329
|
+
const provider = params.authenticationDetailsProvider;
|
|
330
|
+
if (provider.getRegion()) {
|
|
331
|
+
this.region = provider.getRegion();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Get the endpoint that is being used to call (ex, https://www.example.com).
|
|
337
|
+
*/
|
|
338
|
+
get endpoint() {
|
|
339
|
+
return this._endpoint;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Sets the endpoint to call (ex, https://www.example.com).
|
|
343
|
+
* @param endpoint The endpoint of the service.
|
|
344
|
+
*/
|
|
345
|
+
set endpoint(endpoint) {
|
|
346
|
+
this._endpoint = endpoint;
|
|
347
|
+
this._endpoint = this._endpoint + "/oalapp/service/onesubs/proxy/20210501";
|
|
348
|
+
if (this.logger)
|
|
349
|
+
this.logger.info(`RatecardClient endpoint set to ${this._endpoint}`);
|
|
350
|
+
}
|
|
351
|
+
get logger() {
|
|
352
|
+
return common.LOG.logger;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Sets the region to call (ex, Region.US_PHOENIX_1).
|
|
356
|
+
* Note, this will call {@link #endpoint(String) endpoint} after resolving the endpoint.
|
|
357
|
+
* @param region The region of the service.
|
|
358
|
+
*/
|
|
359
|
+
set region(region) {
|
|
360
|
+
this.endpoint = common.EndpointBuilder.createEndpointFromRegion(RatecardClient.serviceEndpointTemplate, region);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Sets the regionId to call (ex, 'us-phoenix-1').
|
|
364
|
+
*
|
|
365
|
+
* Note, this will first try to map the region ID to a known Region and call {@link #region(Region) region}.
|
|
366
|
+
* If no known Region could be determined, it will create an endpoint assuming its in default Realm OC1
|
|
367
|
+
* and then call {@link #endpoint(String) endpoint}.
|
|
368
|
+
* @param regionId The public region ID.
|
|
369
|
+
*/
|
|
370
|
+
set regionId(regionId) {
|
|
371
|
+
this.endpoint = common.EndpointBuilder.createEndpointFromRegionId(RatecardClient.serviceEndpointTemplate, regionId);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* List API that returns all ratecards for given Subscription Id and Account ID (if provided) and
|
|
375
|
+
* for a particular date range
|
|
376
|
+
*
|
|
377
|
+
* This operation does not retry by default if the user has not defined a retry configuration.
|
|
378
|
+
* @param ListRateCardsRequest
|
|
379
|
+
* @return ListRateCardsResponse
|
|
380
|
+
* @throws OciError when an error occurs
|
|
381
|
+
* @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/2.12.0/osubsubscription/ListRateCards.ts.html |here} to see how to use ListRateCards API.
|
|
382
|
+
*/
|
|
383
|
+
listRateCards(listRateCardsRequest) {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
if (this.logger)
|
|
386
|
+
this.logger.debug("Calling operation RatecardClient#listRateCards.");
|
|
387
|
+
const pathParams = {};
|
|
388
|
+
const queryParams = {
|
|
389
|
+
"subscriptionId": listRateCardsRequest.subscriptionId,
|
|
390
|
+
"timeFrom": listRateCardsRequest.timeFrom,
|
|
391
|
+
"timeTo": listRateCardsRequest.timeTo,
|
|
392
|
+
"partNumber": listRateCardsRequest.partNumber,
|
|
393
|
+
"limit": listRateCardsRequest.limit,
|
|
394
|
+
"page": listRateCardsRequest.page,
|
|
395
|
+
"sortOrder": listRateCardsRequest.sortOrder,
|
|
396
|
+
"sortBy": listRateCardsRequest.sortBy,
|
|
397
|
+
"compartmentId": listRateCardsRequest.compartmentId
|
|
398
|
+
};
|
|
399
|
+
let headerParams = {
|
|
400
|
+
"Content-Type": common.Constants.APPLICATION_JSON,
|
|
401
|
+
"opc-request-id": listRateCardsRequest.opcRequestId,
|
|
402
|
+
"x-one-origin-region": listRateCardsRequest.xOneOriginRegion
|
|
403
|
+
};
|
|
404
|
+
const specRetryConfiguration = common.NoRetryConfigurationDetails;
|
|
405
|
+
const retrier = oci_common_2.GenericRetrier.createPreferredRetrier(this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, listRateCardsRequest.retryConfiguration, specRetryConfiguration);
|
|
406
|
+
if (this.logger)
|
|
407
|
+
retrier.logger = this.logger;
|
|
408
|
+
const request = yield oci_common_2.composeRequest({
|
|
409
|
+
baseEndpoint: this._endpoint,
|
|
410
|
+
defaultHeaders: this._defaultHeaders,
|
|
411
|
+
path: "/ratecards",
|
|
412
|
+
method: "GET",
|
|
413
|
+
pathParams: pathParams,
|
|
414
|
+
headerParams: headerParams,
|
|
415
|
+
queryParams: queryParams
|
|
416
|
+
});
|
|
417
|
+
try {
|
|
418
|
+
const response = yield retrier.makeServiceCall(this._httpClient, request);
|
|
419
|
+
const sdkResponse = oci_common_2.composeResponse({
|
|
420
|
+
responseObject: {},
|
|
421
|
+
body: yield response.json(),
|
|
422
|
+
bodyKey: "items",
|
|
423
|
+
bodyModel: model.RateCardSummary,
|
|
424
|
+
type: "Array<model.RateCardSummary>",
|
|
425
|
+
responseHeaders: [
|
|
426
|
+
{
|
|
427
|
+
value: response.headers.get("opc-next-page"),
|
|
428
|
+
key: "opcNextPage",
|
|
429
|
+
dataType: "string"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
value: response.headers.get("opc-request-id"),
|
|
433
|
+
key: "opcRequestId",
|
|
434
|
+
dataType: "string"
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
});
|
|
438
|
+
return sdkResponse;
|
|
439
|
+
}
|
|
440
|
+
catch (err) {
|
|
441
|
+
throw err;
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* NOTE: This function is deprecated in favor of listRateCardsRecordIterator function.
|
|
447
|
+
* Creates a new async iterator which will iterate over the models.RateCardSummary objects
|
|
448
|
+
* contained in responses from the listRateCards operation. This iterator will fetch more data from the
|
|
449
|
+
* server as needed.
|
|
450
|
+
*
|
|
451
|
+
* @param request a request which can be sent to the service operation
|
|
452
|
+
*/
|
|
453
|
+
listAllRateCards(request) {
|
|
454
|
+
return oci_common_1.paginateRecords(request, req => this.listRateCards(req));
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* NOTE: This function is deprecated in favor of listRateCardsResponseIterator function.
|
|
458
|
+
* Creates a new async iterator which will iterate over the responses received from the listRateCards operation. This iterator
|
|
459
|
+
* will fetch more data from the server as needed.
|
|
460
|
+
*
|
|
461
|
+
* @param request a request which can be sent to the service operation
|
|
462
|
+
*/
|
|
463
|
+
listAllRateCardsResponses(request) {
|
|
464
|
+
return oci_common_1.paginateResponses(request, req => this.listRateCards(req));
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Creates a new async iterator which will iterate over the models.RateCardSummary objects
|
|
468
|
+
* contained in responses from the listRateCards operation. This iterator will fetch more data from the
|
|
469
|
+
* server as needed.
|
|
470
|
+
*
|
|
471
|
+
* @param request a request which can be sent to the service operation
|
|
472
|
+
*/
|
|
473
|
+
listRateCardsRecordIterator(request) {
|
|
474
|
+
return oci_common_1.paginateRecords(request, req => this.listRateCards(req));
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Creates a new async iterator which will iterate over the responses received from the listRateCards operation. This iterator
|
|
478
|
+
* will fetch more data from the server as needed.
|
|
479
|
+
*
|
|
480
|
+
* @param request a request which can be sent to the service operation
|
|
481
|
+
*/
|
|
482
|
+
listRateCardsResponseIterator(request) {
|
|
483
|
+
return oci_common_1.paginateResponses(request, req => this.listRateCards(req));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
exports.RatecardClient = RatecardClient;
|
|
487
|
+
RatecardClient.serviceEndpointTemplate = "https://csaap-e.oracle.com";
|
|
488
|
+
var SubscriptionApiKeys;
|
|
489
|
+
(function (SubscriptionApiKeys) {
|
|
490
|
+
})(SubscriptionApiKeys = exports.SubscriptionApiKeys || (exports.SubscriptionApiKeys = {}));
|
|
491
|
+
/**
|
|
492
|
+
* This service client uses {@link common.CircuitBreaker.DefaultConfiguration} for all the operations by default if no circuit breaker configuration is defined by the user.
|
|
493
|
+
*/
|
|
494
|
+
class SubscriptionClient {
|
|
495
|
+
constructor(params, clientConfiguration) {
|
|
496
|
+
this["_endpoint"] = "";
|
|
497
|
+
this["_defaultHeaders"] = {};
|
|
498
|
+
this._circuitBreaker = null;
|
|
499
|
+
const requestSigner = params.authenticationDetailsProvider
|
|
500
|
+
? new common.DefaultRequestSigner(params.authenticationDetailsProvider)
|
|
501
|
+
: null;
|
|
502
|
+
if (clientConfiguration) {
|
|
503
|
+
this._clientConfiguration = clientConfiguration;
|
|
504
|
+
this._circuitBreaker = clientConfiguration.circuitBreaker
|
|
505
|
+
? clientConfiguration.circuitBreaker.circuit
|
|
506
|
+
: null;
|
|
507
|
+
}
|
|
508
|
+
// if circuit breaker is not created, check if circuit breaker system is enabled to use default circuit breaker
|
|
509
|
+
const specCircuitBreakerEnabled = true;
|
|
510
|
+
if (!this._circuitBreaker &&
|
|
511
|
+
common.utils.isCircuitBreakerSystemEnabled(clientConfiguration) &&
|
|
512
|
+
(specCircuitBreakerEnabled || common.CircuitBreaker.DefaultCircuitBreakerOverriden)) {
|
|
513
|
+
this._circuitBreaker = new common.CircuitBreaker().circuit;
|
|
514
|
+
}
|
|
515
|
+
this._httpClient =
|
|
516
|
+
params.httpClient || new common.FetchHttpClient(requestSigner, this._circuitBreaker);
|
|
517
|
+
if (params.authenticationDetailsProvider &&
|
|
518
|
+
common.isRegionProvider(params.authenticationDetailsProvider)) {
|
|
519
|
+
const provider = params.authenticationDetailsProvider;
|
|
520
|
+
if (provider.getRegion()) {
|
|
521
|
+
this.region = provider.getRegion();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Get the endpoint that is being used to call (ex, https://www.example.com).
|
|
527
|
+
*/
|
|
528
|
+
get endpoint() {
|
|
529
|
+
return this._endpoint;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Sets the endpoint to call (ex, https://www.example.com).
|
|
533
|
+
* @param endpoint The endpoint of the service.
|
|
534
|
+
*/
|
|
535
|
+
set endpoint(endpoint) {
|
|
536
|
+
this._endpoint = endpoint;
|
|
537
|
+
this._endpoint = this._endpoint + "/oalapp/service/onesubs/proxy/20210501";
|
|
538
|
+
if (this.logger)
|
|
539
|
+
this.logger.info(`SubscriptionClient endpoint set to ${this._endpoint}`);
|
|
540
|
+
}
|
|
541
|
+
get logger() {
|
|
542
|
+
return common.LOG.logger;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Sets the region to call (ex, Region.US_PHOENIX_1).
|
|
546
|
+
* Note, this will call {@link #endpoint(String) endpoint} after resolving the endpoint.
|
|
547
|
+
* @param region The region of the service.
|
|
548
|
+
*/
|
|
549
|
+
set region(region) {
|
|
550
|
+
this.endpoint = common.EndpointBuilder.createEndpointFromRegion(SubscriptionClient.serviceEndpointTemplate, region);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Sets the regionId to call (ex, 'us-phoenix-1').
|
|
554
|
+
*
|
|
555
|
+
* Note, this will first try to map the region ID to a known Region and call {@link #region(Region) region}.
|
|
556
|
+
* If no known Region could be determined, it will create an endpoint assuming its in default Realm OC1
|
|
557
|
+
* and then call {@link #endpoint(String) endpoint}.
|
|
558
|
+
* @param regionId The public region ID.
|
|
559
|
+
*/
|
|
560
|
+
set regionId(regionId) {
|
|
561
|
+
this.endpoint = common.EndpointBuilder.createEndpointFromRegionId(SubscriptionClient.serviceEndpointTemplate, regionId);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* This list API returns all subscriptions for a given plan number or subscription id or buyer email
|
|
565
|
+
* and provides additional parameters to include ratecard and commitment details.
|
|
566
|
+
* This API expects exactly one of the above mentioned parameters as input. If more than one parameters are provided the API will throw
|
|
567
|
+
* a 400 - invalid parameters exception and if no parameters are provided it will throw a 400 - missing parameter exception
|
|
568
|
+
*
|
|
569
|
+
* This operation does not retry by default if the user has not defined a retry configuration.
|
|
570
|
+
* @param ListSubscriptionsRequest
|
|
571
|
+
* @return ListSubscriptionsResponse
|
|
572
|
+
* @throws OciError when an error occurs
|
|
573
|
+
* @example Click {@link https://docs.cloud.oracle.com/en-us/iaas/tools/typescript-sdk-examples/2.12.0/osubsubscription/ListSubscriptions.ts.html |here} to see how to use ListSubscriptions API.
|
|
574
|
+
*/
|
|
575
|
+
listSubscriptions(listSubscriptionsRequest) {
|
|
576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
577
|
+
if (this.logger)
|
|
578
|
+
this.logger.debug("Calling operation SubscriptionClient#listSubscriptions.");
|
|
579
|
+
const pathParams = {};
|
|
580
|
+
const queryParams = {
|
|
581
|
+
"compartmentId": listSubscriptionsRequest.compartmentId,
|
|
582
|
+
"planNumber": listSubscriptionsRequest.planNumber,
|
|
583
|
+
"subscriptionId": listSubscriptionsRequest.subscriptionId,
|
|
584
|
+
"buyerEmail": listSubscriptionsRequest.buyerEmail,
|
|
585
|
+
"isCommitInfoRequired": listSubscriptionsRequest.isCommitInfoRequired,
|
|
586
|
+
"limit": listSubscriptionsRequest.limit,
|
|
587
|
+
"page": listSubscriptionsRequest.page,
|
|
588
|
+
"sortOrder": listSubscriptionsRequest.sortOrder,
|
|
589
|
+
"sortBy": listSubscriptionsRequest.sortBy
|
|
590
|
+
};
|
|
591
|
+
let headerParams = {
|
|
592
|
+
"Content-Type": common.Constants.APPLICATION_JSON,
|
|
593
|
+
"opc-request-id": listSubscriptionsRequest.opcRequestId,
|
|
594
|
+
"x-one-gateway-subscription-id": listSubscriptionsRequest.xOneGatewaySubscriptionId,
|
|
595
|
+
"x-one-origin-region": listSubscriptionsRequest.xOneOriginRegion
|
|
596
|
+
};
|
|
597
|
+
const specRetryConfiguration = common.NoRetryConfigurationDetails;
|
|
598
|
+
const retrier = oci_common_2.GenericRetrier.createPreferredRetrier(this._clientConfiguration ? this._clientConfiguration.retryConfiguration : undefined, listSubscriptionsRequest.retryConfiguration, specRetryConfiguration);
|
|
599
|
+
if (this.logger)
|
|
600
|
+
retrier.logger = this.logger;
|
|
601
|
+
const request = yield oci_common_2.composeRequest({
|
|
602
|
+
baseEndpoint: this._endpoint,
|
|
603
|
+
defaultHeaders: this._defaultHeaders,
|
|
604
|
+
path: "/subscriptions",
|
|
605
|
+
method: "GET",
|
|
606
|
+
pathParams: pathParams,
|
|
607
|
+
headerParams: headerParams,
|
|
608
|
+
queryParams: queryParams
|
|
609
|
+
});
|
|
610
|
+
try {
|
|
611
|
+
const response = yield retrier.makeServiceCall(this._httpClient, request);
|
|
612
|
+
const sdkResponse = oci_common_2.composeResponse({
|
|
613
|
+
responseObject: {},
|
|
614
|
+
body: yield response.json(),
|
|
615
|
+
bodyKey: "items",
|
|
616
|
+
bodyModel: model.SubscriptionSummary,
|
|
617
|
+
type: "Array<model.SubscriptionSummary>",
|
|
618
|
+
responseHeaders: [
|
|
619
|
+
{
|
|
620
|
+
value: response.headers.get("opc-next-page"),
|
|
621
|
+
key: "opcNextPage",
|
|
622
|
+
dataType: "string"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
value: response.headers.get("opc-request-id"),
|
|
626
|
+
key: "opcRequestId",
|
|
627
|
+
dataType: "string"
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
});
|
|
631
|
+
return sdkResponse;
|
|
632
|
+
}
|
|
633
|
+
catch (err) {
|
|
634
|
+
throw err;
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* NOTE: This function is deprecated in favor of listSubscriptionsRecordIterator function.
|
|
640
|
+
* Creates a new async iterator which will iterate over the models.SubscriptionSummary objects
|
|
641
|
+
* contained in responses from the listSubscriptions operation. This iterator will fetch more data from the
|
|
642
|
+
* server as needed.
|
|
643
|
+
*
|
|
644
|
+
* @param request a request which can be sent to the service operation
|
|
645
|
+
*/
|
|
646
|
+
listAllSubscriptions(request) {
|
|
647
|
+
return oci_common_1.paginateRecords(request, req => this.listSubscriptions(req));
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* NOTE: This function is deprecated in favor of listSubscriptionsResponseIterator function.
|
|
651
|
+
* Creates a new async iterator which will iterate over the responses received from the listSubscriptions operation. This iterator
|
|
652
|
+
* will fetch more data from the server as needed.
|
|
653
|
+
*
|
|
654
|
+
* @param request a request which can be sent to the service operation
|
|
655
|
+
*/
|
|
656
|
+
listAllSubscriptionsResponses(request) {
|
|
657
|
+
return oci_common_1.paginateResponses(request, req => this.listSubscriptions(req));
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Creates a new async iterator which will iterate over the models.SubscriptionSummary objects
|
|
661
|
+
* contained in responses from the listSubscriptions operation. This iterator will fetch more data from the
|
|
662
|
+
* server as needed.
|
|
663
|
+
*
|
|
664
|
+
* @param request a request which can be sent to the service operation
|
|
665
|
+
*/
|
|
666
|
+
listSubscriptionsRecordIterator(request) {
|
|
667
|
+
return oci_common_1.paginateRecords(request, req => this.listSubscriptions(req));
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Creates a new async iterator which will iterate over the responses received from the listSubscriptions operation. This iterator
|
|
671
|
+
* will fetch more data from the server as needed.
|
|
672
|
+
*
|
|
673
|
+
* @param request a request which can be sent to the service operation
|
|
674
|
+
*/
|
|
675
|
+
listSubscriptionsResponseIterator(request) {
|
|
676
|
+
return oci_common_1.paginateResponses(request, req => this.listSubscriptions(req));
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
exports.SubscriptionClient = SubscriptionClient;
|
|
680
|
+
SubscriptionClient.serviceEndpointTemplate = "https://csaap-e.oracle.com";
|
|
681
|
+
//# sourceMappingURL=client.js.map
|