Skip to content

Commit 8677e91

Browse files
committed
chore(Java): polish Java examples
1 parent 13a281f commit 8677e91

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

AwsCryptographicMaterialProviders/runtimes/java/src/examples/java/software/amazon/cryptography/example/hierarchy/mutations/DescribeMutationExample.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package software.amazon.cryptography.example.hierarchy.mutations;
44

55
import static software.amazon.cryptography.example.hierarchy.mutations.MutationsProvider.MutableBranchKeyPropertiesToString;
6+
import static software.amazon.cryptography.example.hierarchy.mutations.MutationsProvider.MutationTokenToString;
67
import static software.amazon.cryptography.example.hierarchy.mutations.MutationsProvider.MutationsToString;
78
import static software.amazon.cryptography.example.hierarchy.mutations.MutationsProvider.executeInitialize;
89

@@ -75,7 +76,8 @@ public static DescribeMutationOutput Example(
7576
);
7677
// The Description object holds Details and the Token.
7778
System.out.println(
78-
"The Token to continue the Mutation is: " + description.MutationToken()
79+
"The Token to continue the Mutation is: " +
80+
MutationTokenToString(description.MutationToken())
7981
);
8082
return output;
8183
}

AwsCryptographicMaterialProviders/runtimes/java/src/examples/java/software/amazon/cryptography/example/hierarchy/mutations/MutationExample.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public static String End2End(
6464
String kmsKeyArnTerminal,
6565
String branchKeyId,
6666
@Nullable SystemKey systemKey,
67-
@Nullable KeyStoreAdmin admin
67+
@Nullable KeyStoreAdmin admin,
68+
@Nullable Boolean doNotVersion
6869
) {
6970
final SystemKey _systemKey = systemKey == null
7071
? MutationsProvider.KmsSystemKey()
@@ -87,6 +88,7 @@ public static String End2End(
8788
.Identifier(branchKeyId)
8889
.Strategy(strategy)
8990
.SystemKey(_systemKey)
91+
.DoNotVersion(doNotVersion)
9092
.build();
9193

9294
InitializeMutationOutput initOutput = _admin.InitializeMutation(initInput);

AwsCryptographicMaterialProviders/runtimes/java/src/examples/java/software/amazon/cryptography/example/hierarchy/mutations/MutationsProvider.java

+11
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,15 @@ static String MutableBranchKeyPropertiesToString(
250250
properties.CustomEncryptionContext().toString()
251251
);
252252
}
253+
254+
static String MutationTokenToString(MutationToken token) {
255+
return (
256+
"branch-key-id: " +
257+
token.Identifier() +
258+
"\nuuid: " +
259+
token.UUID() +
260+
"\ncreateTime: " +
261+
token.CreateTime()
262+
);
263+
}
253264
}

AwsCryptographicMaterialProviders/runtimes/java/src/testExamples/java/software/amazon/cryptography/example/hierarchy/ExampleTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public void End2EndReEncryptTest() {
3030
Fixtures.POSTAL_HORN_KEY_ARN,
3131
branchKeyId,
3232
MutationsProvider.TrustStorage(),
33-
AdminProvider.admin()
33+
AdminProvider.admin(),
34+
false
3435
);
3536
System.out.println(
3637
"\nMutated Branch Key: " +

0 commit comments

Comments
 (0)