Skip to content

Commit 88290f0

Browse files
committed
fix prettier
1 parent ea188a7 commit 88290f0

File tree

1 file changed

+39
-24
lines changed

1 file changed

+39
-24
lines changed

Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/keyring/SharedCacheAcrossHierarchicalKeyringsExample.java

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
106106
// using the Material Providers Library
107107
// This CMC takes in:
108108
// - CacheType
109-
final MaterialProviders matProv = MaterialProviders.builder()
109+
final MaterialProviders matProv = MaterialProviders
110+
.builder()
110111
.MaterialProvidersConfig(MaterialProvidersConfig.builder().build())
111112
.build();
112113

113-
final CacheType cache = CacheType.builder()
114+
final CacheType cache = CacheType
115+
.builder()
114116
.Default(DefaultCache.builder().entryCapacity(100).build())
115117
.build();
116118

@@ -124,7 +126,8 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
124126

125127
// 2. Create a CacheType object for the sharedCryptographicMaterialsCache
126128
// Note that the `cache` parameter in the Hierarchical Keyring Input takes a `CacheType` as input
127-
final CacheType sharedCache = CacheType.builder()
129+
final CacheType sharedCache = CacheType
130+
.builder()
128131
// This is the `Shared` CacheType that passes an already initialized shared cache
129132
.Shared(sharedCryptographicMaterialsCache)
130133
.build();
@@ -137,9 +140,11 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
137140
// to initially create and populate your KeyStore.
138141
// Note that keyStoreTableName is the physical Key Store,
139142
// and keystore1 is instances of this physical Key Store.
140-
final KeyStore keystore1 = KeyStore.builder()
143+
final KeyStore keystore1 = KeyStore
144+
.builder()
141145
.KeyStoreConfig(
142-
KeyStoreConfig.builder()
146+
KeyStoreConfig
147+
.builder()
143148
.ddbClient(DynamoDbClient.create())
144149
.ddbTableName(keyStoreTableName)
145150
.logicalKeyStoreName(logicalKeyStoreName)
@@ -164,7 +169,8 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
164169
// Branch Key ID at the top of this example before creating Hierarchical Keyrings with a Shared Cache.
165170
// partitionId for this example is a random UUID
166171
final CreateAwsKmsHierarchicalKeyringInput keyringInput1 =
167-
CreateAwsKmsHierarchicalKeyringInput.builder()
172+
CreateAwsKmsHierarchicalKeyringInput
173+
.builder()
168174
.keyStore(keystore1)
169175
.branchKeyId(branchKeyId)
170176
.ttlSeconds(600) // This dictates how often we call back to KMS to authorize use of the branch keys
@@ -221,9 +227,11 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
221227
// - If you set the Logical Key Store Names for K1 and K2 to be different,
222228
// HK1 (which uses Key Store instance K1) and HK2 (which uses Key Store
223229
// instance K2) will NOT be able to share cache entries.
224-
final KeyStore keystore2 = KeyStore.builder()
230+
final KeyStore keystore2 = KeyStore
231+
.builder()
225232
.KeyStoreConfig(
226-
KeyStoreConfig.builder()
233+
KeyStoreConfig
234+
.builder()
227235
.ddbClient(DynamoDbClient.create())
228236
.ddbTableName(keyStoreTableName)
229237
.logicalKeyStoreName(logicalKeyStoreName)
@@ -243,7 +251,8 @@ public static void SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
243251
// Branch Key ID at the top of this example before creating Hierarchical Keyrings with a Shared Cache.
244252
// partitionId for this example is a random UUID
245253
final CreateAwsKmsHierarchicalKeyringInput keyringInput2 =
246-
CreateAwsKmsHierarchicalKeyringInput.builder()
254+
CreateAwsKmsHierarchicalKeyringInput
255+
.builder()
247256
.keyStore(keystore2)
248257
.branchKeyId(branchKeyId)
249258
.ttlSeconds(600) // This dictates how often we call back to KMS to authorize use of the branch keys
@@ -302,31 +311,35 @@ public static DynamoDbClient GetDdbClient(
302311
// Create the DynamoDb Encryption configuration for the table we will be writing to.
303312
final Map<String, DynamoDbTableEncryptionConfig> tableConfigs =
304313
new HashMap<>();
305-
final DynamoDbTableEncryptionConfig config =
306-
DynamoDbTableEncryptionConfig.builder()
307-
.logicalTableName(ddbTableName)
308-
.partitionKeyName("partition_key")
309-
.sortKeyName("sort_key")
310-
.attributeActionsOnEncrypt(attributeActionsOnEncrypt)
311-
.keyring(hierarchicalKeyring)
312-
.allowedUnsignedAttributePrefix(unsignAttrPrefix)
313-
.build();
314+
final DynamoDbTableEncryptionConfig config = DynamoDbTableEncryptionConfig
315+
.builder()
316+
.logicalTableName(ddbTableName)
317+
.partitionKeyName("partition_key")
318+
.sortKeyName("sort_key")
319+
.attributeActionsOnEncrypt(attributeActionsOnEncrypt)
320+
.keyring(hierarchicalKeyring)
321+
.allowedUnsignedAttributePrefix(unsignAttrPrefix)
322+
.build();
314323
tableConfigs.put(ddbTableName, config);
315324

316325
// Create the DynamoDb Encryption Interceptor
317326
DynamoDbEncryptionInterceptor encryptionInterceptor =
318-
DynamoDbEncryptionInterceptor.builder()
327+
DynamoDbEncryptionInterceptor
328+
.builder()
319329
.config(
320-
DynamoDbTablesEncryptionConfig.builder()
330+
DynamoDbTablesEncryptionConfig
331+
.builder()
321332
.tableEncryptionConfigs(tableConfigs)
322333
.build()
323334
)
324335
.build();
325336

326337
// Create a new AWS SDK DynamoDb client using the DynamoDb Encryption Interceptor above
327-
final DynamoDbClient ddbClient = DynamoDbClient.builder()
338+
final DynamoDbClient ddbClient = DynamoDbClient
339+
.builder()
328340
.overrideConfiguration(
329-
ClientOverrideConfiguration.builder()
341+
ClientOverrideConfiguration
342+
.builder()
330343
.addExecutionInterceptor(encryptionInterceptor)
331344
.build()
332345
)
@@ -353,7 +366,8 @@ public static void PutGetItems(
353366
AttributeValue.builder().s("encrypt and sign me!").build()
354367
);
355368

356-
final PutItemRequest putRequest = PutItemRequest.builder()
369+
final PutItemRequest putRequest = PutItemRequest
370+
.builder()
357371
.tableName(ddbTableName)
358372
.item(item)
359373
.build();
@@ -373,7 +387,8 @@ public static void PutGetItems(
373387
keyToGet.put("partition_key", AttributeValue.builder().s("id").build());
374388
keyToGet.put("sort_key", AttributeValue.builder().n("0").build());
375389

376-
final GetItemRequest getRequest = GetItemRequest.builder()
390+
final GetItemRequest getRequest = GetItemRequest
391+
.builder()
377392
.key(keyToGet)
378393
.tableName(ddbTableName)
379394
.build();

0 commit comments

Comments
 (0)