Skip to content

Commit 2650f01

Browse files
chore: Add examples to source code (#224)
1 parent 87ed6a8 commit 2650f01

Some content is hidden

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

49 files changed

+907
-25
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aws-encryption-sdk-cli==3.1.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aws-encryption-sdk-cli==4.0.0

api_compatibility_tests/test/integration/test_api_compatibility.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def is_windows():
8484
{
8585
"==1.7.0|~=1.8": SUCCESS,
8686
"==2.0.0 ": 'error: Discovery must be set to True or False',
87-
"~=2.1|~=3.0 ": 'error: the following arguments are required: -w/--wrapping-keys'
87+
"~=2.1|>=3.0 ": 'error: the following arguments are required: -w/--wrapping-keys'
8888
}
8989
),
9090
(
@@ -93,31 +93,31 @@ def is_windows():
9393
"==1.7.0": SHOULD_HAVE_BEEN_AN_ERROR,
9494
"~=1.8 ": 'error: Commitment policy is only supported when using the --wrapping-keys parameter',
9595
"==2.0.0": 'error: Discovery must be set to True or False',
96-
"~=2.1|~=3.0": 'error: the following arguments are required: -w/--wrapping-keys'
96+
"~=2.1|>=3.0": 'error: the following arguments are required: -w/--wrapping-keys'
9797
}
9898
),
9999
(
100100
"--commitment-policy forbid-encrypt-allow-decrypt --discovery true",
101101
{
102102
"==1.7.0|==2.0.0": SHOULD_HAVE_BEEN_AN_ERROR,
103103
"~=1.8 ": 'unrecognized arguments: --discovery',
104-
"~=2.1|~=3.0 ": 'error: the following arguments are required: -w/--wrapping-keys'
104+
"~=2.1|>=3.0 ": 'error: the following arguments are required: -w/--wrapping-keys'
105105
}
106106
),
107107
# discovery-related parameters accidentally implemented in 1.7 and 2.0, removed in 1.8 and 2.1
108108
(
109109
"--commitment-policy forbid-encrypt-allow-decrypt --discovery true --wrapping-keys discovery=true",
110110
{
111111
"==1.7.0|==2.0.0": SHOULD_HAVE_BEEN_AN_ERROR,
112-
"~=1.8|~=2.1|~=3.0": "unrecognized arguments: --discovery"
112+
"~=1.8|~=2.1|>=3.0": "unrecognized arguments: --discovery"
113113
}
114114
),
115115
# discovery filter was also configured through top level parameters and hit an internal error when used :(
116116
(
117117
"--commitment-policy forbid-encrypt-allow-decrypt --discovery true --discovery-partition aws --discovery-account 111222333444 --wrapping-keys discovery=true",
118118
{
119119
"==1.7.0|==2.0.0": "TypeError(\"'discovery_filter' must be <class",
120-
"~=1.8|~=2.1|~=3.0": "unrecognized arguments: --discovery"
120+
"~=1.8|~=2.1|>=3.0": "unrecognized arguments: --discovery"
121121
}
122122
),
123123
# Disabling discovery on wrapping keys was accepted but non-functional in 1.7 and 2.0, fixed in 1.8 and 2.1
@@ -126,14 +126,14 @@ def is_windows():
126126
{
127127
"==1.7.0 ": 'error: Exact wrapping keys cannot be specified for aws-kms wrapping key provider on decrypt in discovery mode',
128128
"==2.0.0 ": 'error: Discovery must be set to True or False',
129-
"~=1.8|~=2.1|~=3.0": 'DecryptKeyError("Unable to decrypt any data key")'
129+
"~=1.8|~=2.1|>=3.0": 'DecryptKeyError("Unable to decrypt any data key")'
130130
}
131131
),
132132
(
133133
"--commitment-policy forbid-encrypt-allow-decrypt --discovery false --wrapping-keys key=" + OTHER_CMK_ARN_VALUE,
134134
{
135135
"==1.7.0|==2.0.0": SHOULD_HAVE_BEEN_AN_ERROR,
136-
"~=1.8 |~=2.1|~=3.0": 'unrecognized arguments: --discovery'
136+
"~=1.8 |~=2.1|>=3.0": 'unrecognized arguments: --discovery'
137137
}
138138
),
139139
# --commitment-policy should have been required in 1.7 when using --wrapping-keys, fixed in 1.8
@@ -143,7 +143,7 @@ def is_windows():
143143
"==1.7.0": SHOULD_HAVE_BEEN_AN_ERROR,
144144
"~=1.8 ": 'error: Commitment policy is required when specifying the --wrapping-keys parameter',
145145
"==2.0.0": 'error: Discovery must be set to True or False',
146-
"~=2.1|~=3.0": 'Cannot decrypt due to CommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT requiring only committed messages'
146+
"~=2.1|>=3.0": 'Cannot decrypt due to CommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT requiring only committed messages'
147147
}
148148
),
149149
]

