@ibm-cloud/secrets-manager 1.0.44 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.releaserc CHANGED
@@ -12,7 +12,10 @@
12
12
  ["@semantic-release/commit-analyzer", {
13
13
  "preset": "angular",
14
14
  "releaseRules": [
15
- {"type": "release","release": "patch"}
15
+ {"type": "release","release": "patch"},
16
+ {"type": "major","release": "major"},
17
+ {"type": "minor","release": "minor"},
18
+ {"type": "patch","release": "patch"}
16
19
  ]}],
17
20
  ],
18
21
  "generateNotes": [
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [2.0.1](https://github.com/IBM/secrets-manager-node-sdk/compare/v2.0.0...v2.0.1) (2023-09-19)
2
+
3
+ # [2.0.0](https://github.com/IBM/secrets-manager-node-sdk/compare/v1.0.44...v2.0.0) (2023-04-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * new SM v2 API release ([abd88e0](https://github.com/IBM/secrets-manager-node-sdk/commit/abd88e0825bd524f6601d7b682dd79e69323e7d6))
9
+
10
+
11
+ ### BREAKING CHANGES
12
+
13
+ * new v2 API.
14
+
15
+ Signed-off-by: yuval-shlomo-dekel <yuval.shlomo.dekel@ibm.com>
16
+
1
17
  ## [1.0.44](https://github.com/IBM/secrets-manager-node-sdk/compare/v1.0.43...v1.0.44) (2023-02-15)
2
18
 
3
19
  ## [1.0.43](https://github.com/IBM/secrets-manager-node-sdk/compare/v1.0.42...v1.0.43) (2023-01-08)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![tests](https://github.com/IBM/secrets-manager-node-sdk/workflows/run-tests/badge.svg)
2
2
 
3
- # IBM Cloud Secrets Manager Node.js SDK
3
+ # IBM Cloud Secrets Manager Node SDK
4
4
 
5
5
  A Node.js client library to interact with
6
6
  the [IBM Cloud® Secrets Manager APIs](https://cloud.ibm.com/apidocs/secrets-manager).
@@ -28,7 +28,7 @@ services:
28
28
 
29
29
  | Service name | Import path |
30
30
  |------------------------------------------------------------------|-----------------------------------------------|
31
- | [Secrets Manager](https://cloud.ibm.com/apidocs/secrets-manager) | @ibm-cloud/secrets-manager/secrets-manager/v1 |
31
+ | [Secrets Manager](https://cloud.ibm.com/apidocs/secrets-manager) | @ibm-cloud/secrets-manager/secrets-manager/v2 |
32
32
 
33
33
  ## Prerequisites
34
34
 
@@ -98,7 +98,7 @@ the [IBM Node.js SDK Core documentation](https://github.com/IBM/node-sdk-core/bl
98
98
  Construct a service client and use it to create and retrieve a secret from your Secrets Manager instance.
99
99
 
100
100
  ```js
101
- const SecretsManager = require('@ibm-cloud/secrets-manager/secrets-manager/v1');
101
+ const SecretsManager = require('@ibm-cloud/secrets-manager/secrets-manager/v2');
102
102
  const { IamAuthenticator } = require('@ibm-cloud/secrets-manager/auth');
103
103
 
104
104
 
@@ -117,46 +117,40 @@ async function secretsManagerSdkExample() {
117
117
 
118
118
  // Use the Secrets Manager API to create a secret
119
119
  let res = await secretsManager.createSecret({
120
- secretType: 'username_password',
121
- 'metadata': {
122
- 'collection_type': 'application/vnd.ibm.secrets-manager.secret+json',
123
- 'collection_total': 1,
124
- },
125
- 'resources': [
126
- {
127
- 'name': 'example-username-password-secret',
128
- 'description': 'Extended description for this secret.',
129
- 'username': 'user123',
130
- 'password': '123456789',
131
- 'labels': ['label1', 'label2'],
132
- 'expiration_date': '2030-04-01T09:30:00Z',
133
- },
134
- ],
120
+ secretPrototype: {
121
+ custom_metadata: { metadata_custom_key: 'metadata_custom_value' },
122
+ description: 'Description of my arbitrary secret.',
123
+ expiration_date: '2023-10-05T11:49:42Z',
124
+ labels: ['dev', 'us-south'],
125
+ name: 'example-arbitrary-secret',
126
+ secret_group_id: 'default',
127
+ secret_type: 'arbitrary',
128
+ payload: 'secret-data',
129
+ version_custom_metadata: { custom_version_key: 'custom_version_value' },
130
+ }
135
131
  });
136
132
 
137
- console.log('Secret created:\n' + JSON.stringify(res.result.resources[0], null, 2));
133
+ console.log('Secret created:\n' + JSON.stringify(res.result, null, 2));
138
134
 
139
135
  // Get the ID of the newly created secret
140
- const secretId = res.result.resources[0].id;
136
+ const secretId = res.result.id;
141
137
 
142
138
  // Use the Secrets Manager API to get the secret using the secret ID
143
139
  res = await secretsManager.getSecret({
144
- secretType: 'username_password',
145
140
  id: secretId,
146
141
  });
147
142
 
148
- console.log('Get secret:\n', JSON.stringify(res.result.resources, null, 2));
143
+ console.log('Get secret:\n', JSON.stringify(res.result, null, 2));
149
144
  }
150
145
 
151
146
  secretsManagerSdkExample();
152
147
 
153
148
  ```
154
149
 
155
- To delete a secret, specify the `secretType` and its `id`.
150
+ To delete a secret, specify its `id`.
156
151
 
157
152
  ```js
158
153
  res = await secretsManager.deleteSecret({
159
- secretType: 'username_password',
160
154
  id: secretId,
161
155
  });
162
156
 
@@ -168,26 +162,14 @@ Create a secret group, and then add a new secret to this group.
168
162
 
169
163
  ```js
170
164
  // Create a secret group
171
- const createGroupParams = {
172
- metadata: {
173
- collection_type: 'application/vnd.ibm.secrets-manager.secret.group+json',
174
- collection_total: 1,
175
- },
176
- resources: [{ name: 'Test Group', description: 'Group my test secrets' }],
177
- };
165
+ const createGroupParams = { name: 'Test Group', description: 'Group my test secrets' };
178
166
 
179
167
  let res = await secretsManager.createSecretGroup(createGroupParams);
180
- const secretGroupId = res.result.resources[0].id;
168
+ const secretGroupId = res.result.id;
181
169
 
182
170
  // Create a secret and associate it with your secret group
183
171
  res = await secretsManager.createSecret({
184
- metadata: {
185
- collection_type: 'application/vnd.ibm.secrets-manager.secret+json',
186
- collection_total: 1,
187
- },
188
- secretType: 'username_password',
189
- resources: [
190
- {
172
+ secretPrototype: {
191
173
  secret_group_id: secretGroupId,
192
174
  name: "Test secret",
193
175
  description: 'Secret used for testing.',
@@ -195,31 +177,31 @@ Create a secret group, and then add a new secret to this group.
195
177
  password: 'test_password',
196
178
  labels: ['label1'],
197
179
  expiration_date: '2030-04-01T09:30:00Z',
198
- },
199
- ],
180
+ }
200
181
  });
201
182
  ```
202
183
 
203
184
  Create a rotation policy of one month for a secret.
204
185
 
205
186
  ```js
206
- let res = await secretsManager.putPolicy({
207
- metadata: {
208
- collection_type: 'application/vnd.ibm.secrets-manager.secret.policy+json',
209
- collection_total: 1,
210
- },
211
- secretType: 'username_password',
212
- id: secretId,
213
- resources: [
214
- {
215
- type: 'application/vnd.ibm.secrets-manager.secret.policy+json',
216
- rotation: {
217
- interval: 1,
218
- unit: 'month',
219
- },
220
- },
221
- ],
222
- });
187
+ let res = await secretsManager.createSecret({
188
+ secretPrototype: {
189
+ custom_metadata: { metadata_custom_key: 'metadata_custom_value' },
190
+ description: 'Description of my arbitrary secret.',
191
+ expiration_date: '2023-10-05T11:49:42Z',
192
+ labels: ['dev', 'us-south'],
193
+ name: 'example-arbitrary-secret',
194
+ secret_group_id: 'default',
195
+ secret_type: 'arbitrary',
196
+ payload: 'secret-data',
197
+ version_custom_metadata: { custom_version_key: 'custom_version_value' },
198
+ rotation: {
199
+ auto_rotate: true,
200
+ interval: 1,
201
+ unit: month,
202
+ }
203
+ }
204
+ });
223
205
  ```
224
206
 
225
207
  For more information and IBM Cloud SDK usage examples for Node.js, see
@@ -264,5 +246,3 @@ For general contribution guidelines, see [CONTRIBUTING](CONTRIBUTING.md).
264
246
  ## License
265
247
 
266
248
  This SDK project is released under the Apache 2.0 license. The license's full text can be found in [LICENSE](LICENSE).
267
-
268
- dummy PR #1