@ibm-cloud/secrets-manager 1.0.44 → 2.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/.releaserc +4 -1
- package/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/examples/secrets-manager.v2.test.js +1244 -0
- package/package.json +2 -2
- package/secrets-manager/v2.d.ts +5937 -0
- package/secrets-manager/v2.js +2371 -0
- package/secrets-manager/v2.js.map +1 -0
|
@@ -0,0 +1,2371 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* (C) Copyright IBM Corp. 2023.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __extends = (this && this.__extends) || (function () {
|
|
18
|
+
var extendStatics = function (d, b) {
|
|
19
|
+
extendStatics = Object.setPrototypeOf ||
|
|
20
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
21
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
22
|
+
return extendStatics(d, b);
|
|
23
|
+
};
|
|
24
|
+
return function (d, b) {
|
|
25
|
+
if (typeof b !== "function" && b !== null)
|
|
26
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
27
|
+
extendStatics(d, b);
|
|
28
|
+
function __() { this.constructor = d; }
|
|
29
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
+
};
|
|
31
|
+
})();
|
|
32
|
+
var __assign = (this && this.__assign) || function () {
|
|
33
|
+
__assign = Object.assign || function(t) {
|
|
34
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
+
s = arguments[i];
|
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
37
|
+
t[p] = s[p];
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
};
|
|
41
|
+
return __assign.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
44
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
53
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
54
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
55
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0: case 1: t = op; break;
|
|
63
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
64
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
65
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
66
|
+
default:
|
|
67
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
68
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
69
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
70
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
71
|
+
if (t[2]) _.ops.pop();
|
|
72
|
+
_.trys.pop(); continue;
|
|
73
|
+
}
|
|
74
|
+
op = body.call(thisArg, _);
|
|
75
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
76
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* IBM OpenAPI SDK Code Generator Version: 3.69.0-370d6400-20230329-174648
|
|
81
|
+
*/
|
|
82
|
+
/* eslint-disable max-classes-per-file */
|
|
83
|
+
/* eslint-disable no-await-in-loop */
|
|
84
|
+
var extend = require("extend");
|
|
85
|
+
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
86
|
+
var ibm_cloud_sdk_core_2 = require("ibm-cloud-sdk-core");
|
|
87
|
+
var common_1 = require("../lib/common");
|
|
88
|
+
var ibm_cloud_sdk_core_3 = require("ibm-cloud-sdk-core");
|
|
89
|
+
/**
|
|
90
|
+
* With IBM Cloud® Secrets Manager, you can create, lease, and centrally manage secrets that are used in IBM Cloud
|
|
91
|
+
* services or your custom-built applications.
|
|
92
|
+
*
|
|
93
|
+
* API Version: 2.0.0
|
|
94
|
+
* See: https://cloud.ibm.com/docs/secrets-manager
|
|
95
|
+
*/
|
|
96
|
+
var SecretsManagerV2 = /** @class */ (function (_super) {
|
|
97
|
+
__extends(SecretsManagerV2, _super);
|
|
98
|
+
/**
|
|
99
|
+
* Construct a SecretsManagerV2 object.
|
|
100
|
+
*
|
|
101
|
+
* @param {Object} options - Options for the service.
|
|
102
|
+
* @param {string} [options.serviceUrl] - The base url to use when contacting the service. The base url may differ between IBM Cloud regions.
|
|
103
|
+
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
|
|
104
|
+
* @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service
|
|
105
|
+
* @constructor
|
|
106
|
+
* @returns {SecretsManagerV2}
|
|
107
|
+
*/
|
|
108
|
+
function SecretsManagerV2(options) {
|
|
109
|
+
var _this = this;
|
|
110
|
+
options = options || {};
|
|
111
|
+
_this = _super.call(this, options) || this;
|
|
112
|
+
if (options.serviceUrl) {
|
|
113
|
+
_this.setServiceUrl(options.serviceUrl);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
_this.setServiceUrl(SecretsManagerV2.DEFAULT_SERVICE_URL);
|
|
117
|
+
}
|
|
118
|
+
return _this;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Constructs a service URL by formatting the parameterized service URL.
|
|
122
|
+
*
|
|
123
|
+
* The parameterized service URL is:
|
|
124
|
+
* 'https://{instance_id}.{region}.secrets-manager.appdomain.cloud'
|
|
125
|
+
*
|
|
126
|
+
* The default variable values are:
|
|
127
|
+
* - 'instance_id': 'provide-here-your-smgr-instanceuuid'
|
|
128
|
+
* - 'region': 'us-south'
|
|
129
|
+
*
|
|
130
|
+
* @param {Map<string, string>} | null providedUrlVariables Map from variable names to desired values.
|
|
131
|
+
* If a variable is not provided in this map,
|
|
132
|
+
* the default variable value will be used instead.
|
|
133
|
+
* @returns {string} The formatted URL with all variable placeholders replaced by values.
|
|
134
|
+
*/
|
|
135
|
+
SecretsManagerV2.constructServiceUrl = function (providedUrlVariables) {
|
|
136
|
+
return (0, ibm_cloud_sdk_core_2.constructServiceUrl)(SecretsManagerV2.PARAMETERIZED_SERVICE_URL, SecretsManagerV2.defaultUrlVariables, providedUrlVariables);
|
|
137
|
+
};
|
|
138
|
+
/*************************
|
|
139
|
+
* Factory method
|
|
140
|
+
************************/
|
|
141
|
+
/**
|
|
142
|
+
* Constructs an instance of SecretsManagerV2 with passed in options and external configuration.
|
|
143
|
+
*
|
|
144
|
+
* @param {UserOptions} [options] - The parameters to send to the service.
|
|
145
|
+
* @param {string} [options.serviceName] - The name of the service to configure
|
|
146
|
+
* @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service
|
|
147
|
+
* @param {string} [options.serviceUrl] - The URL for the service
|
|
148
|
+
* @returns {SecretsManagerV2}
|
|
149
|
+
*/
|
|
150
|
+
SecretsManagerV2.newInstance = function (options) {
|
|
151
|
+
options = options || {};
|
|
152
|
+
if (!options.serviceName) {
|
|
153
|
+
options.serviceName = this.DEFAULT_SERVICE_NAME;
|
|
154
|
+
}
|
|
155
|
+
if (!options.authenticator) {
|
|
156
|
+
options.authenticator = (0, ibm_cloud_sdk_core_1.getAuthenticatorFromEnvironment)(options.serviceName);
|
|
157
|
+
}
|
|
158
|
+
var service = new SecretsManagerV2(options);
|
|
159
|
+
service.configureService(options.serviceName);
|
|
160
|
+
if (options.serviceUrl) {
|
|
161
|
+
service.setServiceUrl(options.serviceUrl);
|
|
162
|
+
}
|
|
163
|
+
return service;
|
|
164
|
+
};
|
|
165
|
+
/*************************
|
|
166
|
+
* secretGroups
|
|
167
|
+
************************/
|
|
168
|
+
/**
|
|
169
|
+
* Create a new secret group.
|
|
170
|
+
*
|
|
171
|
+
* Create a secret group that you can use to organize secrets and control who can access them.
|
|
172
|
+
*
|
|
173
|
+
* A successful request returns the ID value of the secret group, along with other properties. To learn more about
|
|
174
|
+
* secret groups, check out the
|
|
175
|
+
* [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secret-groups).
|
|
176
|
+
*
|
|
177
|
+
* @param {Object} params - The parameters to send to the service.
|
|
178
|
+
* @param {string} params.name - The name of your secret group.
|
|
179
|
+
* @param {string} [params.description] - An extended description of your secret group.
|
|
180
|
+
*
|
|
181
|
+
* To protect your privacy, do not use personal data, such as your name or location, as a description for your secret
|
|
182
|
+
* group.
|
|
183
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
184
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretGroup>>}
|
|
185
|
+
*/
|
|
186
|
+
SecretsManagerV2.prototype.createSecretGroup = function (params) {
|
|
187
|
+
var _params = __assign({}, params);
|
|
188
|
+
var _requiredParams = ['name'];
|
|
189
|
+
var _validParams = ['name', 'description', 'headers'];
|
|
190
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
191
|
+
if (_validationErrors) {
|
|
192
|
+
return Promise.reject(_validationErrors);
|
|
193
|
+
}
|
|
194
|
+
var body = {
|
|
195
|
+
'name': _params.name,
|
|
196
|
+
'description': _params.description,
|
|
197
|
+
};
|
|
198
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecretGroup');
|
|
199
|
+
var parameters = {
|
|
200
|
+
options: {
|
|
201
|
+
url: '/api/v2/secret_groups',
|
|
202
|
+
method: 'POST',
|
|
203
|
+
body: body,
|
|
204
|
+
},
|
|
205
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
206
|
+
headers: extend(true, sdkHeaders, {
|
|
207
|
+
'Accept': 'application/json',
|
|
208
|
+
'Content-Type': 'application/json',
|
|
209
|
+
}, _params.headers),
|
|
210
|
+
}),
|
|
211
|
+
};
|
|
212
|
+
return this.createRequest(parameters);
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* List secret groups.
|
|
216
|
+
*
|
|
217
|
+
* List the secret groups that are available in your Secrets Manager instance.
|
|
218
|
+
*
|
|
219
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
220
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
221
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretGroupCollection>>}
|
|
222
|
+
*/
|
|
223
|
+
SecretsManagerV2.prototype.listSecretGroups = function (params) {
|
|
224
|
+
var _params = __assign({}, params);
|
|
225
|
+
var _requiredParams = [];
|
|
226
|
+
var _validParams = ['headers'];
|
|
227
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
228
|
+
if (_validationErrors) {
|
|
229
|
+
return Promise.reject(_validationErrors);
|
|
230
|
+
}
|
|
231
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listSecretGroups');
|
|
232
|
+
var parameters = {
|
|
233
|
+
options: {
|
|
234
|
+
url: '/api/v2/secret_groups',
|
|
235
|
+
method: 'GET',
|
|
236
|
+
},
|
|
237
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
238
|
+
headers: extend(true, sdkHeaders, {
|
|
239
|
+
'Accept': 'application/json',
|
|
240
|
+
}, _params.headers),
|
|
241
|
+
}),
|
|
242
|
+
};
|
|
243
|
+
return this.createRequest(parameters);
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Get a secret group.
|
|
247
|
+
*
|
|
248
|
+
* Get the properties of an existing secret group by specifying the ID of the group.
|
|
249
|
+
*
|
|
250
|
+
* @param {Object} params - The parameters to send to the service.
|
|
251
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret group.
|
|
252
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
253
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretGroup>>}
|
|
254
|
+
*/
|
|
255
|
+
SecretsManagerV2.prototype.getSecretGroup = function (params) {
|
|
256
|
+
var _params = __assign({}, params);
|
|
257
|
+
var _requiredParams = ['id'];
|
|
258
|
+
var _validParams = ['id', 'headers'];
|
|
259
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
260
|
+
if (_validationErrors) {
|
|
261
|
+
return Promise.reject(_validationErrors);
|
|
262
|
+
}
|
|
263
|
+
var path = {
|
|
264
|
+
'id': _params.id,
|
|
265
|
+
};
|
|
266
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getSecretGroup');
|
|
267
|
+
var parameters = {
|
|
268
|
+
options: {
|
|
269
|
+
url: '/api/v2/secret_groups/{id}',
|
|
270
|
+
method: 'GET',
|
|
271
|
+
path: path,
|
|
272
|
+
},
|
|
273
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
274
|
+
headers: extend(true, sdkHeaders, {
|
|
275
|
+
'Accept': 'application/json',
|
|
276
|
+
}, _params.headers),
|
|
277
|
+
}),
|
|
278
|
+
};
|
|
279
|
+
return this.createRequest(parameters);
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Update a secret group.
|
|
283
|
+
*
|
|
284
|
+
* Update the properties of an existing secret group, such as its name or description.
|
|
285
|
+
*
|
|
286
|
+
* @param {Object} params - The parameters to send to the service.
|
|
287
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret group.
|
|
288
|
+
* @param {string} [params.name] - The name of your secret group.
|
|
289
|
+
* @param {string} [params.description] - An extended description of your secret group.
|
|
290
|
+
*
|
|
291
|
+
* To protect your privacy, do not use personal data, such as your name or location, as a description for your secret
|
|
292
|
+
* group.
|
|
293
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
294
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretGroup>>}
|
|
295
|
+
*/
|
|
296
|
+
SecretsManagerV2.prototype.updateSecretGroup = function (params) {
|
|
297
|
+
var _params = __assign({}, params);
|
|
298
|
+
var _requiredParams = ['id'];
|
|
299
|
+
var _validParams = ['id', 'name', 'description', 'headers'];
|
|
300
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
301
|
+
if (_validationErrors) {
|
|
302
|
+
return Promise.reject(_validationErrors);
|
|
303
|
+
}
|
|
304
|
+
var body = {
|
|
305
|
+
'name': _params.name,
|
|
306
|
+
'description': _params.description,
|
|
307
|
+
};
|
|
308
|
+
var path = {
|
|
309
|
+
'id': _params.id,
|
|
310
|
+
};
|
|
311
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'updateSecretGroup');
|
|
312
|
+
var parameters = {
|
|
313
|
+
options: {
|
|
314
|
+
url: '/api/v2/secret_groups/{id}',
|
|
315
|
+
method: 'PATCH',
|
|
316
|
+
body: body,
|
|
317
|
+
path: path,
|
|
318
|
+
},
|
|
319
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
320
|
+
headers: extend(true, sdkHeaders, {
|
|
321
|
+
'Accept': 'application/json',
|
|
322
|
+
'Content-Type': 'application/merge-patch+json',
|
|
323
|
+
}, _params.headers),
|
|
324
|
+
}),
|
|
325
|
+
};
|
|
326
|
+
return this.createRequest(parameters);
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Delete a secret group.
|
|
330
|
+
*
|
|
331
|
+
* Delete a secret group by specifying the ID of the secret group.
|
|
332
|
+
*
|
|
333
|
+
* **Note:** To delete a secret group, it must be empty. If you need to remove a secret group that contains secrets,
|
|
334
|
+
* you must first [delete the secrets](#delete-secret) that are associated with the group.
|
|
335
|
+
*
|
|
336
|
+
* @param {Object} params - The parameters to send to the service.
|
|
337
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret group.
|
|
338
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
339
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.EmptyObject>>}
|
|
340
|
+
*/
|
|
341
|
+
SecretsManagerV2.prototype.deleteSecretGroup = function (params) {
|
|
342
|
+
var _params = __assign({}, params);
|
|
343
|
+
var _requiredParams = ['id'];
|
|
344
|
+
var _validParams = ['id', 'headers'];
|
|
345
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
346
|
+
if (_validationErrors) {
|
|
347
|
+
return Promise.reject(_validationErrors);
|
|
348
|
+
}
|
|
349
|
+
var path = {
|
|
350
|
+
'id': _params.id,
|
|
351
|
+
};
|
|
352
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteSecretGroup');
|
|
353
|
+
var parameters = {
|
|
354
|
+
options: {
|
|
355
|
+
url: '/api/v2/secret_groups/{id}',
|
|
356
|
+
method: 'DELETE',
|
|
357
|
+
path: path,
|
|
358
|
+
},
|
|
359
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
360
|
+
headers: extend(true, sdkHeaders, {}, _params.headers),
|
|
361
|
+
}),
|
|
362
|
+
};
|
|
363
|
+
return this.createRequest(parameters);
|
|
364
|
+
};
|
|
365
|
+
/*************************
|
|
366
|
+
* secrets
|
|
367
|
+
************************/
|
|
368
|
+
/**
|
|
369
|
+
* Create a new secret.
|
|
370
|
+
*
|
|
371
|
+
* Create a secret or import an existing value that you can use to access or authenticate to a protected resource.
|
|
372
|
+
*
|
|
373
|
+
* Use this operation to either generate or import an existing secret, such as a TLS certificate, that you can manage
|
|
374
|
+
* in your Secrets Manager service instance. A successful request stores the secret in your dedicated instance, based
|
|
375
|
+
* on the secret type and data that you specify. The response returns the ID value of the secret, along with other
|
|
376
|
+
* metadata.
|
|
377
|
+
*
|
|
378
|
+
* To learn more about the types of secrets that you can create with Secrets Manager, check out the
|
|
379
|
+
* [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-what-is-secret).
|
|
380
|
+
*
|
|
381
|
+
* @param {Object} params - The parameters to send to the service.
|
|
382
|
+
* @param {SecretPrototype} params.secretPrototype -
|
|
383
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
384
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.Secret>>}
|
|
385
|
+
*/
|
|
386
|
+
SecretsManagerV2.prototype.createSecret = function (params) {
|
|
387
|
+
var _params = __assign({}, params);
|
|
388
|
+
var _requiredParams = ['secretPrototype'];
|
|
389
|
+
var _validParams = ['secretPrototype', 'headers'];
|
|
390
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
391
|
+
if (_validationErrors) {
|
|
392
|
+
return Promise.reject(_validationErrors);
|
|
393
|
+
}
|
|
394
|
+
var body = _params.secretPrototype;
|
|
395
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecret');
|
|
396
|
+
var parameters = {
|
|
397
|
+
options: {
|
|
398
|
+
url: '/api/v2/secrets',
|
|
399
|
+
method: 'POST',
|
|
400
|
+
body: body,
|
|
401
|
+
},
|
|
402
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
403
|
+
headers: extend(true, sdkHeaders, {
|
|
404
|
+
'Accept': 'application/json',
|
|
405
|
+
'Content-Type': 'application/json',
|
|
406
|
+
}, _params.headers),
|
|
407
|
+
}),
|
|
408
|
+
};
|
|
409
|
+
return this.createRequest(parameters);
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* List secrets.
|
|
413
|
+
*
|
|
414
|
+
* List the secrets that are available in your Secrets Manager instance.
|
|
415
|
+
*
|
|
416
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
417
|
+
* @param {number} [params.offset] - The number of secrets to skip. By specifying `offset`, you retrieve a subset of
|
|
418
|
+
* items that starts with the `offset` value. Use `offset` with `limit` to page through your available resources.
|
|
419
|
+
*
|
|
420
|
+
* **Usage:** If you have 100 secrets in your instance, and you want to retrieve secrets 26 through 50, use
|
|
421
|
+
* `..?offset=25&limit=25`.
|
|
422
|
+
* @param {number} [params.limit] - The number of secrets to retrieve. By default, list operations return the first
|
|
423
|
+
* 200 items. To retrieve a different set of items, use `limit` with `offset` to page through your available
|
|
424
|
+
* resources. Maximum limit allowed is 1000 secrets.
|
|
425
|
+
*
|
|
426
|
+
* **Usage:** If you want to retrieve only the first 25 secrets in your instance, use
|
|
427
|
+
* `..?limit=25`.
|
|
428
|
+
* @param {string} [params.sort] - Sort a collection of secrets by the specified field in ascending order. To sort in
|
|
429
|
+
* descending order use the `-` character
|
|
430
|
+
*
|
|
431
|
+
*
|
|
432
|
+
* **Available values:** id | created_at | updated_at | expiration_date | secret_type | name
|
|
433
|
+
*
|
|
434
|
+
* **Usage:** To sort a list of secrets by their creation date, use
|
|
435
|
+
* `../secrets?sort=created_at`.
|
|
436
|
+
* @param {string} [params.search] - Obtain a collection of secrets that contain the specified string in one or more
|
|
437
|
+
* of the fields: `id`, `name`, `description`,
|
|
438
|
+
* `labels`, `secret_type`.
|
|
439
|
+
*
|
|
440
|
+
* **Usage:** If you want to list only the secrets that contain the string `text`, use
|
|
441
|
+
* `../secrets?search=text`.
|
|
442
|
+
* @param {string[]} [params.groups] - Filter secrets by groups.
|
|
443
|
+
*
|
|
444
|
+
* You can apply multiple filters by using a comma-separated list of secret group IDs. If you need to filter secrets
|
|
445
|
+
* that are in the default secret group, use the `default` keyword.
|
|
446
|
+
*
|
|
447
|
+
* **Usage:** To retrieve a list of secrets that are associated with an existing secret group or the default group,
|
|
448
|
+
* use `..?groups={secret_group_ID},default`.
|
|
449
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
450
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretMetadataPaginatedCollection>>}
|
|
451
|
+
*/
|
|
452
|
+
SecretsManagerV2.prototype.listSecrets = function (params) {
|
|
453
|
+
var _params = __assign({}, params);
|
|
454
|
+
var _requiredParams = [];
|
|
455
|
+
var _validParams = ['offset', 'limit', 'sort', 'search', 'groups', 'headers'];
|
|
456
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
457
|
+
if (_validationErrors) {
|
|
458
|
+
return Promise.reject(_validationErrors);
|
|
459
|
+
}
|
|
460
|
+
var query = {
|
|
461
|
+
'offset': _params.offset,
|
|
462
|
+
'limit': _params.limit,
|
|
463
|
+
'sort': _params.sort,
|
|
464
|
+
'search': _params.search,
|
|
465
|
+
'groups': _params.groups,
|
|
466
|
+
};
|
|
467
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listSecrets');
|
|
468
|
+
var parameters = {
|
|
469
|
+
options: {
|
|
470
|
+
url: '/api/v2/secrets',
|
|
471
|
+
method: 'GET',
|
|
472
|
+
qs: query,
|
|
473
|
+
},
|
|
474
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
475
|
+
headers: extend(true, sdkHeaders, {
|
|
476
|
+
'Accept': 'application/json',
|
|
477
|
+
}, _params.headers),
|
|
478
|
+
}),
|
|
479
|
+
};
|
|
480
|
+
return this.createRequest(parameters);
|
|
481
|
+
};
|
|
482
|
+
/**
|
|
483
|
+
* Get a secret.
|
|
484
|
+
*
|
|
485
|
+
* Get a secret and its details by specifying the ID of the secret.
|
|
486
|
+
*
|
|
487
|
+
* A successful request returns the secret data that is associated with your secret, along with other metadata. To
|
|
488
|
+
* view only the details of a specified secret without retrieving its value, use the [Get secret
|
|
489
|
+
* metadata](#get-secret-metadata) operation.
|
|
490
|
+
*
|
|
491
|
+
* @param {Object} params - The parameters to send to the service.
|
|
492
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
493
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
494
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.Secret>>}
|
|
495
|
+
*/
|
|
496
|
+
SecretsManagerV2.prototype.getSecret = function (params) {
|
|
497
|
+
var _params = __assign({}, params);
|
|
498
|
+
var _requiredParams = ['id'];
|
|
499
|
+
var _validParams = ['id', 'headers'];
|
|
500
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
501
|
+
if (_validationErrors) {
|
|
502
|
+
return Promise.reject(_validationErrors);
|
|
503
|
+
}
|
|
504
|
+
var path = {
|
|
505
|
+
'id': _params.id,
|
|
506
|
+
};
|
|
507
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getSecret');
|
|
508
|
+
var parameters = {
|
|
509
|
+
options: {
|
|
510
|
+
url: '/api/v2/secrets/{id}',
|
|
511
|
+
method: 'GET',
|
|
512
|
+
path: path,
|
|
513
|
+
},
|
|
514
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
515
|
+
headers: extend(true, sdkHeaders, {
|
|
516
|
+
'Accept': 'application/json',
|
|
517
|
+
}, _params.headers),
|
|
518
|
+
}),
|
|
519
|
+
};
|
|
520
|
+
return this.createRequest(parameters);
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Delete a secret.
|
|
524
|
+
*
|
|
525
|
+
* Delete a secret by specifying the ID of the secret.
|
|
526
|
+
*
|
|
527
|
+
* @param {Object} params - The parameters to send to the service.
|
|
528
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
529
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
530
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.EmptyObject>>}
|
|
531
|
+
*/
|
|
532
|
+
SecretsManagerV2.prototype.deleteSecret = function (params) {
|
|
533
|
+
var _params = __assign({}, params);
|
|
534
|
+
var _requiredParams = ['id'];
|
|
535
|
+
var _validParams = ['id', 'headers'];
|
|
536
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
537
|
+
if (_validationErrors) {
|
|
538
|
+
return Promise.reject(_validationErrors);
|
|
539
|
+
}
|
|
540
|
+
var path = {
|
|
541
|
+
'id': _params.id,
|
|
542
|
+
};
|
|
543
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteSecret');
|
|
544
|
+
var parameters = {
|
|
545
|
+
options: {
|
|
546
|
+
url: '/api/v2/secrets/{id}',
|
|
547
|
+
method: 'DELETE',
|
|
548
|
+
path: path,
|
|
549
|
+
},
|
|
550
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
551
|
+
headers: extend(true, sdkHeaders, {}, _params.headers),
|
|
552
|
+
}),
|
|
553
|
+
};
|
|
554
|
+
return this.createRequest(parameters);
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* Get the metadata of a secret.
|
|
558
|
+
*
|
|
559
|
+
* Get the metadata of a secret by specifying the ID of the secret.
|
|
560
|
+
*
|
|
561
|
+
* @param {Object} params - The parameters to send to the service.
|
|
562
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
563
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
564
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretMetadata>>}
|
|
565
|
+
*/
|
|
566
|
+
SecretsManagerV2.prototype.getSecretMetadata = function (params) {
|
|
567
|
+
var _params = __assign({}, params);
|
|
568
|
+
var _requiredParams = ['id'];
|
|
569
|
+
var _validParams = ['id', 'headers'];
|
|
570
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
571
|
+
if (_validationErrors) {
|
|
572
|
+
return Promise.reject(_validationErrors);
|
|
573
|
+
}
|
|
574
|
+
var path = {
|
|
575
|
+
'id': _params.id,
|
|
576
|
+
};
|
|
577
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getSecretMetadata');
|
|
578
|
+
var parameters = {
|
|
579
|
+
options: {
|
|
580
|
+
url: '/api/v2/secrets/{id}/metadata',
|
|
581
|
+
method: 'GET',
|
|
582
|
+
path: path,
|
|
583
|
+
},
|
|
584
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
585
|
+
headers: extend(true, sdkHeaders, {
|
|
586
|
+
'Accept': 'application/json',
|
|
587
|
+
}, _params.headers),
|
|
588
|
+
}),
|
|
589
|
+
};
|
|
590
|
+
return this.createRequest(parameters);
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Update the metadata of a secret.
|
|
594
|
+
*
|
|
595
|
+
* Update the metadata of a secret, such as its name or description.
|
|
596
|
+
*
|
|
597
|
+
* @param {Object} params - The parameters to send to the service.
|
|
598
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
599
|
+
* @param {SecretMetadataPatch} params.secretMetadataPatch -
|
|
600
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
601
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretMetadata>>}
|
|
602
|
+
*/
|
|
603
|
+
SecretsManagerV2.prototype.updateSecretMetadata = function (params) {
|
|
604
|
+
var _params = __assign({}, params);
|
|
605
|
+
var _requiredParams = ['id', 'secretMetadataPatch'];
|
|
606
|
+
var _validParams = ['id', 'secretMetadataPatch', 'headers'];
|
|
607
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
608
|
+
if (_validationErrors) {
|
|
609
|
+
return Promise.reject(_validationErrors);
|
|
610
|
+
}
|
|
611
|
+
var body = _params.secretMetadataPatch;
|
|
612
|
+
var path = {
|
|
613
|
+
'id': _params.id,
|
|
614
|
+
};
|
|
615
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'updateSecretMetadata');
|
|
616
|
+
var parameters = {
|
|
617
|
+
options: {
|
|
618
|
+
url: '/api/v2/secrets/{id}/metadata',
|
|
619
|
+
method: 'PATCH',
|
|
620
|
+
body: body,
|
|
621
|
+
path: path,
|
|
622
|
+
},
|
|
623
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
624
|
+
headers: extend(true, sdkHeaders, {
|
|
625
|
+
'Accept': 'application/json',
|
|
626
|
+
'Content-Type': 'application/merge-patch+json',
|
|
627
|
+
}, _params.headers),
|
|
628
|
+
}),
|
|
629
|
+
};
|
|
630
|
+
return this.createRequest(parameters);
|
|
631
|
+
};
|
|
632
|
+
/**
|
|
633
|
+
* Create a secret action.
|
|
634
|
+
*
|
|
635
|
+
* Create a secret action. This operation supports the following actions:.
|
|
636
|
+
*
|
|
637
|
+
* @param {Object} params - The parameters to send to the service.
|
|
638
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
639
|
+
* @param {SecretActionPrototype} params.secretActionPrototype -
|
|
640
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
641
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretAction>>}
|
|
642
|
+
*/
|
|
643
|
+
SecretsManagerV2.prototype.createSecretAction = function (params) {
|
|
644
|
+
var _params = __assign({}, params);
|
|
645
|
+
var _requiredParams = ['id', 'secretActionPrototype'];
|
|
646
|
+
var _validParams = ['id', 'secretActionPrototype', 'headers'];
|
|
647
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
648
|
+
if (_validationErrors) {
|
|
649
|
+
return Promise.reject(_validationErrors);
|
|
650
|
+
}
|
|
651
|
+
var body = _params.secretActionPrototype;
|
|
652
|
+
var path = {
|
|
653
|
+
'id': _params.id,
|
|
654
|
+
};
|
|
655
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecretAction');
|
|
656
|
+
var parameters = {
|
|
657
|
+
options: {
|
|
658
|
+
url: '/api/v2/secrets/{id}/actions',
|
|
659
|
+
method: 'POST',
|
|
660
|
+
body: body,
|
|
661
|
+
path: path,
|
|
662
|
+
},
|
|
663
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
664
|
+
headers: extend(true, sdkHeaders, {
|
|
665
|
+
'Accept': 'application/json',
|
|
666
|
+
'Content-Type': 'application/json',
|
|
667
|
+
}, _params.headers),
|
|
668
|
+
}),
|
|
669
|
+
};
|
|
670
|
+
return this.createRequest(parameters);
|
|
671
|
+
};
|
|
672
|
+
/*************************
|
|
673
|
+
* secretVersions
|
|
674
|
+
************************/
|
|
675
|
+
/**
|
|
676
|
+
* Create a new secret version.
|
|
677
|
+
*
|
|
678
|
+
* Create a new secret version.
|
|
679
|
+
*
|
|
680
|
+
* @param {Object} params - The parameters to send to the service.
|
|
681
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
682
|
+
* @param {SecretVersionPrototype} params.secretVersionPrototype -
|
|
683
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
684
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretVersion>>}
|
|
685
|
+
*/
|
|
686
|
+
SecretsManagerV2.prototype.createSecretVersion = function (params) {
|
|
687
|
+
var _params = __assign({}, params);
|
|
688
|
+
var _requiredParams = ['secretId', 'secretVersionPrototype'];
|
|
689
|
+
var _validParams = ['secretId', 'secretVersionPrototype', 'headers'];
|
|
690
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
691
|
+
if (_validationErrors) {
|
|
692
|
+
return Promise.reject(_validationErrors);
|
|
693
|
+
}
|
|
694
|
+
var body = _params.secretVersionPrototype;
|
|
695
|
+
var path = {
|
|
696
|
+
'secret_id': _params.secretId,
|
|
697
|
+
};
|
|
698
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecretVersion');
|
|
699
|
+
var parameters = {
|
|
700
|
+
options: {
|
|
701
|
+
url: '/api/v2/secrets/{secret_id}/versions',
|
|
702
|
+
method: 'POST',
|
|
703
|
+
body: body,
|
|
704
|
+
path: path,
|
|
705
|
+
},
|
|
706
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
707
|
+
headers: extend(true, sdkHeaders, {
|
|
708
|
+
'Accept': 'application/json',
|
|
709
|
+
'Content-Type': 'application/json',
|
|
710
|
+
}, _params.headers),
|
|
711
|
+
}),
|
|
712
|
+
};
|
|
713
|
+
return this.createRequest(parameters);
|
|
714
|
+
};
|
|
715
|
+
/**
|
|
716
|
+
* List versions of a secret.
|
|
717
|
+
*
|
|
718
|
+
* List the versions of a secret.
|
|
719
|
+
*
|
|
720
|
+
* A successful request returns the list of versions of a secret, along with the metadata of each version.
|
|
721
|
+
*
|
|
722
|
+
* @param {Object} params - The parameters to send to the service.
|
|
723
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
724
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
725
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretVersionMetadataCollection>>}
|
|
726
|
+
*/
|
|
727
|
+
SecretsManagerV2.prototype.listSecretVersions = function (params) {
|
|
728
|
+
var _params = __assign({}, params);
|
|
729
|
+
var _requiredParams = ['secretId'];
|
|
730
|
+
var _validParams = ['secretId', 'headers'];
|
|
731
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
732
|
+
if (_validationErrors) {
|
|
733
|
+
return Promise.reject(_validationErrors);
|
|
734
|
+
}
|
|
735
|
+
var path = {
|
|
736
|
+
'secret_id': _params.secretId,
|
|
737
|
+
};
|
|
738
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listSecretVersions');
|
|
739
|
+
var parameters = {
|
|
740
|
+
options: {
|
|
741
|
+
url: '/api/v2/secrets/{secret_id}/versions',
|
|
742
|
+
method: 'GET',
|
|
743
|
+
path: path,
|
|
744
|
+
},
|
|
745
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
746
|
+
headers: extend(true, sdkHeaders, {
|
|
747
|
+
'Accept': 'application/json',
|
|
748
|
+
}, _params.headers),
|
|
749
|
+
}),
|
|
750
|
+
};
|
|
751
|
+
return this.createRequest(parameters);
|
|
752
|
+
};
|
|
753
|
+
/**
|
|
754
|
+
* Get a version of a secret.
|
|
755
|
+
*
|
|
756
|
+
* Get a version of a secret by specifying the ID of the version. You can use the `current` or `previous` aliases to
|
|
757
|
+
* refer to the current or previous secret version.
|
|
758
|
+
*
|
|
759
|
+
* A successful request returns the secret data that is associated with the specified version of your secret, along
|
|
760
|
+
* with other metadata.
|
|
761
|
+
*
|
|
762
|
+
* @param {Object} params - The parameters to send to the service.
|
|
763
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
764
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
765
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
766
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
767
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretVersion>>}
|
|
768
|
+
*/
|
|
769
|
+
SecretsManagerV2.prototype.getSecretVersion = function (params) {
|
|
770
|
+
var _params = __assign({}, params);
|
|
771
|
+
var _requiredParams = ['secretId', 'id'];
|
|
772
|
+
var _validParams = ['secretId', 'id', 'headers'];
|
|
773
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
774
|
+
if (_validationErrors) {
|
|
775
|
+
return Promise.reject(_validationErrors);
|
|
776
|
+
}
|
|
777
|
+
var path = {
|
|
778
|
+
'secret_id': _params.secretId,
|
|
779
|
+
'id': _params.id,
|
|
780
|
+
};
|
|
781
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getSecretVersion');
|
|
782
|
+
var parameters = {
|
|
783
|
+
options: {
|
|
784
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}',
|
|
785
|
+
method: 'GET',
|
|
786
|
+
path: path,
|
|
787
|
+
},
|
|
788
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
789
|
+
headers: extend(true, sdkHeaders, {
|
|
790
|
+
'Accept': 'application/json',
|
|
791
|
+
}, _params.headers),
|
|
792
|
+
}),
|
|
793
|
+
};
|
|
794
|
+
return this.createRequest(parameters);
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* Delete the data of a secret version.
|
|
798
|
+
*
|
|
799
|
+
* Delete the data of a secret version by specifying the ID of the version.
|
|
800
|
+
*
|
|
801
|
+
* This operation is available for secret type: iam_credentials current version.
|
|
802
|
+
*
|
|
803
|
+
* @param {Object} params - The parameters to send to the service.
|
|
804
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
805
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
806
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
807
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
808
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.EmptyObject>>}
|
|
809
|
+
*/
|
|
810
|
+
SecretsManagerV2.prototype.deleteSecretVersionData = function (params) {
|
|
811
|
+
var _params = __assign({}, params);
|
|
812
|
+
var _requiredParams = ['secretId', 'id'];
|
|
813
|
+
var _validParams = ['secretId', 'id', 'headers'];
|
|
814
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
815
|
+
if (_validationErrors) {
|
|
816
|
+
return Promise.reject(_validationErrors);
|
|
817
|
+
}
|
|
818
|
+
var path = {
|
|
819
|
+
'secret_id': _params.secretId,
|
|
820
|
+
'id': _params.id,
|
|
821
|
+
};
|
|
822
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteSecretVersionData');
|
|
823
|
+
var parameters = {
|
|
824
|
+
options: {
|
|
825
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/secret_data',
|
|
826
|
+
method: 'DELETE',
|
|
827
|
+
path: path,
|
|
828
|
+
},
|
|
829
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
830
|
+
headers: extend(true, sdkHeaders, {}, _params.headers),
|
|
831
|
+
}),
|
|
832
|
+
};
|
|
833
|
+
return this.createRequest(parameters);
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* Get the metadata of a secret version.
|
|
837
|
+
*
|
|
838
|
+
* Get the metadata of a secret version by specifying the ID of the version. You can use the `current` or `previous`
|
|
839
|
+
* aliases to refer to the current or previous secret version.
|
|
840
|
+
*
|
|
841
|
+
* A successful request returns the metadata that is associated with the specified version of your secret.
|
|
842
|
+
*
|
|
843
|
+
* @param {Object} params - The parameters to send to the service.
|
|
844
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
845
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
846
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
847
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
848
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretVersionMetadata>>}
|
|
849
|
+
*/
|
|
850
|
+
SecretsManagerV2.prototype.getSecretVersionMetadata = function (params) {
|
|
851
|
+
var _params = __assign({}, params);
|
|
852
|
+
var _requiredParams = ['secretId', 'id'];
|
|
853
|
+
var _validParams = ['secretId', 'id', 'headers'];
|
|
854
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
855
|
+
if (_validationErrors) {
|
|
856
|
+
return Promise.reject(_validationErrors);
|
|
857
|
+
}
|
|
858
|
+
var path = {
|
|
859
|
+
'secret_id': _params.secretId,
|
|
860
|
+
'id': _params.id,
|
|
861
|
+
};
|
|
862
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getSecretVersionMetadata');
|
|
863
|
+
var parameters = {
|
|
864
|
+
options: {
|
|
865
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/metadata',
|
|
866
|
+
method: 'GET',
|
|
867
|
+
path: path,
|
|
868
|
+
},
|
|
869
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
870
|
+
headers: extend(true, sdkHeaders, {
|
|
871
|
+
'Accept': 'application/json',
|
|
872
|
+
}, _params.headers),
|
|
873
|
+
}),
|
|
874
|
+
};
|
|
875
|
+
return this.createRequest(parameters);
|
|
876
|
+
};
|
|
877
|
+
/**
|
|
878
|
+
* Update the metadata of a secret version.
|
|
879
|
+
*
|
|
880
|
+
* Update the custom metadata of a secret version.
|
|
881
|
+
*
|
|
882
|
+
* @param {Object} params - The parameters to send to the service.
|
|
883
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
884
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
885
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
886
|
+
* @param {JsonObject} [params.versionCustomMetadata] - The secret version metadata that a user can customize.
|
|
887
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
888
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretVersionMetadata>>}
|
|
889
|
+
*/
|
|
890
|
+
SecretsManagerV2.prototype.updateSecretVersionMetadata = function (params) {
|
|
891
|
+
var _params = __assign({}, params);
|
|
892
|
+
var _requiredParams = ['secretId', 'id'];
|
|
893
|
+
var _validParams = ['secretId', 'id', 'versionCustomMetadata', 'headers'];
|
|
894
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
895
|
+
if (_validationErrors) {
|
|
896
|
+
return Promise.reject(_validationErrors);
|
|
897
|
+
}
|
|
898
|
+
var body = {
|
|
899
|
+
'version_custom_metadata': _params.versionCustomMetadata,
|
|
900
|
+
};
|
|
901
|
+
var path = {
|
|
902
|
+
'secret_id': _params.secretId,
|
|
903
|
+
'id': _params.id,
|
|
904
|
+
};
|
|
905
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'updateSecretVersionMetadata');
|
|
906
|
+
var parameters = {
|
|
907
|
+
options: {
|
|
908
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/metadata',
|
|
909
|
+
method: 'PATCH',
|
|
910
|
+
body: body,
|
|
911
|
+
path: path,
|
|
912
|
+
},
|
|
913
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
914
|
+
headers: extend(true, sdkHeaders, {
|
|
915
|
+
'Accept': 'application/json',
|
|
916
|
+
'Content-Type': 'application/merge-patch+json',
|
|
917
|
+
}, _params.headers),
|
|
918
|
+
}),
|
|
919
|
+
};
|
|
920
|
+
return this.createRequest(parameters);
|
|
921
|
+
};
|
|
922
|
+
/**
|
|
923
|
+
* Create a version action.
|
|
924
|
+
*
|
|
925
|
+
* Create a secret version action. This operation supports the following actions:
|
|
926
|
+
*
|
|
927
|
+
* - `private_cert_action_revoke_certificate`: Revoke a version of a private certificate.
|
|
928
|
+
*
|
|
929
|
+
* @param {Object} params - The parameters to send to the service.
|
|
930
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
931
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
932
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
933
|
+
* @param {SecretVersionActionPrototype} params.secretVersionActionPrototype -
|
|
934
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
935
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.VersionAction>>}
|
|
936
|
+
*/
|
|
937
|
+
SecretsManagerV2.prototype.createSecretVersionAction = function (params) {
|
|
938
|
+
var _params = __assign({}, params);
|
|
939
|
+
var _requiredParams = ['secretId', 'id', 'secretVersionActionPrototype'];
|
|
940
|
+
var _validParams = ['secretId', 'id', 'secretVersionActionPrototype', 'headers'];
|
|
941
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
942
|
+
if (_validationErrors) {
|
|
943
|
+
return Promise.reject(_validationErrors);
|
|
944
|
+
}
|
|
945
|
+
var body = _params.secretVersionActionPrototype;
|
|
946
|
+
var path = {
|
|
947
|
+
'secret_id': _params.secretId,
|
|
948
|
+
'id': _params.id,
|
|
949
|
+
};
|
|
950
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecretVersionAction');
|
|
951
|
+
var parameters = {
|
|
952
|
+
options: {
|
|
953
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/actions',
|
|
954
|
+
method: 'POST',
|
|
955
|
+
body: body,
|
|
956
|
+
path: path,
|
|
957
|
+
},
|
|
958
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
959
|
+
headers: extend(true, sdkHeaders, {
|
|
960
|
+
'Accept': 'application/json',
|
|
961
|
+
'Content-Type': 'application/json',
|
|
962
|
+
}, _params.headers),
|
|
963
|
+
}),
|
|
964
|
+
};
|
|
965
|
+
return this.createRequest(parameters);
|
|
966
|
+
};
|
|
967
|
+
/*************************
|
|
968
|
+
* secretLocks
|
|
969
|
+
************************/
|
|
970
|
+
/**
|
|
971
|
+
* List secrets and their locks.
|
|
972
|
+
*
|
|
973
|
+
* List the secrets and their locks in your Secrets Manager instance.
|
|
974
|
+
*
|
|
975
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
976
|
+
* @param {number} [params.offset] - The number of secrets to skip. By specifying `offset`, you retrieve a subset of
|
|
977
|
+
* items that starts with the `offset` value. Use `offset` with `limit` to page through your available resources.
|
|
978
|
+
*
|
|
979
|
+
* **Usage:** If you have 100 secrets in your instance, and you want to retrieve secrets 26 through 50, use
|
|
980
|
+
* `..?offset=25&limit=25`.
|
|
981
|
+
* @param {number} [params.limit] - The number of secrets to retrieve. By default, list operations return the first
|
|
982
|
+
* 200 items. To retrieve a different set of items, use `limit` with `offset` to page through your available
|
|
983
|
+
* resources. Maximum limit allowed is 1000 secrets.
|
|
984
|
+
*
|
|
985
|
+
* **Usage:** If you want to retrieve only the first 25 secrets in your instance, use
|
|
986
|
+
* `..?limit=25`.
|
|
987
|
+
* @param {string} [params.search] - Filter locks that contain the specified string in the field "name".
|
|
988
|
+
*
|
|
989
|
+
* **Usage:** If you want to list only the locks that contain the string "text" in the field "name", use
|
|
990
|
+
* `..?search=text`.
|
|
991
|
+
* @param {string[]} [params.groups] - Filter secrets by groups.
|
|
992
|
+
*
|
|
993
|
+
* You can apply multiple filters by using a comma-separated list of secret group IDs. If you need to filter secrets
|
|
994
|
+
* that are in the default secret group, use the `default` keyword.
|
|
995
|
+
*
|
|
996
|
+
* **Usage:** To retrieve a list of secrets that are associated with an existing secret group or the default group,
|
|
997
|
+
* use `..?groups={secret_group_ID},default`.
|
|
998
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
999
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretsLocksPaginatedCollection>>}
|
|
1000
|
+
*/
|
|
1001
|
+
SecretsManagerV2.prototype.listSecretsLocks = function (params) {
|
|
1002
|
+
var _params = __assign({}, params);
|
|
1003
|
+
var _requiredParams = [];
|
|
1004
|
+
var _validParams = ['offset', 'limit', 'search', 'groups', 'headers'];
|
|
1005
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1006
|
+
if (_validationErrors) {
|
|
1007
|
+
return Promise.reject(_validationErrors);
|
|
1008
|
+
}
|
|
1009
|
+
var query = {
|
|
1010
|
+
'offset': _params.offset,
|
|
1011
|
+
'limit': _params.limit,
|
|
1012
|
+
'search': _params.search,
|
|
1013
|
+
'groups': _params.groups,
|
|
1014
|
+
};
|
|
1015
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listSecretsLocks');
|
|
1016
|
+
var parameters = {
|
|
1017
|
+
options: {
|
|
1018
|
+
url: '/api/v2/secrets_locks',
|
|
1019
|
+
method: 'GET',
|
|
1020
|
+
qs: query,
|
|
1021
|
+
},
|
|
1022
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1023
|
+
headers: extend(true, sdkHeaders, {
|
|
1024
|
+
'Accept': 'application/json',
|
|
1025
|
+
}, _params.headers),
|
|
1026
|
+
}),
|
|
1027
|
+
};
|
|
1028
|
+
return this.createRequest(parameters);
|
|
1029
|
+
};
|
|
1030
|
+
/**
|
|
1031
|
+
* List secret locks.
|
|
1032
|
+
*
|
|
1033
|
+
* List the locks that are associated with a specified secret.
|
|
1034
|
+
*
|
|
1035
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1036
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
1037
|
+
* @param {number} [params.offset] - The number of locks to skip. By specifying `offset`, you retrieve a subset of
|
|
1038
|
+
* items that starts with the `offset` value. Use `offset` with `limit` to page through your available resources.
|
|
1039
|
+
*
|
|
1040
|
+
* **Usage:** If you have 100 locks on your secret, and you want to retrieve locks 26 through 50, use
|
|
1041
|
+
* `..?offset=25&limit=25`.
|
|
1042
|
+
* @param {number} [params.limit] - The number of locks with associated secret to retrieve. By default, list
|
|
1043
|
+
* operations return the first 25 items. To retrieve a different set of items, use `limit` with `offset` to page
|
|
1044
|
+
* through your available resources.
|
|
1045
|
+
*
|
|
1046
|
+
* **Usage:** If you have 20 secrets in your instance, and you want to retrieve only the first 5, use
|
|
1047
|
+
* `..?limit=5`.
|
|
1048
|
+
* @param {string} [params.sort] - Sort a collection of locks by the specified field in ascending order. To sort in
|
|
1049
|
+
* descending order use the `-` character
|
|
1050
|
+
*
|
|
1051
|
+
* **Available values:** created_at | updated_at | name
|
|
1052
|
+
*
|
|
1053
|
+
* **Usage:** To sort a list of locks by their creation date, use
|
|
1054
|
+
* `../locks?sort=created_at`.
|
|
1055
|
+
* @param {string} [params.search] - Filter locks that contain the specified string in the field "name".
|
|
1056
|
+
*
|
|
1057
|
+
* **Usage:** If you want to list only the locks that contain the string "text" in the field "name", use
|
|
1058
|
+
* `..?search=text`.
|
|
1059
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1060
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretLocksPaginatedCollection>>}
|
|
1061
|
+
*/
|
|
1062
|
+
SecretsManagerV2.prototype.listSecretLocks = function (params) {
|
|
1063
|
+
var _params = __assign({}, params);
|
|
1064
|
+
var _requiredParams = ['id'];
|
|
1065
|
+
var _validParams = ['id', 'offset', 'limit', 'sort', 'search', 'headers'];
|
|
1066
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1067
|
+
if (_validationErrors) {
|
|
1068
|
+
return Promise.reject(_validationErrors);
|
|
1069
|
+
}
|
|
1070
|
+
var query = {
|
|
1071
|
+
'offset': _params.offset,
|
|
1072
|
+
'limit': _params.limit,
|
|
1073
|
+
'sort': _params.sort,
|
|
1074
|
+
'search': _params.search,
|
|
1075
|
+
};
|
|
1076
|
+
var path = {
|
|
1077
|
+
'id': _params.id,
|
|
1078
|
+
};
|
|
1079
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listSecretLocks');
|
|
1080
|
+
var parameters = {
|
|
1081
|
+
options: {
|
|
1082
|
+
url: '/api/v2/secrets/{id}/locks',
|
|
1083
|
+
method: 'GET',
|
|
1084
|
+
qs: query,
|
|
1085
|
+
path: path,
|
|
1086
|
+
},
|
|
1087
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1088
|
+
headers: extend(true, sdkHeaders, {
|
|
1089
|
+
'Accept': 'application/json',
|
|
1090
|
+
}, _params.headers),
|
|
1091
|
+
}),
|
|
1092
|
+
};
|
|
1093
|
+
return this.createRequest(parameters);
|
|
1094
|
+
};
|
|
1095
|
+
/**
|
|
1096
|
+
* Create secret locks.
|
|
1097
|
+
*
|
|
1098
|
+
* Create a lock on the current version of a secret.
|
|
1099
|
+
*
|
|
1100
|
+
* A lock can be used to prevent a secret from being deleted or modified while it's in use by your applications. A
|
|
1101
|
+
* successful request attaches a new lock to your secret, or replaces a lock of the same name if it already exists.
|
|
1102
|
+
* Additionally, you can use this operation to clear any matching locks on a secret by using one of the following
|
|
1103
|
+
* optional lock modes:
|
|
1104
|
+
*
|
|
1105
|
+
* - `remove_previous`: Removes any other locks with matching names if they are found in the previous version of the
|
|
1106
|
+
* secret.\n
|
|
1107
|
+
* - `remove_previous_and_delete`: Carries out the same function as `remove_previous`, but also permanently deletes
|
|
1108
|
+
* the data of the previous secret version if it doesn't have any locks.
|
|
1109
|
+
*
|
|
1110
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1111
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
1112
|
+
* @param {SecretLockPrototype[]} params.locks - The locks data to be attached to a secret version.
|
|
1113
|
+
* @param {string} [params.mode] - An optional lock mode. When you create a lock, you can set one of the following
|
|
1114
|
+
* modes to clear any matching locks on a secret version.
|
|
1115
|
+
* - `remove_previous`: Removes any other locks with matching names if they are found in the previous version of the
|
|
1116
|
+
* secret. - `remove_previous_and_delete`: Completes the same action as `remove_previous`, but also permanently
|
|
1117
|
+
* deletes the data of the previous secret version if it doesn't have any locks.
|
|
1118
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1119
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretLocks>>}
|
|
1120
|
+
*/
|
|
1121
|
+
SecretsManagerV2.prototype.createSecretLocksBulk = function (params) {
|
|
1122
|
+
var _params = __assign({}, params);
|
|
1123
|
+
var _requiredParams = ['id', 'locks'];
|
|
1124
|
+
var _validParams = ['id', 'locks', 'mode', 'headers'];
|
|
1125
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1126
|
+
if (_validationErrors) {
|
|
1127
|
+
return Promise.reject(_validationErrors);
|
|
1128
|
+
}
|
|
1129
|
+
var body = {
|
|
1130
|
+
'locks': _params.locks,
|
|
1131
|
+
};
|
|
1132
|
+
var query = {
|
|
1133
|
+
'mode': _params.mode,
|
|
1134
|
+
};
|
|
1135
|
+
var path = {
|
|
1136
|
+
'id': _params.id,
|
|
1137
|
+
};
|
|
1138
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecretLocksBulk');
|
|
1139
|
+
var parameters = {
|
|
1140
|
+
options: {
|
|
1141
|
+
url: '/api/v2/secrets/{id}/locks_bulk',
|
|
1142
|
+
method: 'POST',
|
|
1143
|
+
body: body,
|
|
1144
|
+
qs: query,
|
|
1145
|
+
path: path,
|
|
1146
|
+
},
|
|
1147
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1148
|
+
headers: extend(true, sdkHeaders, {
|
|
1149
|
+
'Accept': 'application/json',
|
|
1150
|
+
'Content-Type': 'application/json',
|
|
1151
|
+
}, _params.headers),
|
|
1152
|
+
}),
|
|
1153
|
+
};
|
|
1154
|
+
return this.createRequest(parameters);
|
|
1155
|
+
};
|
|
1156
|
+
/**
|
|
1157
|
+
* Delete secret locks.
|
|
1158
|
+
*
|
|
1159
|
+
* Delete all the locks or a subset of the locks that are associated with a version of a secret.
|
|
1160
|
+
*
|
|
1161
|
+
* To delete only a subset of the locks, add a query param with a comma to separate the list of lock names:
|
|
1162
|
+
*
|
|
1163
|
+
* Example: `?name=lock-example-1,lock-example-2`.
|
|
1164
|
+
*
|
|
1165
|
+
* **Note:** A secret is considered unlocked and able to be deleted only after you remove all of its locks. To
|
|
1166
|
+
* determine whether a secret contains locks, check the `locks_total` field that is returned as part of the metadata
|
|
1167
|
+
* of your secret.
|
|
1168
|
+
*
|
|
1169
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1170
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret.
|
|
1171
|
+
* @param {string[]} [params.name] - Specify the names of the secret locks to be deleted.
|
|
1172
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1173
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretLocks>>}
|
|
1174
|
+
*/
|
|
1175
|
+
SecretsManagerV2.prototype.deleteSecretLocksBulk = function (params) {
|
|
1176
|
+
var _params = __assign({}, params);
|
|
1177
|
+
var _requiredParams = ['id'];
|
|
1178
|
+
var _validParams = ['id', 'name', 'headers'];
|
|
1179
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1180
|
+
if (_validationErrors) {
|
|
1181
|
+
return Promise.reject(_validationErrors);
|
|
1182
|
+
}
|
|
1183
|
+
var query = {
|
|
1184
|
+
'name': _params.name,
|
|
1185
|
+
};
|
|
1186
|
+
var path = {
|
|
1187
|
+
'id': _params.id,
|
|
1188
|
+
};
|
|
1189
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteSecretLocksBulk');
|
|
1190
|
+
var parameters = {
|
|
1191
|
+
options: {
|
|
1192
|
+
url: '/api/v2/secrets/{id}/locks_bulk',
|
|
1193
|
+
method: 'DELETE',
|
|
1194
|
+
qs: query,
|
|
1195
|
+
path: path,
|
|
1196
|
+
},
|
|
1197
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1198
|
+
headers: extend(true, sdkHeaders, {
|
|
1199
|
+
'Accept': 'application/json',
|
|
1200
|
+
}, _params.headers),
|
|
1201
|
+
}),
|
|
1202
|
+
};
|
|
1203
|
+
return this.createRequest(parameters);
|
|
1204
|
+
};
|
|
1205
|
+
/**
|
|
1206
|
+
* List secret version locks.
|
|
1207
|
+
*
|
|
1208
|
+
* List the locks that are associated with a specified secret version.
|
|
1209
|
+
*
|
|
1210
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1211
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
1212
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
1213
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
1214
|
+
* @param {number} [params.offset] - The number of locks to skip. By specifying `offset`, you retrieve a subset of
|
|
1215
|
+
* items that starts with the `offset` value. Use `offset` with `limit` to page through your available resources.
|
|
1216
|
+
*
|
|
1217
|
+
* **Usage:** If you have 100 locks on your secret, and you want to retrieve locks 26 through 50, use
|
|
1218
|
+
* `..?offset=25&limit=25`.
|
|
1219
|
+
* @param {number} [params.limit] - The number of locks with associated secret to retrieve. By default, list
|
|
1220
|
+
* operations return the first 25 items. To retrieve a different set of items, use `limit` with `offset` to page
|
|
1221
|
+
* through your available resources.
|
|
1222
|
+
*
|
|
1223
|
+
* **Usage:** If you have 20 secrets in your instance, and you want to retrieve only the first 5, use
|
|
1224
|
+
* `..?limit=5`.
|
|
1225
|
+
* @param {string} [params.sort] - Sort a collection of locks by the specified field in ascending order. To sort in
|
|
1226
|
+
* descending order use the `-` character
|
|
1227
|
+
*
|
|
1228
|
+
* **Available values:** created_at | updated_at | name
|
|
1229
|
+
*
|
|
1230
|
+
* **Usage:** To sort a list of locks by their creation date, use
|
|
1231
|
+
* `../locks?sort=created_at`.
|
|
1232
|
+
* @param {string} [params.search] - Filter locks that contain the specified string in the field "name".
|
|
1233
|
+
*
|
|
1234
|
+
* **Usage:** If you want to list only the locks that contain the string "text" in the field "name", use
|
|
1235
|
+
* `..?search=text`.
|
|
1236
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1237
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretVersionLocksPaginatedCollection>>}
|
|
1238
|
+
*/
|
|
1239
|
+
SecretsManagerV2.prototype.listSecretVersionLocks = function (params) {
|
|
1240
|
+
var _params = __assign({}, params);
|
|
1241
|
+
var _requiredParams = ['secretId', 'id'];
|
|
1242
|
+
var _validParams = ['secretId', 'id', 'offset', 'limit', 'sort', 'search', 'headers'];
|
|
1243
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1244
|
+
if (_validationErrors) {
|
|
1245
|
+
return Promise.reject(_validationErrors);
|
|
1246
|
+
}
|
|
1247
|
+
var query = {
|
|
1248
|
+
'offset': _params.offset,
|
|
1249
|
+
'limit': _params.limit,
|
|
1250
|
+
'sort': _params.sort,
|
|
1251
|
+
'search': _params.search,
|
|
1252
|
+
};
|
|
1253
|
+
var path = {
|
|
1254
|
+
'secret_id': _params.secretId,
|
|
1255
|
+
'id': _params.id,
|
|
1256
|
+
};
|
|
1257
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listSecretVersionLocks');
|
|
1258
|
+
var parameters = {
|
|
1259
|
+
options: {
|
|
1260
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/locks',
|
|
1261
|
+
method: 'GET',
|
|
1262
|
+
qs: query,
|
|
1263
|
+
path: path,
|
|
1264
|
+
},
|
|
1265
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1266
|
+
headers: extend(true, sdkHeaders, {
|
|
1267
|
+
'Accept': 'application/json',
|
|
1268
|
+
}, _params.headers),
|
|
1269
|
+
}),
|
|
1270
|
+
};
|
|
1271
|
+
return this.createRequest(parameters);
|
|
1272
|
+
};
|
|
1273
|
+
/**
|
|
1274
|
+
* Create secret version locks.
|
|
1275
|
+
*
|
|
1276
|
+
* Create a lock on the specified version of a secret.
|
|
1277
|
+
*
|
|
1278
|
+
* A lock can be used to prevent a secret from being deleted or modified while it's in use by your applications. A
|
|
1279
|
+
* successful request attaches a new lock to your secret, or replaces a lock of the same name if it already exists.
|
|
1280
|
+
* Additionally, you can use this operation to clear any matching locks on a secret by using one of the following
|
|
1281
|
+
* optional lock modes:
|
|
1282
|
+
*
|
|
1283
|
+
* - `remove_previous`: Removes any other locks with matching names if they are found in the previous version of the
|
|
1284
|
+
* secret.
|
|
1285
|
+
* - `remove_previous_and_delete`: Carries out the same function as `remove_previous`, but also permanently deletes
|
|
1286
|
+
* the data of the previous secret version if it doesn't have any locks.
|
|
1287
|
+
*
|
|
1288
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1289
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
1290
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
1291
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
1292
|
+
* @param {SecretLockPrototype[]} params.locks - The locks data to be attached to a secret version.
|
|
1293
|
+
* @param {string} [params.mode] - An optional lock mode. When you create a lock, you can set one of the following
|
|
1294
|
+
* modes to clear any matching locks on a secret version.
|
|
1295
|
+
* - `remove_previous`: Removes any other locks with matching names if they are found in the previous version of the
|
|
1296
|
+
* secret. - `remove_previous_and_delete`: Completes the same action as `remove_previous`, but also permanently
|
|
1297
|
+
* deletes the data of the previous secret version if it doesn't have any locks.
|
|
1298
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1299
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretLocks>>}
|
|
1300
|
+
*/
|
|
1301
|
+
SecretsManagerV2.prototype.createSecretVersionLocksBulk = function (params) {
|
|
1302
|
+
var _params = __assign({}, params);
|
|
1303
|
+
var _requiredParams = ['secretId', 'id', 'locks'];
|
|
1304
|
+
var _validParams = ['secretId', 'id', 'locks', 'mode', 'headers'];
|
|
1305
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1306
|
+
if (_validationErrors) {
|
|
1307
|
+
return Promise.reject(_validationErrors);
|
|
1308
|
+
}
|
|
1309
|
+
var body = {
|
|
1310
|
+
'locks': _params.locks,
|
|
1311
|
+
};
|
|
1312
|
+
var query = {
|
|
1313
|
+
'mode': _params.mode,
|
|
1314
|
+
};
|
|
1315
|
+
var path = {
|
|
1316
|
+
'secret_id': _params.secretId,
|
|
1317
|
+
'id': _params.id,
|
|
1318
|
+
};
|
|
1319
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createSecretVersionLocksBulk');
|
|
1320
|
+
var parameters = {
|
|
1321
|
+
options: {
|
|
1322
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/locks_bulk',
|
|
1323
|
+
method: 'POST',
|
|
1324
|
+
body: body,
|
|
1325
|
+
qs: query,
|
|
1326
|
+
path: path,
|
|
1327
|
+
},
|
|
1328
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1329
|
+
headers: extend(true, sdkHeaders, {
|
|
1330
|
+
'Accept': 'application/json',
|
|
1331
|
+
'Content-Type': 'application/json',
|
|
1332
|
+
}, _params.headers),
|
|
1333
|
+
}),
|
|
1334
|
+
};
|
|
1335
|
+
return this.createRequest(parameters);
|
|
1336
|
+
};
|
|
1337
|
+
/**
|
|
1338
|
+
* Delete locks on a secret version.
|
|
1339
|
+
*
|
|
1340
|
+
* Delete all the locks or a subset of the locks that are associated with the specified version of a secret.
|
|
1341
|
+
*
|
|
1342
|
+
* To delete only a subset of the locks, add a query param with a comma to separate the list of lock names:
|
|
1343
|
+
*
|
|
1344
|
+
* Example: `?name=lock-example-1,lock-example-2`.
|
|
1345
|
+
*
|
|
1346
|
+
* **Note:** A secret is considered unlocked and able to be deleted only after all of its locks are removed. To
|
|
1347
|
+
* determine whether a secret contains locks, check the `locks_total` field that is returned as part of the metadata
|
|
1348
|
+
* of your secret.
|
|
1349
|
+
*
|
|
1350
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1351
|
+
* @param {string} params.secretId - The v4 UUID that uniquely identifies your secret.
|
|
1352
|
+
* @param {string} params.id - The v4 UUID that uniquely identifies your secret version. You can use the `current` or
|
|
1353
|
+
* `previous` aliases to refer to the current or previous secret version.
|
|
1354
|
+
* @param {string[]} [params.name] - Specify the names of the secret locks to be deleted.
|
|
1355
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1356
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.SecretLocks>>}
|
|
1357
|
+
*/
|
|
1358
|
+
SecretsManagerV2.prototype.deleteSecretVersionLocksBulk = function (params) {
|
|
1359
|
+
var _params = __assign({}, params);
|
|
1360
|
+
var _requiredParams = ['secretId', 'id'];
|
|
1361
|
+
var _validParams = ['secretId', 'id', 'name', 'headers'];
|
|
1362
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1363
|
+
if (_validationErrors) {
|
|
1364
|
+
return Promise.reject(_validationErrors);
|
|
1365
|
+
}
|
|
1366
|
+
var query = {
|
|
1367
|
+
'name': _params.name,
|
|
1368
|
+
};
|
|
1369
|
+
var path = {
|
|
1370
|
+
'secret_id': _params.secretId,
|
|
1371
|
+
'id': _params.id,
|
|
1372
|
+
};
|
|
1373
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteSecretVersionLocksBulk');
|
|
1374
|
+
var parameters = {
|
|
1375
|
+
options: {
|
|
1376
|
+
url: '/api/v2/secrets/{secret_id}/versions/{id}/locks_bulk',
|
|
1377
|
+
method: 'DELETE',
|
|
1378
|
+
qs: query,
|
|
1379
|
+
path: path,
|
|
1380
|
+
},
|
|
1381
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1382
|
+
headers: extend(true, sdkHeaders, {
|
|
1383
|
+
'Accept': 'application/json',
|
|
1384
|
+
}, _params.headers),
|
|
1385
|
+
}),
|
|
1386
|
+
};
|
|
1387
|
+
return this.createRequest(parameters);
|
|
1388
|
+
};
|
|
1389
|
+
/*************************
|
|
1390
|
+
* configurations
|
|
1391
|
+
************************/
|
|
1392
|
+
/**
|
|
1393
|
+
* Create a new configuration.
|
|
1394
|
+
*
|
|
1395
|
+
* Add a configuration to the specified secret type.
|
|
1396
|
+
*
|
|
1397
|
+
* Use this operation to define the configurations that are required to create public certificates (`public_cert`),
|
|
1398
|
+
* private certificates (`private_cert`) and IAM Credentials secrets (`iam_credentials`).
|
|
1399
|
+
*
|
|
1400
|
+
* You can add multiple configurations for your instance as follows:
|
|
1401
|
+
*
|
|
1402
|
+
* - A single configuration for IAM Credentials.
|
|
1403
|
+
* - Up to 10 CA configurations for public certificates.
|
|
1404
|
+
* - Up to 10 DNS configurations for public certificates.
|
|
1405
|
+
* - Up to 10 Root CA configurations for private certificates.
|
|
1406
|
+
* - Up to 10 Intermediate CA configurations for private certificates.
|
|
1407
|
+
* - Up to 10 Certificate Template configurations for private certificates.
|
|
1408
|
+
*
|
|
1409
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1410
|
+
* @param {ConfigurationPrototype} params.configurationPrototype -
|
|
1411
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1412
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.Configuration>>}
|
|
1413
|
+
*/
|
|
1414
|
+
SecretsManagerV2.prototype.createConfiguration = function (params) {
|
|
1415
|
+
var _params = __assign({}, params);
|
|
1416
|
+
var _requiredParams = ['configurationPrototype'];
|
|
1417
|
+
var _validParams = ['configurationPrototype', 'headers'];
|
|
1418
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1419
|
+
if (_validationErrors) {
|
|
1420
|
+
return Promise.reject(_validationErrors);
|
|
1421
|
+
}
|
|
1422
|
+
var body = _params.configurationPrototype;
|
|
1423
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createConfiguration');
|
|
1424
|
+
var parameters = {
|
|
1425
|
+
options: {
|
|
1426
|
+
url: '/api/v2/configurations',
|
|
1427
|
+
method: 'POST',
|
|
1428
|
+
body: body,
|
|
1429
|
+
},
|
|
1430
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1431
|
+
headers: extend(true, sdkHeaders, {
|
|
1432
|
+
'Accept': 'application/json',
|
|
1433
|
+
'Content-Type': 'application/json',
|
|
1434
|
+
}, _params.headers),
|
|
1435
|
+
}),
|
|
1436
|
+
};
|
|
1437
|
+
return this.createRequest(parameters);
|
|
1438
|
+
};
|
|
1439
|
+
/**
|
|
1440
|
+
* List configurations.
|
|
1441
|
+
*
|
|
1442
|
+
* List the configurations that are available in your Secrets Manager instance.
|
|
1443
|
+
*
|
|
1444
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
1445
|
+
* @param {number} [params.offset] - The number of configurations to skip. By specifying `offset`, you retrieve a
|
|
1446
|
+
* subset of items that starts with the `offset` value. Use `offset` with `limit` to page through your available
|
|
1447
|
+
* resources.
|
|
1448
|
+
*
|
|
1449
|
+
* **Usage:** If you have 100 configurations in your instance, and you want to retrieve configurations 26 through 50,
|
|
1450
|
+
* use
|
|
1451
|
+
* `..?offset=25&limit=25`.
|
|
1452
|
+
* @param {number} [params.limit] - The number of configurations to retrieve. By default, list operations return the
|
|
1453
|
+
* first 200 items. To retrieve a different set of items, use `limit` with `offset` to page through your available
|
|
1454
|
+
* resources. Maximum limit allowed is 1000 secrets.
|
|
1455
|
+
*
|
|
1456
|
+
* **Usage:** If you want to retrieve only the first 25 configurations in your instance, use
|
|
1457
|
+
* `..?limit=25`.
|
|
1458
|
+
* @param {string} [params.sort] - Sort a collection of configurations by the specified field in ascending order. To
|
|
1459
|
+
* sort in descending order use the `-` character
|
|
1460
|
+
*
|
|
1461
|
+
*
|
|
1462
|
+
* **Available values:** config_type | secret_type | name
|
|
1463
|
+
*
|
|
1464
|
+
* **Usage:** To sort a list of configurations by their creation date, use
|
|
1465
|
+
* `../configurations?sort=config_type`.
|
|
1466
|
+
* @param {string} [params.search] - Obtain a collection of configurations that contain the specified string in one or
|
|
1467
|
+
* more of the fields: `name`, `config_type`, `secret_type`.
|
|
1468
|
+
*
|
|
1469
|
+
* **Usage:** If you want to list only the configurations that contain the string `text`, use
|
|
1470
|
+
* `../secrets?search=text`.
|
|
1471
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1472
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.ConfigurationMetadataPaginatedCollection>>}
|
|
1473
|
+
*/
|
|
1474
|
+
SecretsManagerV2.prototype.listConfigurations = function (params) {
|
|
1475
|
+
var _params = __assign({}, params);
|
|
1476
|
+
var _requiredParams = [];
|
|
1477
|
+
var _validParams = ['offset', 'limit', 'sort', 'search', 'headers'];
|
|
1478
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1479
|
+
if (_validationErrors) {
|
|
1480
|
+
return Promise.reject(_validationErrors);
|
|
1481
|
+
}
|
|
1482
|
+
var query = {
|
|
1483
|
+
'offset': _params.offset,
|
|
1484
|
+
'limit': _params.limit,
|
|
1485
|
+
'sort': _params.sort,
|
|
1486
|
+
'search': _params.search,
|
|
1487
|
+
};
|
|
1488
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'listConfigurations');
|
|
1489
|
+
var parameters = {
|
|
1490
|
+
options: {
|
|
1491
|
+
url: '/api/v2/configurations',
|
|
1492
|
+
method: 'GET',
|
|
1493
|
+
qs: query,
|
|
1494
|
+
},
|
|
1495
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1496
|
+
headers: extend(true, sdkHeaders, {
|
|
1497
|
+
'Accept': 'application/json',
|
|
1498
|
+
}, _params.headers),
|
|
1499
|
+
}),
|
|
1500
|
+
};
|
|
1501
|
+
return this.createRequest(parameters);
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Get a configuration.
|
|
1505
|
+
*
|
|
1506
|
+
* Get a configuration by specifying its name.
|
|
1507
|
+
*
|
|
1508
|
+
* A successful request returns the details of your configuration.
|
|
1509
|
+
*
|
|
1510
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1511
|
+
* @param {string} params.name - The name that uniquely identifies a configuration.
|
|
1512
|
+
* @param {string} [params.xSmAcceptConfigurationType] - The configuration type of this configuration - use this
|
|
1513
|
+
* header to resolve 300 error responses.
|
|
1514
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1515
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.Configuration>>}
|
|
1516
|
+
*/
|
|
1517
|
+
SecretsManagerV2.prototype.getConfiguration = function (params) {
|
|
1518
|
+
var _params = __assign({}, params);
|
|
1519
|
+
var _requiredParams = ['name'];
|
|
1520
|
+
var _validParams = ['name', 'xSmAcceptConfigurationType', 'headers'];
|
|
1521
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1522
|
+
if (_validationErrors) {
|
|
1523
|
+
return Promise.reject(_validationErrors);
|
|
1524
|
+
}
|
|
1525
|
+
var path = {
|
|
1526
|
+
'name': _params.name,
|
|
1527
|
+
};
|
|
1528
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getConfiguration');
|
|
1529
|
+
var parameters = {
|
|
1530
|
+
options: {
|
|
1531
|
+
url: '/api/v2/configurations/{name}',
|
|
1532
|
+
method: 'GET',
|
|
1533
|
+
path: path,
|
|
1534
|
+
},
|
|
1535
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1536
|
+
headers: extend(true, sdkHeaders, {
|
|
1537
|
+
'Accept': 'application/json',
|
|
1538
|
+
'X-Sm-Accept-Configuration-Type': _params.xSmAcceptConfigurationType,
|
|
1539
|
+
}, _params.headers),
|
|
1540
|
+
}),
|
|
1541
|
+
};
|
|
1542
|
+
return this.createRequest(parameters);
|
|
1543
|
+
};
|
|
1544
|
+
/**
|
|
1545
|
+
* Update configuration.
|
|
1546
|
+
*
|
|
1547
|
+
* Update a configuration.
|
|
1548
|
+
*
|
|
1549
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1550
|
+
* @param {string} params.name - The name that uniquely identifies a configuration.
|
|
1551
|
+
* @param {ConfigurationPatch} params.configurationPatch -
|
|
1552
|
+
* @param {string} [params.xSmAcceptConfigurationType] - The configuration type of this configuration - use this
|
|
1553
|
+
* header to resolve 300 error responses.
|
|
1554
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1555
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.Configuration>>}
|
|
1556
|
+
*/
|
|
1557
|
+
SecretsManagerV2.prototype.updateConfiguration = function (params) {
|
|
1558
|
+
var _params = __assign({}, params);
|
|
1559
|
+
var _requiredParams = ['name', 'configurationPatch'];
|
|
1560
|
+
var _validParams = ['name', 'configurationPatch', 'xSmAcceptConfigurationType', 'headers'];
|
|
1561
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1562
|
+
if (_validationErrors) {
|
|
1563
|
+
return Promise.reject(_validationErrors);
|
|
1564
|
+
}
|
|
1565
|
+
var body = _params.configurationPatch;
|
|
1566
|
+
var path = {
|
|
1567
|
+
'name': _params.name,
|
|
1568
|
+
};
|
|
1569
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'updateConfiguration');
|
|
1570
|
+
var parameters = {
|
|
1571
|
+
options: {
|
|
1572
|
+
url: '/api/v2/configurations/{name}',
|
|
1573
|
+
method: 'PATCH',
|
|
1574
|
+
body: body,
|
|
1575
|
+
path: path,
|
|
1576
|
+
},
|
|
1577
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1578
|
+
headers: extend(true, sdkHeaders, {
|
|
1579
|
+
'Accept': 'application/json',
|
|
1580
|
+
'Content-Type': 'application/merge-patch+json',
|
|
1581
|
+
'X-Sm-Accept-Configuration-Type': _params.xSmAcceptConfigurationType,
|
|
1582
|
+
}, _params.headers),
|
|
1583
|
+
}),
|
|
1584
|
+
};
|
|
1585
|
+
return this.createRequest(parameters);
|
|
1586
|
+
};
|
|
1587
|
+
/**
|
|
1588
|
+
* Delete a configuration.
|
|
1589
|
+
*
|
|
1590
|
+
* Delete a configuration by specifying its name.
|
|
1591
|
+
*
|
|
1592
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1593
|
+
* @param {string} params.name - The name that uniquely identifies a configuration.
|
|
1594
|
+
* @param {string} [params.xSmAcceptConfigurationType] - The configuration type of this configuration - use this
|
|
1595
|
+
* header to resolve 300 error responses.
|
|
1596
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1597
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.EmptyObject>>}
|
|
1598
|
+
*/
|
|
1599
|
+
SecretsManagerV2.prototype.deleteConfiguration = function (params) {
|
|
1600
|
+
var _params = __assign({}, params);
|
|
1601
|
+
var _requiredParams = ['name'];
|
|
1602
|
+
var _validParams = ['name', 'xSmAcceptConfigurationType', 'headers'];
|
|
1603
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1604
|
+
if (_validationErrors) {
|
|
1605
|
+
return Promise.reject(_validationErrors);
|
|
1606
|
+
}
|
|
1607
|
+
var path = {
|
|
1608
|
+
'name': _params.name,
|
|
1609
|
+
};
|
|
1610
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteConfiguration');
|
|
1611
|
+
var parameters = {
|
|
1612
|
+
options: {
|
|
1613
|
+
url: '/api/v2/configurations/{name}',
|
|
1614
|
+
method: 'DELETE',
|
|
1615
|
+
path: path,
|
|
1616
|
+
},
|
|
1617
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1618
|
+
headers: extend(true, sdkHeaders, {
|
|
1619
|
+
'X-Sm-Accept-Configuration-Type': _params.xSmAcceptConfigurationType,
|
|
1620
|
+
}, _params.headers),
|
|
1621
|
+
}),
|
|
1622
|
+
};
|
|
1623
|
+
return this.createRequest(parameters);
|
|
1624
|
+
};
|
|
1625
|
+
/**
|
|
1626
|
+
* Create a configuration action.
|
|
1627
|
+
*
|
|
1628
|
+
* Create a configuration action. This operation supports the following actions:
|
|
1629
|
+
*
|
|
1630
|
+
* - `private_cert_configuration_action_sign_intermediate`: Sign an intermediate certificate authority.
|
|
1631
|
+
* - `private_cert_configuration_action_sign_csr`: Sign a certificate signing request.
|
|
1632
|
+
* - `private_cert_configuration_action_set_signed`: Set a signed intermediate certificate authority.
|
|
1633
|
+
* - `private_cert_configuration_action_revoke_ca_certificate`: Revoke an internally signed intermediate certificate
|
|
1634
|
+
* authority certificate.
|
|
1635
|
+
* - `private_cert_configuration_action_rotate_crl`: Rotate the certificate revocation list (CRL) of an intermediate
|
|
1636
|
+
* certificate authority.
|
|
1637
|
+
*
|
|
1638
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1639
|
+
* @param {string} params.name - The name that uniquely identifies a configuration.
|
|
1640
|
+
* @param {ConfigurationActionPrototype} params.configActionPrototype -
|
|
1641
|
+
* @param {string} [params.xSmAcceptConfigurationType] - The configuration type of this configuration - use this
|
|
1642
|
+
* header to resolve 300 error responses.
|
|
1643
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1644
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.ConfigurationAction>>}
|
|
1645
|
+
*/
|
|
1646
|
+
SecretsManagerV2.prototype.createConfigurationAction = function (params) {
|
|
1647
|
+
var _params = __assign({}, params);
|
|
1648
|
+
var _requiredParams = ['name', 'configActionPrototype'];
|
|
1649
|
+
var _validParams = ['name', 'configActionPrototype', 'xSmAcceptConfigurationType', 'headers'];
|
|
1650
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1651
|
+
if (_validationErrors) {
|
|
1652
|
+
return Promise.reject(_validationErrors);
|
|
1653
|
+
}
|
|
1654
|
+
var body = _params.configActionPrototype;
|
|
1655
|
+
var path = {
|
|
1656
|
+
'name': _params.name,
|
|
1657
|
+
};
|
|
1658
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createConfigurationAction');
|
|
1659
|
+
var parameters = {
|
|
1660
|
+
options: {
|
|
1661
|
+
url: '/api/v2/configurations/{name}/actions',
|
|
1662
|
+
method: 'POST',
|
|
1663
|
+
body: body,
|
|
1664
|
+
path: path,
|
|
1665
|
+
},
|
|
1666
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1667
|
+
headers: extend(true, sdkHeaders, {
|
|
1668
|
+
'Accept': 'application/json',
|
|
1669
|
+
'Content-Type': 'application/json',
|
|
1670
|
+
'X-Sm-Accept-Configuration-Type': _params.xSmAcceptConfigurationType,
|
|
1671
|
+
}, _params.headers),
|
|
1672
|
+
}),
|
|
1673
|
+
};
|
|
1674
|
+
return this.createRequest(parameters);
|
|
1675
|
+
};
|
|
1676
|
+
/*************************
|
|
1677
|
+
* notifications
|
|
1678
|
+
************************/
|
|
1679
|
+
/**
|
|
1680
|
+
* Register with Event Notifications instance.
|
|
1681
|
+
*
|
|
1682
|
+
* Create a registration between a Secrets Manager instance and [Event
|
|
1683
|
+
* Notifications](https://cloud.ibm.com/apidocs/event-notifications).
|
|
1684
|
+
*
|
|
1685
|
+
* A successful request adds Secrets Manager as a source that you can reference from your Event Notifications
|
|
1686
|
+
* instance. For more information about enabling notifications for Secrets Manager, check out the
|
|
1687
|
+
* [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-event-notifications).
|
|
1688
|
+
*
|
|
1689
|
+
* @param {Object} params - The parameters to send to the service.
|
|
1690
|
+
* @param {string} params.eventNotificationsInstanceCrn - A CRN that uniquely identifies an IBM Cloud resource.
|
|
1691
|
+
* @param {string} params.eventNotificationsSourceName - The name that is displayed as a source that is in your Event
|
|
1692
|
+
* Notifications instance.
|
|
1693
|
+
* @param {string} [params.eventNotificationsSourceDescription] - An optional description for the source that is in
|
|
1694
|
+
* your Event Notifications instance.
|
|
1695
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1696
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.NotificationsRegistration>>}
|
|
1697
|
+
*/
|
|
1698
|
+
SecretsManagerV2.prototype.createNotificationsRegistration = function (params) {
|
|
1699
|
+
var _params = __assign({}, params);
|
|
1700
|
+
var _requiredParams = ['eventNotificationsInstanceCrn', 'eventNotificationsSourceName'];
|
|
1701
|
+
var _validParams = ['eventNotificationsInstanceCrn', 'eventNotificationsSourceName', 'eventNotificationsSourceDescription', 'headers'];
|
|
1702
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1703
|
+
if (_validationErrors) {
|
|
1704
|
+
return Promise.reject(_validationErrors);
|
|
1705
|
+
}
|
|
1706
|
+
var body = {
|
|
1707
|
+
'event_notifications_instance_crn': _params.eventNotificationsInstanceCrn,
|
|
1708
|
+
'event_notifications_source_name': _params.eventNotificationsSourceName,
|
|
1709
|
+
'event_notifications_source_description': _params.eventNotificationsSourceDescription,
|
|
1710
|
+
};
|
|
1711
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'createNotificationsRegistration');
|
|
1712
|
+
var parameters = {
|
|
1713
|
+
options: {
|
|
1714
|
+
url: '/api/v2/notifications/registration',
|
|
1715
|
+
method: 'POST',
|
|
1716
|
+
body: body,
|
|
1717
|
+
},
|
|
1718
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1719
|
+
headers: extend(true, sdkHeaders, {
|
|
1720
|
+
'Accept': 'application/json',
|
|
1721
|
+
'Content-Type': 'application/json',
|
|
1722
|
+
}, _params.headers),
|
|
1723
|
+
}),
|
|
1724
|
+
};
|
|
1725
|
+
return this.createRequest(parameters);
|
|
1726
|
+
};
|
|
1727
|
+
/**
|
|
1728
|
+
* Get Event Notifications registration details.
|
|
1729
|
+
*
|
|
1730
|
+
* Get the details of the registration between your Secrets Manager instance and Event Notifications.
|
|
1731
|
+
*
|
|
1732
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
1733
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1734
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.NotificationsRegistration>>}
|
|
1735
|
+
*/
|
|
1736
|
+
SecretsManagerV2.prototype.getNotificationsRegistration = function (params) {
|
|
1737
|
+
var _params = __assign({}, params);
|
|
1738
|
+
var _requiredParams = [];
|
|
1739
|
+
var _validParams = ['headers'];
|
|
1740
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1741
|
+
if (_validationErrors) {
|
|
1742
|
+
return Promise.reject(_validationErrors);
|
|
1743
|
+
}
|
|
1744
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getNotificationsRegistration');
|
|
1745
|
+
var parameters = {
|
|
1746
|
+
options: {
|
|
1747
|
+
url: '/api/v2/notifications/registration',
|
|
1748
|
+
method: 'GET',
|
|
1749
|
+
},
|
|
1750
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1751
|
+
headers: extend(true, sdkHeaders, {
|
|
1752
|
+
'Accept': 'application/json',
|
|
1753
|
+
}, _params.headers),
|
|
1754
|
+
}),
|
|
1755
|
+
};
|
|
1756
|
+
return this.createRequest(parameters);
|
|
1757
|
+
};
|
|
1758
|
+
/**
|
|
1759
|
+
* Unregister from Event Notifications instance.
|
|
1760
|
+
*
|
|
1761
|
+
* Delete the registration between your Secrets Manager instance and Event Notifications.
|
|
1762
|
+
*
|
|
1763
|
+
* A successful request removes your Secrets Manager instance as a source in Event Notifications.
|
|
1764
|
+
*
|
|
1765
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
1766
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1767
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.EmptyObject>>}
|
|
1768
|
+
*/
|
|
1769
|
+
SecretsManagerV2.prototype.deleteNotificationsRegistration = function (params) {
|
|
1770
|
+
var _params = __assign({}, params);
|
|
1771
|
+
var _requiredParams = [];
|
|
1772
|
+
var _validParams = ['headers'];
|
|
1773
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1774
|
+
if (_validationErrors) {
|
|
1775
|
+
return Promise.reject(_validationErrors);
|
|
1776
|
+
}
|
|
1777
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteNotificationsRegistration');
|
|
1778
|
+
var parameters = {
|
|
1779
|
+
options: {
|
|
1780
|
+
url: '/api/v2/notifications/registration',
|
|
1781
|
+
method: 'DELETE',
|
|
1782
|
+
},
|
|
1783
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1784
|
+
headers: extend(true, sdkHeaders, {}, _params.headers),
|
|
1785
|
+
}),
|
|
1786
|
+
};
|
|
1787
|
+
return this.createRequest(parameters);
|
|
1788
|
+
};
|
|
1789
|
+
/**
|
|
1790
|
+
* Send a test event for Event Notifications registrations.
|
|
1791
|
+
*
|
|
1792
|
+
* Send a test event from a Secrets Manager instance to a configured [Event
|
|
1793
|
+
* Notifications](https://cloud.ibm.com/apidocs/event-notifications) instance.
|
|
1794
|
+
*
|
|
1795
|
+
* A successful request sends a test event to the Event Notifications instance. For more information about enabling
|
|
1796
|
+
* notifications for Secrets Manager, check out the
|
|
1797
|
+
* [docs](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-event-notifications).
|
|
1798
|
+
*
|
|
1799
|
+
* @param {Object} [params] - The parameters to send to the service.
|
|
1800
|
+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
|
|
1801
|
+
* @returns {Promise<SecretsManagerV2.Response<SecretsManagerV2.EmptyObject>>}
|
|
1802
|
+
*/
|
|
1803
|
+
SecretsManagerV2.prototype.getNotificationsRegistrationTest = function (params) {
|
|
1804
|
+
var _params = __assign({}, params);
|
|
1805
|
+
var _requiredParams = [];
|
|
1806
|
+
var _validParams = ['headers'];
|
|
1807
|
+
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
|
|
1808
|
+
if (_validationErrors) {
|
|
1809
|
+
return Promise.reject(_validationErrors);
|
|
1810
|
+
}
|
|
1811
|
+
var sdkHeaders = (0, common_1.getSdkHeaders)(SecretsManagerV2.DEFAULT_SERVICE_NAME, 'v2', 'getNotificationsRegistrationTest');
|
|
1812
|
+
var parameters = {
|
|
1813
|
+
options: {
|
|
1814
|
+
url: '/api/v2/notifications/registration/test',
|
|
1815
|
+
method: 'GET',
|
|
1816
|
+
},
|
|
1817
|
+
defaultOptions: extend(true, {}, this.baseOptions, {
|
|
1818
|
+
headers: extend(true, sdkHeaders, {}, _params.headers),
|
|
1819
|
+
}),
|
|
1820
|
+
};
|
|
1821
|
+
return this.createRequest(parameters);
|
|
1822
|
+
};
|
|
1823
|
+
SecretsManagerV2.DEFAULT_SERVICE_URL = 'https://provide-here-your-smgr-instanceuuid.us-south.secrets-manager.appdomain.cloud';
|
|
1824
|
+
SecretsManagerV2.DEFAULT_SERVICE_NAME = 'secrets_manager';
|
|
1825
|
+
SecretsManagerV2.PARAMETERIZED_SERVICE_URL = 'https://{instance_id}.{region}.secrets-manager.appdomain.cloud';
|
|
1826
|
+
SecretsManagerV2.defaultUrlVariables = new Map([
|
|
1827
|
+
['instance_id', 'provide-here-your-smgr-instanceuuid'],
|
|
1828
|
+
['region', 'us-south'],
|
|
1829
|
+
]);
|
|
1830
|
+
return SecretsManagerV2;
|
|
1831
|
+
}(ibm_cloud_sdk_core_1.BaseService));
|
|
1832
|
+
/*************************
|
|
1833
|
+
* interfaces
|
|
1834
|
+
************************/
|
|
1835
|
+
(function (SecretsManagerV2) {
|
|
1836
|
+
/** Constants for the `createSecretLocksBulk` operation. */
|
|
1837
|
+
var CreateSecretLocksBulkConstants;
|
|
1838
|
+
(function (CreateSecretLocksBulkConstants) {
|
|
1839
|
+
/** An optional lock mode. When you create a lock, you can set one of the following modes to clear any matching locks on a secret version. - `remove_previous`: Removes any other locks with matching names if they are found in the previous version of the secret. - `remove_previous_and_delete`: Completes the same action as `remove_previous`, but also permanently deletes the data of the previous secret version if it doesn't have any locks. */
|
|
1840
|
+
var Mode;
|
|
1841
|
+
(function (Mode) {
|
|
1842
|
+
Mode["REMOVE_PREVIOUS"] = "remove_previous";
|
|
1843
|
+
Mode["REMOVE_PREVIOUS_AND_DELETE"] = "remove_previous_and_delete";
|
|
1844
|
+
})(Mode = CreateSecretLocksBulkConstants.Mode || (CreateSecretLocksBulkConstants.Mode = {}));
|
|
1845
|
+
})(CreateSecretLocksBulkConstants = SecretsManagerV2.CreateSecretLocksBulkConstants || (SecretsManagerV2.CreateSecretLocksBulkConstants = {}));
|
|
1846
|
+
/** Constants for the `createSecretVersionLocksBulk` operation. */
|
|
1847
|
+
var CreateSecretVersionLocksBulkConstants;
|
|
1848
|
+
(function (CreateSecretVersionLocksBulkConstants) {
|
|
1849
|
+
/** An optional lock mode. When you create a lock, you can set one of the following modes to clear any matching locks on a secret version. - `remove_previous`: Removes any other locks with matching names if they are found in the previous version of the secret. - `remove_previous_and_delete`: Completes the same action as `remove_previous`, but also permanently deletes the data of the previous secret version if it doesn't have any locks. */
|
|
1850
|
+
var Mode;
|
|
1851
|
+
(function (Mode) {
|
|
1852
|
+
Mode["REMOVE_PREVIOUS"] = "remove_previous";
|
|
1853
|
+
Mode["REMOVE_PREVIOUS_AND_DELETE"] = "remove_previous_and_delete";
|
|
1854
|
+
})(Mode = CreateSecretVersionLocksBulkConstants.Mode || (CreateSecretVersionLocksBulkConstants.Mode = {}));
|
|
1855
|
+
})(CreateSecretVersionLocksBulkConstants = SecretsManagerV2.CreateSecretVersionLocksBulkConstants || (SecretsManagerV2.CreateSecretVersionLocksBulkConstants = {}));
|
|
1856
|
+
/** Constants for the `getConfiguration` operation. */
|
|
1857
|
+
var GetConfigurationConstants;
|
|
1858
|
+
(function (GetConfigurationConstants) {
|
|
1859
|
+
/** The configuration type of this configuration - use this header to resolve 300 error responses. */
|
|
1860
|
+
var XSmAcceptConfigurationType;
|
|
1861
|
+
(function (XSmAcceptConfigurationType) {
|
|
1862
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_CA_LETS_ENCRYPT"] = "public_cert_configuration_ca_lets_encrypt";
|
|
1863
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLASSIC_INFRASTRUCTURE"] = "public_cert_configuration_dns_classic_infrastructure";
|
|
1864
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLOUD_INTERNET_SERVICES"] = "public_cert_configuration_dns_cloud_internet_services";
|
|
1865
|
+
XSmAcceptConfigurationType["IAM_CREDENTIALS_CONFIGURATION"] = "iam_credentials_configuration";
|
|
1866
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_ROOT_CA"] = "private_cert_configuration_root_ca";
|
|
1867
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_INTERMEDIATE_CA"] = "private_cert_configuration_intermediate_ca";
|
|
1868
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_TEMPLATE"] = "private_cert_configuration_template";
|
|
1869
|
+
})(XSmAcceptConfigurationType = GetConfigurationConstants.XSmAcceptConfigurationType || (GetConfigurationConstants.XSmAcceptConfigurationType = {}));
|
|
1870
|
+
})(GetConfigurationConstants = SecretsManagerV2.GetConfigurationConstants || (SecretsManagerV2.GetConfigurationConstants = {}));
|
|
1871
|
+
/** Constants for the `updateConfiguration` operation. */
|
|
1872
|
+
var UpdateConfigurationConstants;
|
|
1873
|
+
(function (UpdateConfigurationConstants) {
|
|
1874
|
+
/** The configuration type of this configuration - use this header to resolve 300 error responses. */
|
|
1875
|
+
var XSmAcceptConfigurationType;
|
|
1876
|
+
(function (XSmAcceptConfigurationType) {
|
|
1877
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_CA_LETS_ENCRYPT"] = "public_cert_configuration_ca_lets_encrypt";
|
|
1878
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLASSIC_INFRASTRUCTURE"] = "public_cert_configuration_dns_classic_infrastructure";
|
|
1879
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLOUD_INTERNET_SERVICES"] = "public_cert_configuration_dns_cloud_internet_services";
|
|
1880
|
+
XSmAcceptConfigurationType["IAM_CREDENTIALS_CONFIGURATION"] = "iam_credentials_configuration";
|
|
1881
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_ROOT_CA"] = "private_cert_configuration_root_ca";
|
|
1882
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_INTERMEDIATE_CA"] = "private_cert_configuration_intermediate_ca";
|
|
1883
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_TEMPLATE"] = "private_cert_configuration_template";
|
|
1884
|
+
})(XSmAcceptConfigurationType = UpdateConfigurationConstants.XSmAcceptConfigurationType || (UpdateConfigurationConstants.XSmAcceptConfigurationType = {}));
|
|
1885
|
+
})(UpdateConfigurationConstants = SecretsManagerV2.UpdateConfigurationConstants || (SecretsManagerV2.UpdateConfigurationConstants = {}));
|
|
1886
|
+
/** Constants for the `deleteConfiguration` operation. */
|
|
1887
|
+
var DeleteConfigurationConstants;
|
|
1888
|
+
(function (DeleteConfigurationConstants) {
|
|
1889
|
+
/** The configuration type of this configuration - use this header to resolve 300 error responses. */
|
|
1890
|
+
var XSmAcceptConfigurationType;
|
|
1891
|
+
(function (XSmAcceptConfigurationType) {
|
|
1892
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_CA_LETS_ENCRYPT"] = "public_cert_configuration_ca_lets_encrypt";
|
|
1893
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLASSIC_INFRASTRUCTURE"] = "public_cert_configuration_dns_classic_infrastructure";
|
|
1894
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLOUD_INTERNET_SERVICES"] = "public_cert_configuration_dns_cloud_internet_services";
|
|
1895
|
+
XSmAcceptConfigurationType["IAM_CREDENTIALS_CONFIGURATION"] = "iam_credentials_configuration";
|
|
1896
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_ROOT_CA"] = "private_cert_configuration_root_ca";
|
|
1897
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_INTERMEDIATE_CA"] = "private_cert_configuration_intermediate_ca";
|
|
1898
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_TEMPLATE"] = "private_cert_configuration_template";
|
|
1899
|
+
})(XSmAcceptConfigurationType = DeleteConfigurationConstants.XSmAcceptConfigurationType || (DeleteConfigurationConstants.XSmAcceptConfigurationType = {}));
|
|
1900
|
+
})(DeleteConfigurationConstants = SecretsManagerV2.DeleteConfigurationConstants || (SecretsManagerV2.DeleteConfigurationConstants = {}));
|
|
1901
|
+
/** Constants for the `createConfigurationAction` operation. */
|
|
1902
|
+
var CreateConfigurationActionConstants;
|
|
1903
|
+
(function (CreateConfigurationActionConstants) {
|
|
1904
|
+
/** The configuration type of this configuration - use this header to resolve 300 error responses. */
|
|
1905
|
+
var XSmAcceptConfigurationType;
|
|
1906
|
+
(function (XSmAcceptConfigurationType) {
|
|
1907
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_CA_LETS_ENCRYPT"] = "public_cert_configuration_ca_lets_encrypt";
|
|
1908
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLASSIC_INFRASTRUCTURE"] = "public_cert_configuration_dns_classic_infrastructure";
|
|
1909
|
+
XSmAcceptConfigurationType["PUBLIC_CERT_CONFIGURATION_DNS_CLOUD_INTERNET_SERVICES"] = "public_cert_configuration_dns_cloud_internet_services";
|
|
1910
|
+
XSmAcceptConfigurationType["IAM_CREDENTIALS_CONFIGURATION"] = "iam_credentials_configuration";
|
|
1911
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_ROOT_CA"] = "private_cert_configuration_root_ca";
|
|
1912
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_INTERMEDIATE_CA"] = "private_cert_configuration_intermediate_ca";
|
|
1913
|
+
XSmAcceptConfigurationType["PRIVATE_CERT_CONFIGURATION_TEMPLATE"] = "private_cert_configuration_template";
|
|
1914
|
+
})(XSmAcceptConfigurationType = CreateConfigurationActionConstants.XSmAcceptConfigurationType || (CreateConfigurationActionConstants.XSmAcceptConfigurationType = {}));
|
|
1915
|
+
})(CreateConfigurationActionConstants = SecretsManagerV2.CreateConfigurationActionConstants || (SecretsManagerV2.CreateConfigurationActionConstants = {}));
|
|
1916
|
+
/*************************
|
|
1917
|
+
* pager classes
|
|
1918
|
+
************************/
|
|
1919
|
+
/**
|
|
1920
|
+
* SecretsPager can be used to simplify the use of listSecrets().
|
|
1921
|
+
*/
|
|
1922
|
+
var SecretsPager = /** @class */ (function () {
|
|
1923
|
+
/**
|
|
1924
|
+
* Construct a SecretsPager object.
|
|
1925
|
+
*
|
|
1926
|
+
* @param {SecretsManagerV2} client - The service client instance used to invoke listSecrets()
|
|
1927
|
+
* @param {Object} [params] - The parameters to be passed to listSecrets()
|
|
1928
|
+
* @constructor
|
|
1929
|
+
* @returns {SecretsPager}
|
|
1930
|
+
*/
|
|
1931
|
+
function SecretsPager(client, params) {
|
|
1932
|
+
if (params && params.offset) {
|
|
1933
|
+
throw new Error("the params.offset field should not be set");
|
|
1934
|
+
}
|
|
1935
|
+
this._hasNext = true;
|
|
1936
|
+
this.pageContext = { next: undefined };
|
|
1937
|
+
this.client = client;
|
|
1938
|
+
this.params = JSON.parse(JSON.stringify(params || {}));
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Returns true if there are potentially more results to be retrieved by invoking getNext().
|
|
1942
|
+
* @returns {boolean}
|
|
1943
|
+
*/
|
|
1944
|
+
SecretsPager.prototype.hasNext = function () {
|
|
1945
|
+
return this._hasNext;
|
|
1946
|
+
};
|
|
1947
|
+
/**
|
|
1948
|
+
* Returns the next page of results by invoking listSecrets().
|
|
1949
|
+
* @returns {Promise<SecretsManagerV2.SecretMetadata[]>}
|
|
1950
|
+
*/
|
|
1951
|
+
SecretsPager.prototype.getNext = function () {
|
|
1952
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1953
|
+
var response, result, next;
|
|
1954
|
+
return __generator(this, function (_a) {
|
|
1955
|
+
switch (_a.label) {
|
|
1956
|
+
case 0:
|
|
1957
|
+
if (!this.hasNext()) {
|
|
1958
|
+
throw new Error('No more results available');
|
|
1959
|
+
}
|
|
1960
|
+
if (this.pageContext.next) {
|
|
1961
|
+
this.params.offset = this.pageContext.next;
|
|
1962
|
+
}
|
|
1963
|
+
return [4 /*yield*/, this.client.listSecrets(this.params)];
|
|
1964
|
+
case 1:
|
|
1965
|
+
response = _a.sent();
|
|
1966
|
+
result = response.result;
|
|
1967
|
+
next = null;
|
|
1968
|
+
if (result && result.next) {
|
|
1969
|
+
if (result.next.href) {
|
|
1970
|
+
next = (0, ibm_cloud_sdk_core_3.getQueryParam)(result.next.href, 'offset');
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
this.pageContext.next = next;
|
|
1974
|
+
if (!this.pageContext.next) {
|
|
1975
|
+
this._hasNext = false;
|
|
1976
|
+
}
|
|
1977
|
+
return [2 /*return*/, result.secrets];
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1980
|
+
});
|
|
1981
|
+
};
|
|
1982
|
+
/**
|
|
1983
|
+
* Returns all results by invoking listSecrets() repeatedly until all pages of results have been retrieved.
|
|
1984
|
+
* @returns {Promise<SecretsManagerV2.SecretMetadata[]>}
|
|
1985
|
+
*/
|
|
1986
|
+
SecretsPager.prototype.getAll = function () {
|
|
1987
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1988
|
+
var results, nextPage;
|
|
1989
|
+
return __generator(this, function (_a) {
|
|
1990
|
+
switch (_a.label) {
|
|
1991
|
+
case 0:
|
|
1992
|
+
results = [];
|
|
1993
|
+
_a.label = 1;
|
|
1994
|
+
case 1:
|
|
1995
|
+
if (!this.hasNext()) return [3 /*break*/, 3];
|
|
1996
|
+
return [4 /*yield*/, this.getNext()];
|
|
1997
|
+
case 2:
|
|
1998
|
+
nextPage = _a.sent();
|
|
1999
|
+
results.push.apply(results, nextPage);
|
|
2000
|
+
return [3 /*break*/, 1];
|
|
2001
|
+
case 3: return [2 /*return*/, results];
|
|
2002
|
+
}
|
|
2003
|
+
});
|
|
2004
|
+
});
|
|
2005
|
+
};
|
|
2006
|
+
return SecretsPager;
|
|
2007
|
+
}());
|
|
2008
|
+
SecretsManagerV2.SecretsPager = SecretsPager;
|
|
2009
|
+
/**
|
|
2010
|
+
* SecretsLocksPager can be used to simplify the use of listSecretsLocks().
|
|
2011
|
+
*/
|
|
2012
|
+
var SecretsLocksPager = /** @class */ (function () {
|
|
2013
|
+
/**
|
|
2014
|
+
* Construct a SecretsLocksPager object.
|
|
2015
|
+
*
|
|
2016
|
+
* @param {SecretsManagerV2} client - The service client instance used to invoke listSecretsLocks()
|
|
2017
|
+
* @param {Object} [params] - The parameters to be passed to listSecretsLocks()
|
|
2018
|
+
* @constructor
|
|
2019
|
+
* @returns {SecretsLocksPager}
|
|
2020
|
+
*/
|
|
2021
|
+
function SecretsLocksPager(client, params) {
|
|
2022
|
+
if (params && params.offset) {
|
|
2023
|
+
throw new Error("the params.offset field should not be set");
|
|
2024
|
+
}
|
|
2025
|
+
this._hasNext = true;
|
|
2026
|
+
this.pageContext = { next: undefined };
|
|
2027
|
+
this.client = client;
|
|
2028
|
+
this.params = JSON.parse(JSON.stringify(params || {}));
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Returns true if there are potentially more results to be retrieved by invoking getNext().
|
|
2032
|
+
* @returns {boolean}
|
|
2033
|
+
*/
|
|
2034
|
+
SecretsLocksPager.prototype.hasNext = function () {
|
|
2035
|
+
return this._hasNext;
|
|
2036
|
+
};
|
|
2037
|
+
/**
|
|
2038
|
+
* Returns the next page of results by invoking listSecretsLocks().
|
|
2039
|
+
* @returns {Promise<SecretsManagerV2.SecretLocks[]>}
|
|
2040
|
+
*/
|
|
2041
|
+
SecretsLocksPager.prototype.getNext = function () {
|
|
2042
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2043
|
+
var response, result, next;
|
|
2044
|
+
return __generator(this, function (_a) {
|
|
2045
|
+
switch (_a.label) {
|
|
2046
|
+
case 0:
|
|
2047
|
+
if (!this.hasNext()) {
|
|
2048
|
+
throw new Error('No more results available');
|
|
2049
|
+
}
|
|
2050
|
+
if (this.pageContext.next) {
|
|
2051
|
+
this.params.offset = this.pageContext.next;
|
|
2052
|
+
}
|
|
2053
|
+
return [4 /*yield*/, this.client.listSecretsLocks(this.params)];
|
|
2054
|
+
case 1:
|
|
2055
|
+
response = _a.sent();
|
|
2056
|
+
result = response.result;
|
|
2057
|
+
next = null;
|
|
2058
|
+
if (result && result.next) {
|
|
2059
|
+
if (result.next.href) {
|
|
2060
|
+
next = (0, ibm_cloud_sdk_core_3.getQueryParam)(result.next.href, 'offset');
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
this.pageContext.next = next;
|
|
2064
|
+
if (!this.pageContext.next) {
|
|
2065
|
+
this._hasNext = false;
|
|
2066
|
+
}
|
|
2067
|
+
return [2 /*return*/, result.secrets_locks];
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
});
|
|
2071
|
+
};
|
|
2072
|
+
/**
|
|
2073
|
+
* Returns all results by invoking listSecretsLocks() repeatedly until all pages of results have been retrieved.
|
|
2074
|
+
* @returns {Promise<SecretsManagerV2.SecretLocks[]>}
|
|
2075
|
+
*/
|
|
2076
|
+
SecretsLocksPager.prototype.getAll = function () {
|
|
2077
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2078
|
+
var results, nextPage;
|
|
2079
|
+
return __generator(this, function (_a) {
|
|
2080
|
+
switch (_a.label) {
|
|
2081
|
+
case 0:
|
|
2082
|
+
results = [];
|
|
2083
|
+
_a.label = 1;
|
|
2084
|
+
case 1:
|
|
2085
|
+
if (!this.hasNext()) return [3 /*break*/, 3];
|
|
2086
|
+
return [4 /*yield*/, this.getNext()];
|
|
2087
|
+
case 2:
|
|
2088
|
+
nextPage = _a.sent();
|
|
2089
|
+
results.push.apply(results, nextPage);
|
|
2090
|
+
return [3 /*break*/, 1];
|
|
2091
|
+
case 3: return [2 /*return*/, results];
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
});
|
|
2095
|
+
};
|
|
2096
|
+
return SecretsLocksPager;
|
|
2097
|
+
}());
|
|
2098
|
+
SecretsManagerV2.SecretsLocksPager = SecretsLocksPager;
|
|
2099
|
+
/**
|
|
2100
|
+
* SecretLocksPager can be used to simplify the use of listSecretLocks().
|
|
2101
|
+
*/
|
|
2102
|
+
var SecretLocksPager = /** @class */ (function () {
|
|
2103
|
+
/**
|
|
2104
|
+
* Construct a SecretLocksPager object.
|
|
2105
|
+
*
|
|
2106
|
+
* @param {SecretsManagerV2} client - The service client instance used to invoke listSecretLocks()
|
|
2107
|
+
* @param {Object} params - The parameters to be passed to listSecretLocks()
|
|
2108
|
+
* @constructor
|
|
2109
|
+
* @returns {SecretLocksPager}
|
|
2110
|
+
*/
|
|
2111
|
+
function SecretLocksPager(client, params) {
|
|
2112
|
+
if (params && params.offset) {
|
|
2113
|
+
throw new Error("the params.offset field should not be set");
|
|
2114
|
+
}
|
|
2115
|
+
this._hasNext = true;
|
|
2116
|
+
this.pageContext = { next: undefined };
|
|
2117
|
+
this.client = client;
|
|
2118
|
+
this.params = JSON.parse(JSON.stringify(params || {}));
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Returns true if there are potentially more results to be retrieved by invoking getNext().
|
|
2122
|
+
* @returns {boolean}
|
|
2123
|
+
*/
|
|
2124
|
+
SecretLocksPager.prototype.hasNext = function () {
|
|
2125
|
+
return this._hasNext;
|
|
2126
|
+
};
|
|
2127
|
+
/**
|
|
2128
|
+
* Returns the next page of results by invoking listSecretLocks().
|
|
2129
|
+
* @returns {Promise<SecretsManagerV2.SecretLock[]>}
|
|
2130
|
+
*/
|
|
2131
|
+
SecretLocksPager.prototype.getNext = function () {
|
|
2132
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2133
|
+
var response, result, next;
|
|
2134
|
+
return __generator(this, function (_a) {
|
|
2135
|
+
switch (_a.label) {
|
|
2136
|
+
case 0:
|
|
2137
|
+
if (!this.hasNext()) {
|
|
2138
|
+
throw new Error('No more results available');
|
|
2139
|
+
}
|
|
2140
|
+
if (this.pageContext.next) {
|
|
2141
|
+
this.params.offset = this.pageContext.next;
|
|
2142
|
+
}
|
|
2143
|
+
return [4 /*yield*/, this.client.listSecretLocks(this.params)];
|
|
2144
|
+
case 1:
|
|
2145
|
+
response = _a.sent();
|
|
2146
|
+
result = response.result;
|
|
2147
|
+
next = null;
|
|
2148
|
+
if (result && result.next) {
|
|
2149
|
+
if (result.next.href) {
|
|
2150
|
+
next = (0, ibm_cloud_sdk_core_3.getQueryParam)(result.next.href, 'offset');
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
this.pageContext.next = next;
|
|
2154
|
+
if (!this.pageContext.next) {
|
|
2155
|
+
this._hasNext = false;
|
|
2156
|
+
}
|
|
2157
|
+
return [2 /*return*/, result.locks];
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
});
|
|
2161
|
+
};
|
|
2162
|
+
/**
|
|
2163
|
+
* Returns all results by invoking listSecretLocks() repeatedly until all pages of results have been retrieved.
|
|
2164
|
+
* @returns {Promise<SecretsManagerV2.SecretLock[]>}
|
|
2165
|
+
*/
|
|
2166
|
+
SecretLocksPager.prototype.getAll = function () {
|
|
2167
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2168
|
+
var results, nextPage;
|
|
2169
|
+
return __generator(this, function (_a) {
|
|
2170
|
+
switch (_a.label) {
|
|
2171
|
+
case 0:
|
|
2172
|
+
results = [];
|
|
2173
|
+
_a.label = 1;
|
|
2174
|
+
case 1:
|
|
2175
|
+
if (!this.hasNext()) return [3 /*break*/, 3];
|
|
2176
|
+
return [4 /*yield*/, this.getNext()];
|
|
2177
|
+
case 2:
|
|
2178
|
+
nextPage = _a.sent();
|
|
2179
|
+
results.push.apply(results, nextPage);
|
|
2180
|
+
return [3 /*break*/, 1];
|
|
2181
|
+
case 3: return [2 /*return*/, results];
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
});
|
|
2185
|
+
};
|
|
2186
|
+
return SecretLocksPager;
|
|
2187
|
+
}());
|
|
2188
|
+
SecretsManagerV2.SecretLocksPager = SecretLocksPager;
|
|
2189
|
+
/**
|
|
2190
|
+
* SecretVersionLocksPager can be used to simplify the use of listSecretVersionLocks().
|
|
2191
|
+
*/
|
|
2192
|
+
var SecretVersionLocksPager = /** @class */ (function () {
|
|
2193
|
+
/**
|
|
2194
|
+
* Construct a SecretVersionLocksPager object.
|
|
2195
|
+
*
|
|
2196
|
+
* @param {SecretsManagerV2} client - The service client instance used to invoke listSecretVersionLocks()
|
|
2197
|
+
* @param {Object} params - The parameters to be passed to listSecretVersionLocks()
|
|
2198
|
+
* @constructor
|
|
2199
|
+
* @returns {SecretVersionLocksPager}
|
|
2200
|
+
*/
|
|
2201
|
+
function SecretVersionLocksPager(client, params) {
|
|
2202
|
+
if (params && params.offset) {
|
|
2203
|
+
throw new Error("the params.offset field should not be set");
|
|
2204
|
+
}
|
|
2205
|
+
this._hasNext = true;
|
|
2206
|
+
this.pageContext = { next: undefined };
|
|
2207
|
+
this.client = client;
|
|
2208
|
+
this.params = JSON.parse(JSON.stringify(params || {}));
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Returns true if there are potentially more results to be retrieved by invoking getNext().
|
|
2212
|
+
* @returns {boolean}
|
|
2213
|
+
*/
|
|
2214
|
+
SecretVersionLocksPager.prototype.hasNext = function () {
|
|
2215
|
+
return this._hasNext;
|
|
2216
|
+
};
|
|
2217
|
+
/**
|
|
2218
|
+
* Returns the next page of results by invoking listSecretVersionLocks().
|
|
2219
|
+
* @returns {Promise<SecretsManagerV2.SecretLock[]>}
|
|
2220
|
+
*/
|
|
2221
|
+
SecretVersionLocksPager.prototype.getNext = function () {
|
|
2222
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2223
|
+
var response, result, next;
|
|
2224
|
+
return __generator(this, function (_a) {
|
|
2225
|
+
switch (_a.label) {
|
|
2226
|
+
case 0:
|
|
2227
|
+
if (!this.hasNext()) {
|
|
2228
|
+
throw new Error('No more results available');
|
|
2229
|
+
}
|
|
2230
|
+
if (this.pageContext.next) {
|
|
2231
|
+
this.params.offset = this.pageContext.next;
|
|
2232
|
+
}
|
|
2233
|
+
return [4 /*yield*/, this.client.listSecretVersionLocks(this.params)];
|
|
2234
|
+
case 1:
|
|
2235
|
+
response = _a.sent();
|
|
2236
|
+
result = response.result;
|
|
2237
|
+
next = null;
|
|
2238
|
+
if (result && result.next) {
|
|
2239
|
+
if (result.next.href) {
|
|
2240
|
+
next = (0, ibm_cloud_sdk_core_3.getQueryParam)(result.next.href, 'offset');
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
this.pageContext.next = next;
|
|
2244
|
+
if (!this.pageContext.next) {
|
|
2245
|
+
this._hasNext = false;
|
|
2246
|
+
}
|
|
2247
|
+
return [2 /*return*/, result.locks];
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
});
|
|
2251
|
+
};
|
|
2252
|
+
/**
|
|
2253
|
+
* Returns all results by invoking listSecretVersionLocks() repeatedly until all pages of results have been retrieved.
|
|
2254
|
+
* @returns {Promise<SecretsManagerV2.SecretLock[]>}
|
|
2255
|
+
*/
|
|
2256
|
+
SecretVersionLocksPager.prototype.getAll = function () {
|
|
2257
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2258
|
+
var results, nextPage;
|
|
2259
|
+
return __generator(this, function (_a) {
|
|
2260
|
+
switch (_a.label) {
|
|
2261
|
+
case 0:
|
|
2262
|
+
results = [];
|
|
2263
|
+
_a.label = 1;
|
|
2264
|
+
case 1:
|
|
2265
|
+
if (!this.hasNext()) return [3 /*break*/, 3];
|
|
2266
|
+
return [4 /*yield*/, this.getNext()];
|
|
2267
|
+
case 2:
|
|
2268
|
+
nextPage = _a.sent();
|
|
2269
|
+
results.push.apply(results, nextPage);
|
|
2270
|
+
return [3 /*break*/, 1];
|
|
2271
|
+
case 3: return [2 /*return*/, results];
|
|
2272
|
+
}
|
|
2273
|
+
});
|
|
2274
|
+
});
|
|
2275
|
+
};
|
|
2276
|
+
return SecretVersionLocksPager;
|
|
2277
|
+
}());
|
|
2278
|
+
SecretsManagerV2.SecretVersionLocksPager = SecretVersionLocksPager;
|
|
2279
|
+
/**
|
|
2280
|
+
* ConfigurationsPager can be used to simplify the use of listConfigurations().
|
|
2281
|
+
*/
|
|
2282
|
+
var ConfigurationsPager = /** @class */ (function () {
|
|
2283
|
+
/**
|
|
2284
|
+
* Construct a ConfigurationsPager object.
|
|
2285
|
+
*
|
|
2286
|
+
* @param {SecretsManagerV2} client - The service client instance used to invoke listConfigurations()
|
|
2287
|
+
* @param {Object} [params] - The parameters to be passed to listConfigurations()
|
|
2288
|
+
* @constructor
|
|
2289
|
+
* @returns {ConfigurationsPager}
|
|
2290
|
+
*/
|
|
2291
|
+
function ConfigurationsPager(client, params) {
|
|
2292
|
+
if (params && params.offset) {
|
|
2293
|
+
throw new Error("the params.offset field should not be set");
|
|
2294
|
+
}
|
|
2295
|
+
this._hasNext = true;
|
|
2296
|
+
this.pageContext = { next: undefined };
|
|
2297
|
+
this.client = client;
|
|
2298
|
+
this.params = JSON.parse(JSON.stringify(params || {}));
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Returns true if there are potentially more results to be retrieved by invoking getNext().
|
|
2302
|
+
* @returns {boolean}
|
|
2303
|
+
*/
|
|
2304
|
+
ConfigurationsPager.prototype.hasNext = function () {
|
|
2305
|
+
return this._hasNext;
|
|
2306
|
+
};
|
|
2307
|
+
/**
|
|
2308
|
+
* Returns the next page of results by invoking listConfigurations().
|
|
2309
|
+
* @returns {Promise<SecretsManagerV2.ConfigurationMetadata[]>}
|
|
2310
|
+
*/
|
|
2311
|
+
ConfigurationsPager.prototype.getNext = function () {
|
|
2312
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2313
|
+
var response, result, next;
|
|
2314
|
+
return __generator(this, function (_a) {
|
|
2315
|
+
switch (_a.label) {
|
|
2316
|
+
case 0:
|
|
2317
|
+
if (!this.hasNext()) {
|
|
2318
|
+
throw new Error('No more results available');
|
|
2319
|
+
}
|
|
2320
|
+
if (this.pageContext.next) {
|
|
2321
|
+
this.params.offset = this.pageContext.next;
|
|
2322
|
+
}
|
|
2323
|
+
return [4 /*yield*/, this.client.listConfigurations(this.params)];
|
|
2324
|
+
case 1:
|
|
2325
|
+
response = _a.sent();
|
|
2326
|
+
result = response.result;
|
|
2327
|
+
next = null;
|
|
2328
|
+
if (result && result.next) {
|
|
2329
|
+
if (result.next.href) {
|
|
2330
|
+
next = (0, ibm_cloud_sdk_core_3.getQueryParam)(result.next.href, 'offset');
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
this.pageContext.next = next;
|
|
2334
|
+
if (!this.pageContext.next) {
|
|
2335
|
+
this._hasNext = false;
|
|
2336
|
+
}
|
|
2337
|
+
return [2 /*return*/, result.configurations];
|
|
2338
|
+
}
|
|
2339
|
+
});
|
|
2340
|
+
});
|
|
2341
|
+
};
|
|
2342
|
+
/**
|
|
2343
|
+
* Returns all results by invoking listConfigurations() repeatedly until all pages of results have been retrieved.
|
|
2344
|
+
* @returns {Promise<SecretsManagerV2.ConfigurationMetadata[]>}
|
|
2345
|
+
*/
|
|
2346
|
+
ConfigurationsPager.prototype.getAll = function () {
|
|
2347
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2348
|
+
var results, nextPage;
|
|
2349
|
+
return __generator(this, function (_a) {
|
|
2350
|
+
switch (_a.label) {
|
|
2351
|
+
case 0:
|
|
2352
|
+
results = [];
|
|
2353
|
+
_a.label = 1;
|
|
2354
|
+
case 1:
|
|
2355
|
+
if (!this.hasNext()) return [3 /*break*/, 3];
|
|
2356
|
+
return [4 /*yield*/, this.getNext()];
|
|
2357
|
+
case 2:
|
|
2358
|
+
nextPage = _a.sent();
|
|
2359
|
+
results.push.apply(results, nextPage);
|
|
2360
|
+
return [3 /*break*/, 1];
|
|
2361
|
+
case 3: return [2 /*return*/, results];
|
|
2362
|
+
}
|
|
2363
|
+
});
|
|
2364
|
+
});
|
|
2365
|
+
};
|
|
2366
|
+
return ConfigurationsPager;
|
|
2367
|
+
}());
|
|
2368
|
+
SecretsManagerV2.ConfigurationsPager = ConfigurationsPager;
|
|
2369
|
+
})(SecretsManagerV2 || (SecretsManagerV2 = {}));
|
|
2370
|
+
module.exports = SecretsManagerV2;
|
|
2371
|
+
//# sourceMappingURL=v2.js.map
|