Skip to content

Commit 5fd586a

Browse files
authored
Request-response MQTT service clients (#619)
* Adds request-response service clients for the Shadow, Jobs, and Identity services * Moves samples that use the old clients to a deprecated folder * Adds new samples for each service that use the request-response clients
1 parent 75ae6e5 commit 5fd586a

40 files changed

+6122
-977
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,32 @@ jobs:
4848
run: |
4949
python -m pip install boto3
5050
- name: configure AWS credentials (containers)
51-
uses: aws-actions/configure-aws-credentials@v2
51+
uses: aws-actions/configure-aws-credentials@v4
5252
with:
5353
role-to-assume: ${{ env.CI_BUILD_AND_TEST_ROLE }}
5454
aws-region: ${{ env.AWS_DEFAULT_REGION }}
5555
- name: Build ${{ env.PACKAGE_NAME }}
5656
run: |
5757
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
5858
python builder.pyz build -p ${{ env.PACKAGE_NAME }}
59-
- name: configure AWS credentials (PubSub)
59+
- name: configure AWS credentials (MQTT5)
6060
uses: aws-actions/configure-aws-credentials@v2
61+
with:
62+
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
63+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
64+
- name: Service tests
65+
shell: bash
66+
run: |
67+
cd aws-iot-device-sdk-python-v2
68+
python3 -m pip install .
69+
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
70+
python3 -m unittest test.test_shadow
71+
python3 -m unittest test.test_jobs
72+
python3 -m unittest test.test_identity
73+
source utils/test_cleanup.sh
74+
cd ..
75+
- name: configure AWS credentials (PubSub)
76+
uses: aws-actions/configure-aws-credentials@v4
6177
with:
6278
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
6379
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -68,15 +84,15 @@ jobs:
6884
run: |
6985
python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_windows_cert_connect_cfg.json
7086
- name: configure AWS credentials (MQTT5 samples)
71-
uses: aws-actions/configure-aws-credentials@v2
87+
uses: aws-actions/configure-aws-credentials@v4
7288
with:
7389
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
7490
aws-region: ${{ env.AWS_DEFAULT_REGION }}
7591
- name: run MQTT5 PubSub sample
7692
run: |
7793
python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json
7894
- name: configure AWS credentials (Device Advisor)
79-
uses: aws-actions/configure-aws-credentials@v2
95+
uses: aws-actions/configure-aws-credentials@v4
8096
with:
8197
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
8298
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -103,7 +119,7 @@ jobs:
103119
source .venv/bin/activate
104120
python3 -m pip install boto3
105121
- name: configure AWS credentials (containers)
106-
uses: aws-actions/configure-aws-credentials@v2
122+
uses: aws-actions/configure-aws-credentials@v4
107123
with:
108124
role-to-assume: ${{ env.CI_BUILD_AND_TEST_ROLE }}
109125
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -113,8 +129,25 @@ jobs:
113129
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
114130
chmod a+x builder
115131
./builder build -p ${{ env.PACKAGE_NAME }}
116-
- name: configure AWS credentials (PubSub)
132+
- name: configure AWS credentials (MQTT5)
117133
uses: aws-actions/configure-aws-credentials@v2
134+
with:
135+
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
136+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
137+
- name: Service tests
138+
shell: bash
139+
run: |
140+
source .venv/bin/activate
141+
cd aws-iot-device-sdk-python-v2
142+
python3 -m pip install .
143+
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
144+
python3 -m unittest test.test_shadow
145+
python3 -m unittest test.test_jobs
146+
python3 -m unittest test.test_identity
147+
source utils/test_cleanup.sh
148+
cd ..
149+
- name: configure AWS credentials (PubSub)
150+
uses: aws-actions/configure-aws-credentials@v4
118151
with:
119152
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
120153
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -131,7 +164,7 @@ jobs:
131164
source .venv/bin/activate
132165
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pkcs12_connect_cfg.json
133166
- name: configure AWS credentials (MQTT5 samples)
134-
uses: aws-actions/configure-aws-credentials@v2
167+
uses: aws-actions/configure-aws-credentials@v4
135168
with:
136169
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
137170
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -140,7 +173,7 @@ jobs:
140173
source .venv/bin/activate
141174
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json
142175
- name: configure AWS credentials (Device Advisor)
143-
uses: aws-actions/configure-aws-credentials@v2
176+
uses: aws-actions/configure-aws-credentials@v4
144177
with:
145178
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
146179
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -155,11 +188,11 @@ jobs:
155188
permissions:
156189
id-token: write # This is required for requesting the JWT
157190
steps:
158-
- name: Running samples in CI setup
191+
- name: Install AWS SDK for Python
159192
run: |
160-
python -m pip install boto3
193+
python3 -m pip install boto3
161194
- name: configure AWS credentials (containers)
162-
uses: aws-actions/configure-aws-credentials@v2
195+
uses: aws-actions/configure-aws-credentials@v4
163196
with:
164197
role-to-assume: ${{ env.CI_BUILD_AND_TEST_ROLE }}
165198
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -168,27 +201,40 @@ jobs:
168201
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
169202
chmod a+x builder
170203
./builder build -p ${{ env.PACKAGE_NAME }}
171-
- name: Running samples in CI setup
204+
- name: configure AWS credentials (MQTT5)
205+
uses: aws-actions/configure-aws-credentials@v2
206+
with:
207+
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
208+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
209+
- name: Service tests
210+
shell: bash
172211
run: |
173-
python3 -m pip install boto3
212+
cd aws-iot-device-sdk-python-v2
213+
python3 -m pip install .
214+
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
215+
python3 -m unittest test.test_shadow
216+
python3 -m unittest test.test_jobs
217+
python3 -m unittest test.test_identity
218+
source utils/test_cleanup.sh
219+
cd ..
174220
- name: configure AWS credentials (PubSub)
175-
uses: aws-actions/configure-aws-credentials@v2
221+
uses: aws-actions/configure-aws-credentials@v4
176222
with:
177223
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
178224
aws-region: ${{ env.AWS_DEFAULT_REGION }}
179225
- name: run PubSub sample
180226
run: |
181227
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_cfg.json
182228
- name: configure AWS credentials (MQTT5 samples)
183-
uses: aws-actions/configure-aws-credentials@v2
229+
uses: aws-actions/configure-aws-credentials@v4
184230
with:
185231
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
186232
aws-region: ${{ env.AWS_DEFAULT_REGION }}
187233
- name: run MQTT5 PubSub sample
188234
run: |
189235
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json
190236
- name: configure AWS credentials (Device Advisor)
191-
uses: aws-actions/configure-aws-credentials@v2
237+
uses: aws-actions/configure-aws-credentials@v4
192238
with:
193239
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
194240
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -210,7 +256,7 @@ jobs:
210256
sudo apt-get install softhsm -y
211257
softhsm2-util --version
212258
- name: configure AWS credentials (containers)
213-
uses: aws-actions/configure-aws-credentials@v2
259+
uses: aws-actions/configure-aws-credentials@v4
214260
with:
215261
role-to-assume: ${{ env.CI_BUILD_AND_TEST_ROLE }}
216262
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -221,7 +267,7 @@ jobs:
221267
./builder build -p ${{ env.PACKAGE_NAME }}
222268
223269
- name: configure AWS credentials (service tests Fleet Provisioning)
224-
uses: aws-actions/configure-aws-credentials@v2
270+
uses: aws-actions/configure-aws-credentials@v4
225271
with:
226272
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE}}
227273
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -247,7 +293,7 @@ jobs:
247293
python3 ./test_cases/test_fleet_provisioning.py --config-file test_cases/mqtt5_fleet_provisioning_with_csr_cfg.json --thing-name-prefix Fleet_Thing_
248294
249295
- name: configure AWS credentials (service tests Shadow)
250-
uses: aws-actions/configure-aws-credentials@v2
296+
uses: aws-actions/configure-aws-credentials@v4
251297
with:
252298
role-to-assume: ${{ env.CI_SHADOW_SERVICE_CLIENT_ROLE }}
253299
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -273,7 +319,7 @@ jobs:
273319
python3 ./test_cases/test_shadow_update.py --config-file test_cases/mqtt3_named_shadow_cfg.json
274320
275321
- name: configure AWS credentials (service tests Jobs)
276-
uses: aws-actions/configure-aws-credentials@v2
322+
uses: aws-actions/configure-aws-credentials@v4
277323
with:
278324
role-to-assume: ${{ env.CI_JOBS_SERVICE_CLIENT_ROLE}}
279325
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -289,7 +335,7 @@ jobs:
289335
python3 ./test_cases/test_jobs_execution.py --config-file test_cases/mqtt5_jobs_cfg.json
290336
291337
- name: configure AWS credentials (Connect and PubSub)
292-
uses: aws-actions/configure-aws-credentials@v2
338+
uses: aws-actions/configure-aws-credentials@v4
293339
with:
294340
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
295341
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -309,23 +355,23 @@ jobs:
309355
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
310356
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pkcs11_connect_cfg.json
311357
- name: configure AWS credentials (Cognito)
312-
uses: aws-actions/configure-aws-credentials@v2
358+
uses: aws-actions/configure-aws-credentials@v4
313359
with:
314360
role-to-assume: ${{ env.CI_COGNITO_ROLE }}
315361
aws-region: ${{ env.AWS_DEFAULT_REGION }}
316362
- name: run Cognito Connect sample
317363
run: |
318364
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_cognito_connect_cfg.json
319365
- name: configure AWS credentials (X509)
320-
uses: aws-actions/configure-aws-credentials@v2
366+
uses: aws-actions/configure-aws-credentials@v4
321367
with:
322368
role-to-assume: ${{ env.CI_X509_ROLE }}
323369
aws-region: ${{ env.AWS_DEFAULT_REGION }}
324370
- name: run X509 sample
325371
run: |
326372
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_x509_connect_cfg.json
327373
- name: configure AWS credentials (MQTT5 samples)
328-
uses: aws-actions/configure-aws-credentials@v2
374+
uses: aws-actions/configure-aws-credentials@v4
329375
with:
330376
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
331377
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -348,15 +394,15 @@ jobs:
348394
run: |
349395
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_shared_subscription_cfg.json
350396
- name: configure AWS credentials (Custom Authorizer)
351-
uses: aws-actions/configure-aws-credentials@v2
397+
uses: aws-actions/configure-aws-credentials@v4
352398
with:
353399
role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }}
354400
aws-region: ${{ env.AWS_DEFAULT_REGION }}
355401
- name: run CustomAuthorizerConnect sample
356402
run: |
357403
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_custom_authorizer_connect_cfg.json
358404
- name: configure AWS credentials (Shadow)
359-
uses: aws-actions/configure-aws-credentials@v2
405+
uses: aws-actions/configure-aws-credentials@v4
360406
with:
361407
role-to-assume: ${{ env.CI_SHADOW_ROLE }}
362408
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -367,7 +413,7 @@ jobs:
367413
run: |
368414
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_shadow_cfg.json
369415
- name: configure AWS credentials (Jobs)
370-
uses: aws-actions/configure-aws-credentials@v2
416+
uses: aws-actions/configure-aws-credentials@v4
371417
with:
372418
role-to-assume: ${{ env.CI_JOBS_ROLE }}
373419
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -378,7 +424,7 @@ jobs:
378424
run: |
379425
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_jobs_cfg.json
380426
- name: configure AWS credentials (Fleet provisioning)
381-
uses: aws-actions/configure-aws-credentials@v2
427+
uses: aws-actions/configure-aws-credentials@v4
382428
with:
383429
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }}
384430
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -404,7 +450,7 @@ jobs:
404450
run: |
405451
python3 -m pip install boto3
406452
- name: configure AWS credentials (containers)
407-
uses: aws-actions/configure-aws-credentials@v2
453+
uses: aws-actions/configure-aws-credentials@v4
408454
with:
409455
role-to-assume: ${{ env.CI_BUILD_AND_TEST_ROLE }}
410456
aws-region: ${{ env.AWS_DEFAULT_REGION }}
@@ -418,7 +464,7 @@ jobs:
418464
python3 -m pip install awsiotsdk
419465
python3 -m pip install -U git+https://github.com/aws-greengrass/[email protected]
420466
- name: Configure AWS credentials (Greengrass)
421-
uses: aws-actions/configure-aws-credentials@v2
467+
uses: aws-actions/configure-aws-credentials@v4
422468
with:
423469
role-to-assume: ${{ env.CI_GREENGRASS_INSTALLER_ROLE }}
424470
aws-region: ${{ env.AWS_DEFAULT_REGION }}

