Skip to content

Commit 0a83152

Browse files
AviDavidov86Tom Brewster
andauthored
Release 1.0.3 (#32)
* update java sdk * Update kv integration test * change payload type to object * Update SecretsManagerIntegrationTest.java * refactor payload to object * Fix kv unit test * Fix kv unit test * Code tidy Co-authored-by: Tom Brewster <[email protected]>
1 parent 6356a1d commit 0a83152

File tree

208 files changed

+3270
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+3270
-850
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ Service name | Imported class name
4444
<dependency>
4545
<groupId>com.ibm.cloud</groupId>
4646
<artifactId>secrets-manager</artifactId>
47-
<version>1.0.2</version>
47+
<version>1.0.3</version>
4848
</dependency>
4949
```
5050

5151
##### Gradle
5252

5353
```gradle
54-
'com.ibm.cloud:secrets-manager:1.0.2'
54+
'com.ibm.cloud:secrets-manager:1.0.3'
5555
```
5656

5757
## Authentication

modules/common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>secrets-manager-sdk</artifactId>
88
<groupId>com.ibm.cloud</groupId>
9-
<version>1.0.2</version>
9+
<version>1.0.3</version>
1010
<relativePath>../..</relativePath>
1111
</parent>
1212

modules/coverage-reports/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>secrets-manager-sdk</artifactId>
55
<groupId>com.ibm.cloud</groupId>
6-
<version>1.0.2</version>
6+
<version>1.0.3</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

modules/secrets-manager/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>secrets-manager-sdk</artifactId>
77
<groupId>com.ibm.cloud</groupId>
8-
<version>1.0.2</version>
8+
<version>1.0.3</version>
99
<relativePath>../..</relativePath>
1010
</parent>
1111

modules/secrets-manager/src/main/java/com/ibm/cloud/secrets_manager_sdk/secrets_manager/v1/SecretsManager.java

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
* IBM OpenAPI SDK Code Generator Version: 3.40.0-910cf8c2-20211006-154754
15+
* IBM OpenAPI SDK Code Generator Version: 3.45.0-05af0f12-20220209-193923
1616
*/
1717

1818
package com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1;
@@ -52,6 +52,8 @@
5252
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.GetSingleConfigElement;
5353
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.ListAllSecretsOptions;
5454
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.ListSecretGroupsOptions;
55+
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.ListSecretVersions;
56+
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.ListSecretVersionsOptions;
5557
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.ListSecrets;
5658
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.ListSecretsOptions;
5759
import com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model.PutConfigOptions;
@@ -69,8 +71,8 @@
6971

7072
/**
7173
* With IBM Cloud® Secrets Manager, you can create, lease, and centrally manage secrets that are used in IBM Cloud
72-
* services or your custom-built applications. Secrets are stored in a dedicated instance of Secrets Manager, built on
73-
* open source HashiCorp Vault.
74+
* services or your custom-built applications. Secrets are stored in a dedicated instance of Secrets Manager, which is
75+
* built on open source HashiCorp Vault.
7476
* <p>
7577
* API Version: 1.0.0
7678
* See: https://cloud.ibm.com/docs/secrets-manager
@@ -262,7 +264,7 @@ public ServiceCall<Void> deleteSecretGroup(DeleteSecretGroupOptions deleteSecret
262264
/**
263265
* Create a secret.
264266
* <p>
265-
* Creates a secret or imports an existing value that you can use to access or authenticate to a protected resource.
267+
* Create a secret or import an existing value that you can use to access or authenticate to a protected resource.
266268
* <p>
267269
* Use this method to either generate or import an existing secret, such as an arbitrary value or a TLS certificate,
268270
* that you can manage in your Secrets Manager service instance. A successful request stores the secret in your
@@ -380,7 +382,7 @@ public ServiceCall<ListSecrets> listAllSecrets() {
380382
/**
381383
* Get a secret.
382384
* <p>
383-
* Retrieves a secret and its details by specifying the ID of the secret.
385+
* Get a secret and its details by specifying the ID of the secret.
384386
* <p>
385387
* A successful request returns the secret data that is associated with your secret, along with other metadata. To
386388
* view only the details of a specified secret without retrieving its value, use the [Get secret
@@ -412,7 +414,8 @@ public ServiceCall<GetSecret> getSecret(GetSecretOptions getSecretOptions) {
412414
* <p>
413415
* Invokes an action on a specified secret. This method supports the following actions:
414416
* <p>
415-
* - `rotate`: Replace the value of an `arbitrary`, `username_password`, `public_cert` or `imported_cert` secret.
417+
* - `rotate`: Replace the value of a secret.
418+
* - `restore`: Restore a previous version of an `iam_credentials` secret.
416419
* - `delete_credentials`: Delete the API key that is associated with an `iam_credentials` secret.
417420
*
418421
* @param updateSecretOptions the {@link UpdateSecretOptions} containing the options for the call
@@ -431,7 +434,9 @@ public ServiceCall<GetSecret> updateSecret(UpdateSecretOptions updateSecretOptio
431434
}
432435
builder.header("Accept", "application/json");
433436
builder.query("action", String.valueOf(updateSecretOptions.action()));
434-
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateSecretOptions.secretAction()), "application/json");
437+
if (updateSecretOptions.secretAction() != null) {
438+
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateSecretOptions.secretAction()), "application/json");
439+
}
435440
ResponseConverter<GetSecret> responseConverter =
436441
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<GetSecret>() {
437442
}.getType());
@@ -461,6 +466,34 @@ public ServiceCall<Void> deleteSecret(DeleteSecretOptions deleteSecretOptions) {
461466
return createServiceCall(builder.build(), responseConverter);
462467
}
463468

469+
/**
470+
* List versions of a secret.
471+
* <p>
472+
* Retrieves a list of the versions of a secret.
473+
* <p>
474+
* A successful request returns the list of the versions along with the metadata of each version.
475+
*
476+
* @param listSecretVersionsOptions the {@link ListSecretVersionsOptions} containing the options for the call
477+
* @return a {@link ServiceCall} with a result of type {@link ListSecretVersions}
478+
*/
479+
public ServiceCall<ListSecretVersions> listSecretVersions(ListSecretVersionsOptions listSecretVersionsOptions) {
480+
com.ibm.cloud.sdk.core.util.Validator.notNull(listSecretVersionsOptions,
481+
"listSecretVersionsOptions cannot be null");
482+
Map<String, String> pathParamsMap = new HashMap<String, String>();
483+
pathParamsMap.put("secret_type", listSecretVersionsOptions.secretType());
484+
pathParamsMap.put("id", listSecretVersionsOptions.id());
485+
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/api/v1/secrets/{secret_type}/{id}/versions", pathParamsMap));
486+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("secrets_manager", "v1", "listSecretVersions");
487+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
488+
builder.header(header.getKey(), header.getValue());
489+
}
490+
builder.header("Accept", "application/json");
491+
ResponseConverter<ListSecretVersions> responseConverter =
492+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ListSecretVersions>() {
493+
}.getType());
494+
return createServiceCall(builder.build(), responseConverter);
495+
}
496+
464497
/**
465498
* Get a version of a secret.
466499
* <p>
@@ -703,7 +736,7 @@ public ServiceCall<GetConfig> getConfig(GetConfigOptions getConfigOptions) {
703736
* <p>
704737
* Adds a configuration element to the specified secret type.
705738
* <p>
706-
* Use this method to define the configurations that are required to enable the public certificates (`public_cert`)
739+
* Use this method to define the configurations that are required to enable the public certificates (`public_cert`)
707740
* engine. You can add up to 10 certificate authority and DNS provider configurations for your instance.
708741
*
709742
* @param createConfigElementOptions the {@link CreateConfigElementOptions} containing the options for the call

modules/secrets-manager/src/main/java/com/ibm/cloud/secrets_manager_sdk/secrets_manager/v1/model/ArbitrarySecretMetadata.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -45,6 +45,10 @@ public interface SecretType {
4545
* public_cert.
4646
*/
4747
String PUBLIC_CERT = "public_cert";
48+
/**
49+
* kv.
50+
*/
51+
String KV = "kv";
4852
}
4953

5054

modules/secrets-manager/src/main/java/com/ibm/cloud/secrets_manager_sdk/secrets_manager/v1/model/ArbitrarySecretResource.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -41,6 +41,14 @@ public interface SecretType {
4141
* imported_cert.
4242
*/
4343
String IMPORTED_CERT = "imported_cert";
44+
/**
45+
* public_cert.
46+
*/
47+
String PUBLIC_CERT = "public_cert";
48+
/**
49+
* kv.
50+
*/
51+
String KV = "kv";
4452
}
4553

4654

@@ -53,7 +61,7 @@ public static class Builder {
5361
private String secretGroupId;
5462
private List<String> labels;
5563
private Date expirationDate;
56-
private String payload;
64+
private Object payload;
5765

5866
public Builder(SecretResource arbitrarySecretResource) {
5967
this.name = arbitrarySecretResource.name;
@@ -166,7 +174,7 @@ public Builder expirationDate(Date expirationDate) {
166174
* @param payload the payload
167175
* @return the ArbitrarySecretResource builder
168176
*/
169-
public Builder payload(String payload) {
177+
public Builder payload(Object payload) {
170178
this.payload = payload;
171179
return this;
172180
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model;
14+
15+
/**
16+
* ArbitrarySecretVersion.
17+
*/
18+
public class ArbitrarySecretVersion extends SecretVersion {
19+
20+
}
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.ibm.cloud.secrets_manager_sdk.secrets_manager.v1.model;
14+
15+
/**
16+
* ArbitrarySecretVersionInfo.
17+
*/
18+
public class ArbitrarySecretVersionInfo extends SecretVersionInfo {
19+
20+
}
21+

modules/secrets-manager/src/main/java/com/ibm/cloud/secrets_manager_sdk/secrets_manager/v1/model/ArbitrarySecretVersionMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at

0 commit comments

Comments
 (0)