@@ -53,4 +53,41 @@ you can find these examples in [`examples/src/master_key_provider`](./src/master
53
53
54
54
## Legacy
55
55
56
- The examples in [ ` examples/src/legacy ` ] ( ./src/legacy ) .
56
+ These are any examples that were already defined
57
+ before we started revamping our examples.
58
+ We are keeping them around for anyone who needs them as reference material,
59
+ but we recommend looking at the newer examples
60
+ that should provide a clearer picture of how to use this library.
61
+ You can find these examples in [ ` examples/src/legacy ` ] ( ./src/legacy ) .
62
+
63
+ # Writing Examples
64
+
65
+ If you want to write a new example, that's awesome!
66
+ There are a couple things you need to keep in mind, though.
67
+ To make sure that your example is tested in our CI,
68
+ please make sure that it meets the following requirements:
69
+
70
+ 1 . The example MUST be a distinct module in the [ ` examples/src/ ` ] ( ./src ) directory.
71
+ 1 . The example MAY be nested arbitrarily deeply,
72
+ but every intermediate directory MUST contain a ` __init__.py ` file
73
+ so that CPython 2.7 will recognize it as a module.
74
+ 1 . Every example MUST be CPython 2.7 compatible.
75
+ 1 . Each example file MUST contain exactly one example.
76
+ 1 . Each example file MUST contain a function called ` run ` that runs the example.
77
+ 1 . If your ` run ` function needs any of the following inputs,
78
+ the parameters MUST have the following names:
79
+ * ` aws_kms_cmk_arn ` (` str ` ) : A single AWS KMS CMK ARN.
80
+ * NOTE: You can assume that automatically discovered credentials have
81
+ ` kms:GenerateDataKey ` , ` kms:Encrypt ` , and ` kms:Decrypt ` permissions on this CMK.
82
+ * ` aws_kms_generator_cmk ` (` str ` ) : A single AWS KMS CMK ARN to use as a generator key.
83
+ * NOTE: You can assume that automatically discovered credentials have
84
+ ` kms:GenerateDataKey ` , ` kms:Encrypt ` , and ` kms:Decrypt ` permissions on this CMK.
85
+ * ` aws_kms_child_cmks ` (` List[str] ` ) : A list of AWS KMS CMK ARNs to use as child keys.
86
+ * NOTE: You can assume that automatically discovered credentials have
87
+ ` kms:Encrypt ` and ` kms:Decrypt ` permissions on these CMKs.
88
+ * ` source_plaintext ` (` bytes ` ) : Plaintext data to encrypt.
89
+ * ` source_plaintext_filename ` (` str ` ) : A path to a file containing plaintext to encrypt.
90
+ * NOTE: You can assume that you have write access to the parent directory
91
+ and that anything you do in that directory will be cleaned up
92
+ by our test runners.
93
+ 1 . Any additional parameters MUST be optional.
0 commit comments