.github/workflows/ci_run_fleet_provisioning_cfg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"language": "Python",
3-
"sample_file": "./aws-iot-device-sdk-python-v2/samples/fleetprovisioning.py",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/deprecated/fleetprovisioning.py",
44
"sample_region": "us-east-1",
55
"sample_main_class": "",
66
"arguments": [

.github/workflows/ci_run_jobs_cfg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"language": "Python",
3-
"sample_file": "./aws-iot-device-sdk-python-v2/samples/jobs.py",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/deprecated/jobs.py",
44
"sample_region": "us-east-1",
55
"sample_main_class": "",
66
"arguments": [

.github/workflows/ci_run_mqtt5_fleet_provisioning_cfg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"language": "Python",
3-
"sample_file": "./aws-iot-device-sdk-python-v2/samples/fleetprovisioning_mqtt5.py",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/deprecated/fleetprovisioning_mqtt5.py",
44
"sample_region": "us-east-1",
55
"sample_main_class": "",
66
"arguments": [

.github/workflows/ci_run_mqtt5_jobs_cfg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"language": "Python",
3-
"sample_file": "./aws-iot-device-sdk-python-v2/samples/jobs_mqtt5.py",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/deprecated/jobs_mqtt5.py",
44
"sample_region": "us-east-1",
55
"sample_main_class": "",
66
"arguments": [

.github/workflows/ci_run_mqtt5_shadow_cfg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"language": "Python",
3-
"sample_file": "./aws-iot-device-sdk-python-v2/samples/shadow_mqtt5.py",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/deprecated/shadow_mqtt5.py",
44
"sample_region": "us-east-1",
55
"sample_main_class": "",
66
"arguments": [

.github/workflows/ci_run_shadow_cfg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"language": "Python",
3-
"sample_file": "./aws-iot-device-sdk-python-v2/samples/shadow.py",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/deprecated/shadow.py",
44
"sample_region": "us-east-1",
55
"sample_main_class": "",
66
"arguments": [

0 commit comments

Comments
 (0)