api_compatibility_tests/tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py38-awses_cli_{1.7.0,1.8.0,1.9.0,2.0.0,2.1.0,2.2.0,3.0.0}
3+
py38-awses_cli_{1.7.0,1.8.0,1.9.0,2.0.0,2.1.0,2.2.0,3.0.0,3.1.0,4.0.0}
44

55
[testenv:base-command]
66
commands = pytest --basetemp={envtmpdir} -l test/ {posargs}
@@ -32,6 +32,8 @@ deps =
3232
awses_cli_2.1.0: -rcompatibility-requirements/2.1.0
3333
awses_cli_2.2.0: -rcompatibility-requirements/2.2.0
3434
awses_cli_3.0.0: -rcompatibility-requirements/3.0.0
35+
awses_cli_3.1.0: -rcompatibility-requirements/3.1.0
36+
awses_cli_4.0.0: -rcompatibility-requirements/4.0.0
3537
awses_cli_local: -e {env:AWSES_CLI_LOCAL_PATH}
3638
commands =
3739
{[testenv:base-command]commands}

buildspec.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,35 @@ version: 0.2
33
batch:
44
fast-fail: false
55
build-list:
6-
- identifier: python_27
7-
buildspec: codebuild/python_27.yml
8-
- identifier: python_35
9-
buildspec: codebuild/python_35.yml
10-
- identifier: python_36
11-
buildspec: codebuild/python_36.yml
12-
- identifier: python_37
13-
buildspec: codebuild/python_37.yml
14-
- identifier: python_38
15-
buildspec: codebuild/python_38.yml
6+
- identifier: py27_integ
7+
buildspec: codebuild/py27/integ.yml
8+
- identifier: py27_examples
9+
buildspec: codebuild/py27/examples.yml
10+
11+
- identifier: py35_integ
12+
buildspec: codebuild/py35/integ.yml
13+
- identifier: py35_examples
14+
buildspec: codebuild/py35/examples.yml
15+
16+
- identifier: py36_integ
17+
buildspec: codebuild/py36/integ.yml
18+
- identifier: py36_examples
19+
buildspec: codebuild/py36/examples.yml
20+
21+
- identifier: py37_integ
22+
buildspec: codebuild/py37/integ.yml
23+
- identifier: py37_examples
24+
buildspec: codebuild/py37/examples.yml
25+
26+
- identifier: py38_integ
27+
buildspec: codebuild/py38/integ.yml
28+
- identifier: py38_examples
29+
buildspec: codebuild/py38/examples.yml
30+
31+
- identifier: py39_integ
32+
buildspec: codebuild/py39/integ.yml
33+
- identifier: py39_examples
34+
buildspec: codebuild/py39/examples.yml
1635

1736
- identifier: code_coverage
1837
buildspec: codebuild/coverage.yml

codebuild/py27/examples.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
TOXENV: "py27-examples"
6+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
7+
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
8+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
9+
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
10+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
11+
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
12+
13+
phases:
14+
install:
15+
runtime-versions:
16+
python: latest
17+
build:
18+
commands:
19+
- pip install tox
20+
- tox

codebuild/py35/examples.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
TOXENV: "py35-examples"
6+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
7+
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
8+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
9+
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
10+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
11+
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
12+
13+
phases:
14+
install:
15+
runtime-versions:
16+
python: latest
17+
build:
18+
commands:
19+
# The specific versions are manually installed
20+
# because they are not installed
21+
# by default in CodeBuild containers.
22+
# `pyenv` does not have
23+
# a nice way to just install
24+
# the latest patch version.
25+
# I have selected the current latest patch
26+
# rather than try
27+
# and manage a one-liner or script.
28+
# Testing every minor version
29+
# is too extreme at this time.
30+
# The choice of versions should be reviewed.
31+
- pyenv install 3.5.9
32+
- pyenv local 3.5.9
33+
- pip install tox tox-pyenv
34+
- tox

codebuild/py36/examples.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
TOXENV: "py36-examples"
6+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
7+
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
8+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
9+
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
10+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
11+
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
12+
13+
phases:
14+
install:
15+
runtime-versions:
16+
python: latest
17+
build:
18+
commands:
19+
- pip install tox
20+
- tox

0 commit comments

Comments
 (0)