Skip to content

Commit 9750ce3

Browse files
lavaleritexastonyajewellamz
authored
docs: Add Java docs (#229)
Co-authored-by: Tony Knapp <[email protected]> Co-authored-by: Andrew Jewell <[email protected]>
1 parent 8f8b9dc commit 9750ce3

Some content is hidden

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

46 files changed

+1508
-94
lines changed

DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy

Lines changed: 94 additions & 3 deletions
Large diffs are not rendered by default.

DynamoDbEncryption/dafny/DynamoDbItemEncryptor/Model/DynamoDbItemEncryptor.smithy

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace aws.cryptography.dbEncryptionSdk.dynamoDb.itemEncryptor
44

55
use aws.polymorph#localService
6+
use aws.polymorph#javadoc
67

78
use com.amazonaws.dynamodb#DynamoDB_20120810
89
use com.amazonaws.dynamodb#AttributeMap
@@ -39,6 +40,7 @@ service DynamoDbItemEncryptor {
3940
errors: [DynamoDbItemEncryptorException],
4041
}
4142

43+
@javadoc("The configuration for the client-side encryption of DynamoDB items.")
4244
structure DynamoDbItemEncryptorConfig {
4345
//= specification/dynamodb-encryption-client/ddb-table-encryption-config.md#structure
4446
//= type=implication
@@ -59,43 +61,54 @@ structure DynamoDbItemEncryptorConfig {
5961
//# - [Plaintext Policy](#plaintext-policy)
6062

6163
@required
64+
@javadoc("The logical table name for this table. This is the name that is cryptographically bound with your data. This can be the same as the actual DynamoDB table name. It's purpose is to be distinct from the DynamoDB table name so that the data may still be authenticated if being read from different (but logically similar) tables, such as a backup table.")
6265
logicalTableName: String,
6366

6467
//= specification/dynamodb-encryption-client/ddb-table-encryption-config.md#dynamodb-partition-key-name
6568
//= type=implication
6669
//# This Partition Key Name MUST be a valid DynamoDB Key Schema Attribute Name
6770
@required
71+
@javadoc("The name of the partition key on the table this item will be written to or was read from.")
6872
partitionKeyName: KeySchemaAttributeName,
6973

7074
//= specification/dynamodb-encryption-client/ddb-table-encryption-config.md#dynamodb-sort-key-name
7175
//= type=implication
7276
//# This Sort Key Name MUST be a valid DynamoDB Key Schema Attribute Name
77+
@javadoc("If this table contains a sort key, the name of the sort key on the table this item will be written to or was read from.")
7378
sortKeyName: KeySchemaAttributeName,
7479

7580
@required
81+
@javadoc("A map that describes what attributes should be encrypted and/or signed on encrypt. This map must contain all attributes that might be encountered during encryption.")
7682
attributeActionsOnEncrypt: AttributeActions,
7783

7884
//= specification/dynamodb-encryption-client/ddb-table-encryption-config.md#unauthenticated-attributes
7985
//= type=implication
8086
//# Unauthenticated Attributes MUST be a set of Attribute Names.
87+
@javadoc("A list of attribute names such that, if encountered during decryption, those attributes are treated as unsigned.")
8188
allowedUnsignedAttributes: AttributeNameList,
8289

8390
//= specification/dynamodb-encryption-client/ddb-table-encryption-config.md#unauthenticated-attribute-prefix
8491
//= type=implication
8592
//# Unauthenticated Attribute Prefix MUST be a string.
93+
@javadoc("A prefix such that, if during decryption any attribute has a name with this prefix, it is treated as unsigned.")
8694
allowedUnsignedAttributePrefix: String,
8795

8896
//= specification/dynamodb-encryption-client/ddb-table-encryption-config.md#algorithm-suite
8997
//= type=implication
9098
//# This algorithm suite MUST be a [Structured Encryption Library Supported algorithm suite](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/algorithm-suites.md).
99+
@javadoc("An ID for the algorithm suite to use during encryption and decryption.")
91100
algorithmSuiteId: DBEAlgorithmSuiteId,
92101

93102
// Requires a Keyring XOR a CMM
103+
@javadoc("The Keyring that should be used to wrap and unwrap data keys. If specified a Default Cryptographic Materials Manager with this Keyring is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified.")
94104
keyring: KeyringReference,
105+
@javadoc("The Cryptographic Materials Manager that is used to obtain materials for encryption and decryption. Either a Keyring or a Cryptographic Materials Manager must be specified.")
95106
cmm: CryptographicMaterialsManagerReference,
96107

108+
@javadoc("A configuration that override encryption and/or decryption to instead perform legacy encryption and/or decryption. Used as part of migration from version 2.x to version 3.x.")
97109
legacyOverride: LegacyOverride,
98110

111+
@javadoc("A configuration that override encryption and/or decryption to instead passthrough and write and/or read plaintext. Used to update plaintext tables to fully use client-side encryption.")
99112
plaintextOverride: PlaintextOverride,
100113
}
101114

@@ -108,20 +121,26 @@ structure DynamoDbItemEncryptorConfig {
108121
//# calculated using the Crypto Legend in the header, the signature scope used for decryption, and the data in the structure,
109122
//# converted into Attribute Actions.
110123
//# - [Encrypted Data Keys](./header.md#encrypted-data-keys): The Encrypted Data Keys stored in the header.
124+
@javadoc("A parsed version of the header that was written with or read on an encrypted DynamoDB item.")
111125
structure ParsedHeader {
112126
@required
127+
@javadoc("The non-DO_NOTHING Crypto Actions that were configured when this item was originally encrypted.")
113128
attributeActionsOnEncrypt: AttributeActions,
114129
@required
130+
@javadoc("The ID of the algorithm suite that was used to encrypt this item.")
115131
algorithmSuiteId: DBEAlgorithmSuiteId,
116132
@required
133+
@javadoc("The encrypted data keys that are stored in the header of this item.")
117134
encryptedDataKeys: EncryptedDataKeyList,
118135
@required
136+
@javadoc("The portion of the encryption context that was stored in the header of this item.")
119137
storedEncryptionContext: EncryptionContext
120138
}
121139

122140
//= specification/dynamodb-encryption-client/ddb-item-encryptor.md#encryptitem
123141
//= type=implication
124142
//# The DynamoDB Item Encryptor MUST provide a function that adheres to [EncryptItem](./encrypt-item.md).
143+
@javadoc("Encrypt a DynamoDB Item.")
125144
operation EncryptItem {
126145
input: EncryptItemInput,
127146
output: EncryptItemOutput,
@@ -130,6 +149,7 @@ operation EncryptItem {
130149
//= specification/dynamodb-encryption-client/ddb-item-encryptor.md#decryptitem
131150
//= type=implication
132151
//# The DynamoDB Item Encryptor MUST provide a function that adheres to [DecryptItem](./decrypt-item.md).
152+
@javadoc("Decrypt a DynamoDB Item.")
133153
operation DecryptItem {
134154
input: DecryptItemInput,
135155
output: DecryptItemOutput,
@@ -139,37 +159,47 @@ operation DecryptItem {
139159
//= type=implication
140160
//# The following inputs to this behavior are REQUIRED:
141161
//# - DynamoDB Item
162+
@javadoc("Inputs for encrypting a DynamoDB Item.")
142163
structure EncryptItemInput {
143164
@required
165+
@javadoc("The DynamoDB item to encrypt.")
144166
plaintextItem: AttributeMap,
145167
}
146168

169+
@javadoc("Outputs for encrypting a DynamoDB Item.")
147170
structure EncryptItemOutput {
148171
@required
172+
@javadoc("The encrypted DynamoDB item.")
149173
encryptedItem: AttributeMap,
150174

151175
// MAY be None if in plaintext/legacy mode
176+
@javadoc("A parsed version of the header written with the encrypted DynamoDB item.")
152177
parsedHeader: ParsedHeader,
153178
}
154179

155180
//= specification/dynamodb-encryption-client/decrypt-item.md#input
156181
//= type=implication
157182
//# The following inputs to this behavior are REQUIRED:
158183
//# - DynamoDB Item
184+
@javadoc("Inputs for decrypting a DynamoDB Item.")
159185
structure DecryptItemInput {
160186
@required
187+
@javadoc("The encrypted DynamoDB item to decrypt.")
161188
encryptedItem: AttributeMap,
162189
}
163190

191+
@javadoc("Outputs for decrypting a DynamoDB Item.")
164192
structure DecryptItemOutput {
165193
//= specification/dynamodb-encryption-client/decrypt-item.md#output
166194
//= type=implication
167195
//# This operation MUST output the following:
168196
//# - [DynamoDb Item](#dynamodb-item-1)
169197
@required
198+
@javadoc("The decrypted DynamoDB item.")
170199
plaintextItem: AttributeMap,
171200

172201
// MAY be None if in plaintext/legacy mode
202+
@javadoc("A parsed version of the header on the encrypted DynamoDB item.")
173203
parsedHeader: ParsedHeader,
174204
}
175205

DynamoDbEncryption/runtimes/java/build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ java {
2424
sourceSets["test"].java {
2525
srcDir("src/test")
2626
}
27+
withJavadocJar()
28+
withSourcesJar()
2729
}
2830

2931
var caUrl: URI? = null
@@ -117,6 +119,12 @@ tasks.withType<JavaCompile>() {
117119
options.encoding = "UTF-8"
118120
}
119121

122+
tasks.withType<Jar>() {
123+
// to compile a sources jar we need a strategy on how to deal with duplicates;
124+
// we choose to include duplicate classes.
125+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
126+
}
127+
120128
tasks.test {
121129
useTestNG()
122130
dependsOn("CopyDynamoDb")
@@ -170,3 +178,10 @@ tasks.register<Copy>("CopyDynamoDb") {
170178
}
171179
into("build/libs")
172180
}
181+
182+
tasks.javadoc {
183+
options {
184+
(this as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
185+
}
186+
exclude("src/main/dafny-generated")
187+
}

DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbEncryption.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class DynamoDbEncryption {
1818
private final IDynamoDbEncryptionClient _impl;
1919

2020
protected DynamoDbEncryption(BuilderImpl builder) {
21-
DynamoDbEncryptionConfig nativeValue = builder.DynamoDbEncryptionConfig();
22-
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig dafnyValue = ToDafny.DynamoDbEncryptionConfig(nativeValue);
21+
DynamoDbEncryptionConfig input = builder.DynamoDbEncryptionConfig();
22+
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.DynamoDbEncryptionConfig dafnyValue = ToDafny.DynamoDbEncryptionConfig(input);
2323
Result<DynamoDbEncryptionClient, Error> result = __default.DynamoDbEncryption(dafnyValue);
2424
if (result.is_Failure()) {
2525
throw ToNative.Error(result.dtor_error());
@@ -35,9 +35,15 @@ public static Builder builder() {
3535
return new BuilderImpl();
3636
}
3737

38+
/**
39+
* Create a Branch Key Supplier for use with the Hierarchical Keyring that decides what Branch Key to use based on the primary key of the DynamoDB item being read or written.
40+
*
41+
* @param input Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier
42+
* @return Outputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier
43+
*/
3844
public CreateDynamoDbEncryptionBranchKeyIdSupplierOutput CreateDynamoDbEncryptionBranchKeyIdSupplier(
39-
CreateDynamoDbEncryptionBranchKeyIdSupplierInput nativeValue) {
40-
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput dafnyValue = ToDafny.CreateDynamoDbEncryptionBranchKeyIdSupplierInput(nativeValue);
45+
CreateDynamoDbEncryptionBranchKeyIdSupplierInput input) {
46+
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierInput dafnyValue = ToDafny.CreateDynamoDbEncryptionBranchKeyIdSupplierInput(input);
4147
Result<software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.CreateDynamoDbEncryptionBranchKeyIdSupplierOutput, Error> result = this._impl.CreateDynamoDbEncryptionBranchKeyIdSupplier(dafnyValue);
4248
if (result.is_Failure()) {
4349
throw ToNative.Error(result.dtor_error());

DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/DynamoDbKeyBranchKeyIdSupplier.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types
3939
return this._impl;
4040
}
4141

42+
/**
43+
* Get the Branch Key that should be used for wrapping and unwrapping data keys based on the primary key of the item being read or written.
44+
*
45+
* @param input Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys.
46+
* @return Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys.
47+
*/
4248
public GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey(
43-
GetBranchKeyIdFromDdbKeyInput nativeValue) {
44-
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyValue = ToDafny.GetBranchKeyIdFromDdbKeyInput(nativeValue);
49+
GetBranchKeyIdFromDdbKeyInput input) {
50+
software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyInput dafnyValue = ToDafny.GetBranchKeyIdFromDdbKeyInput(input);
4551
Result<software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types.GetBranchKeyIdFromDdbKeyOutput, Error> result = this._impl.GetBranchKeyIdFromDdbKey(dafnyValue);
4652
if (result.is_Failure()) {
4753
throw ToNative.Error(result.dtor_error());

DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/IDynamoDbKeyBranchKeyIdSupplier.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import software.amazon.cryptography.dbencryptionsdk.dynamodb.model.GetBranchKeyIdFromDdbKeyOutput;
88

99
public interface IDynamoDbKeyBranchKeyIdSupplier {
10-
GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey(
11-
GetBranchKeyIdFromDdbKeyInput nativeValue);
10+
/**
11+
* Get the Branch Key that should be used for wrapping and unwrapping data keys based on the primary key of the item being read or written.
12+
*
13+
* @param input Inputs for getting the Branch Key that should be used for wrapping and unwrapping data keys.
14+
* @return Outputs for getting the Branch Key that should be used for wrapping and unwrapping data keys.
15+
*/
16+
GetBranchKeyIdFromDdbKeyOutput GetBranchKeyIdFromDdbKey(GetBranchKeyIdFromDdbKeyInput input);
1217
}

DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/DynamoDbItemEncryptor.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public class DynamoDbItemEncryptor {
2020
private final IDynamoDbItemEncryptorClient _impl;
2121

2222
protected DynamoDbItemEncryptor(BuilderImpl builder) {
23-
DynamoDbItemEncryptorConfig nativeValue = builder.DynamoDbItemEncryptorConfig();
24-
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DynamoDbItemEncryptorConfig dafnyValue = ToDafny.DynamoDbItemEncryptorConfig(nativeValue);
23+
DynamoDbItemEncryptorConfig input = builder.DynamoDbItemEncryptorConfig();
24+
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DynamoDbItemEncryptorConfig dafnyValue = ToDafny.DynamoDbItemEncryptorConfig(input);
2525
Result<DynamoDbItemEncryptorClient, Error> result = __default.DynamoDbItemEncryptor(dafnyValue);
2626
if (result.is_Failure()) {
2727
throw ToNative.Error(result.dtor_error());
@@ -37,17 +37,29 @@ public static Builder builder() {
3737
return new BuilderImpl();
3838
}
3939

40-
public DecryptItemOutput DecryptItem(DecryptItemInput nativeValue) {
41-
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DecryptItemInput dafnyValue = ToDafny.DecryptItemInput(nativeValue);
40+
/**
41+
* Decrypt a DynamoDB Item.
42+
*
43+
* @param input Inputs for decrypting a DynamoDB Item.
44+
* @return Outputs for decrypting a DynamoDB Item.
45+
*/
46+
public DecryptItemOutput DecryptItem(DecryptItemInput input) {
47+
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DecryptItemInput dafnyValue = ToDafny.DecryptItemInput(input);
4248
Result<software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.DecryptItemOutput, Error> result = this._impl.DecryptItem(dafnyValue);
4349
if (result.is_Failure()) {
4450
throw ToNative.Error(result.dtor_error());
4551
}
4652
return ToNative.DecryptItemOutput(result.dtor_value());
4753
}
4854

49-
public EncryptItemOutput EncryptItem(EncryptItemInput nativeValue) {
50-
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.EncryptItemInput dafnyValue = ToDafny.EncryptItemInput(nativeValue);
55+
/**
56+
* Encrypt a DynamoDB Item.
57+
*
58+
* @param input Inputs for encrypting a DynamoDB Item.
59+
* @return Outputs for encrypting a DynamoDB Item.
60+
*/
61+
public EncryptItemOutput EncryptItem(EncryptItemInput input) {
62+
software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.EncryptItemInput dafnyValue = ToDafny.EncryptItemInput(input);
5163
Result<software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.types.EncryptItemOutput, Error> result = this._impl.EncryptItem(dafnyValue);
5264
if (result.is_Failure()) {
5365
throw ToNative.Error(result.dtor_error());
@@ -60,8 +72,14 @@ protected IDynamoDbItemEncryptorClient impl() {
6072
}
6173

6274
public interface Builder {
75+
/**
76+
* @param DynamoDbItemEncryptorConfig The configuration for the client-side encryption of DynamoDB items.
77+
*/
6378
Builder DynamoDbItemEncryptorConfig(DynamoDbItemEncryptorConfig DynamoDbItemEncryptorConfig);
6479

80+
/**
81+
* @return The configuration for the client-side encryption of DynamoDB items.
82+
*/
6583
DynamoDbItemEncryptorConfig DynamoDbItemEncryptorConfig();
6684

6785
DynamoDbItemEncryptor build();

DynamoDbEncryption/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/dbencryptionsdk/dynamodb/itemencryptor/model/DecryptItemInput.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,22 @@
77
import java.util.Objects;
88
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
99

10+
/**
11+
* Inputs for decrypting a DynamoDB Item.
12+
*/
1013
public class DecryptItemInput {
14+
/**
15+
* The encrypted DynamoDB item to decrypt.
16+
*/
1117
private final Map<String, AttributeValue> encryptedItem;
1218

1319
protected DecryptItemInput(BuilderImpl builder) {
1420
this.encryptedItem = builder.encryptedItem();
1521
}
1622

23+
/**
24+
* @return The encrypted DynamoDB item to decrypt.
25+
*/
1726
public Map<String, AttributeValue> encryptedItem() {
1827
return this.encryptedItem;
1928
}
@@ -27,8 +36,14 @@ public static Builder builder() {
2736
}
2837

2938
public interface Builder {
39+
/**
40+
* @param encryptedItem The encrypted DynamoDB item to decrypt.
41+
*/
3042
Builder encryptedItem(Map<String, AttributeValue> encryptedItem);
3143

44+
/**
45+
* @return The encrypted DynamoDB item to decrypt.
46+
*/
3247
Map<String, AttributeValue> encryptedItem();
3348

3449
DecryptItemInput build();

0 commit comments

Comments
 (0)