Skip to content

Commit dae5b0b

Browse files
authored
Simplify samples (#649)
1 parent 8a3b4c7 commit dae5b0b

File tree

10 files changed

+9
-27
lines changed

10 files changed

+9
-27
lines changed

codebuild/cd/test-prod-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ phases:
2828
- CURRENT_TAG_VERSION=$(cat $CODEBUILD_SRC_DIR/VERSION)
2929
- python3 codebuild/cd/pip-install-with-retry.py --no-cache-dir --user awsiotsdk==$CURRENT_TAG_VERSION
3030
# Run PubSub sample
31-
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --verbosity Trace
31+
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem
3232

3333
post_build:
3434
commands:

codebuild/cd/test-test-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ phases:
2929
- python3 -m pip install typing
3030
- python3 codebuild/cd/pip-install-with-retry.py -i https://testpypi.python.org/simple --user awsiotsdk==$CURRENT_TAG_VERSION
3131
# Run PubSub sample
32-
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --verbosity Trace
32+
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem
3333

3434
post_build:
3535
commands:

documents/FAQ.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ Here is an example launch.json file to run the pubsub sample
105105
"program": "${workspaceFolder}/samples/mqtt/mqtt5_x509.py",
106106
"args": [
107107
"--endpoint", "<account-number>-ats.iot.<region>.amazonaws.com",
108-
"--ca_file", "<path to root-CA>",
109108
"--cert", "<path to cert>",
110109
"--key", "<path to key>",
111110
"--client_id", "test-client"

samples/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Sample for the AWS IoT Device SDK v2 for Python
1+
# Sample Applications for the AWS IoT Device SDK v2 for Python
22
This directory contains sample applications for [aws-iot-device-sdk-python-v2](../README.md).
33

44
### Table of Contents
@@ -41,7 +41,7 @@ This directory contains sample applications for [aws-iot-device-sdk-python-v2](.
4141

4242
### Instructions
4343

44-
First, install `aws-iot-devices-sdk-python-v2`. Installation instructions for the SDK are [Provided Here](../README.md#Installation).
44+
First, install `aws-iot-device-sdk-python-v2`. Installation instructions for the SDK are [Provided Here](../README.md#Installation).
4545

4646
Each sample's README contains prerequisites, arguments, and detailed instructions. For example, the [MQTT5 X509 Sample README](./mqtt/mqtt5_x509.md) is `mqtt5_x509.md` and the sample can be run with the following command:
4747

@@ -72,7 +72,6 @@ required arguments:
7272
7373
optional arguments:
7474
--client_id Client ID (default: mqtt5-sample-5873a450)
75-
--ca_file Path to optional CA bundle (PEM) (default: None)
7675
--topic Topic (default: test/topic)
7776
--message Message payload (default: Hello from mqtt5 sample)
7877
--count Messages to publish (0 = infinite) (default: 5)

samples/mqtt/mqtt5_custom_auth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ To Run this sample from the `samples\mqtt` folder, use the following command:
7676
# For an unsigned custom authorizer
7777
python3 mqtt5_custom_auth_unsigned.py \
7878
--endpoint <AWS IoT endpoint> \
79-
--authorizer_name <The name of the custom authorizer to connect to invoke> \
79+
--authorizer_name <The name of the custom authorizer to invoke> \
8080
--auth_username <The name to send when connecting through the custom authorizer>\
8181
--auth_password <The password to send when connecting through a custom authorizer>
8282

8383
# For a signed custom authorizer
8484
python3 mqtt5_custom_auth_signed.py \
8585
--endpoint <AWS IoT endpoint> \
86-
--authorizer_name <The name of the custom authorizer to connect to invoke> \
86+
--authorizer_name <The name of the custom authorizer to invoke> \
8787
--auth_token_key_name <Authorizer token key name> \
8888
--auth_token_key_value <Authorizer token key value> \
8989
--auth_signature <Custom authorizer signature> \

samples/mqtt/mqtt5_pkcs11_connect.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,12 @@ required arguments:
101101
--pin User PIN for logging into PKCS#11 token (default: None)
102102
103103
optional arguments:
104-
--port Port (8883 mTLS, 443 ALPN) (default: 8883)
105104
--token_label Label of the PKCS#11 token to use (optional). (default: None)
106105
--slot_id Slot ID containing the PKCS#11 token to use (optional). (default: None)
107106
--key_label Label of private key on the PKCS#11 token (optional). (default: None)
108-
--ca_file Path to optional CA bundle (PEM) (default: None)
109107
--topic Topic (default: test/topic)
110108
--message Message payload (default: Hello from mqtt5 sample)
111109
--count Messages to publish (0 = infinite) (default: 5)
112-
113110
--client_id Client ID (default: mqtt5-sample-<uuid>)
114111
```
115112

@@ -167,7 +164,7 @@ The steps to use [SoftHSM2](https://www.opendnssec.org/softhsm/) as the PKCS#11
167164

168165
```sh
169166
# For Windows: replace 'python3' with 'python' and '/' with '\'
170-
python3 mqtt5_pkcs11_connect.py --endpoint <endpoint> --ca_file <path to root CA> --cert <path to certificate> --pkcs11_lib <path to PKCS11 lib> --pin <user-pin> --token_label <token-label> --key_label <key-label>
167+
python3 mqtt5_pkcs11_connect.py --endpoint <endpoint> --cert <path to certificate> --pkcs11_lib <path to PKCS11 lib> --pin <user-pin> --token_label <token-label> --key_label <key-label>
171168
```
172169

173170
## Additional Information

samples/mqtt/mqtt5_pkcs11_connect.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
# Required Arguments
1919
required.add_argument("--endpoint", required=True, metavar="", dest="input_endpoint",
2020
help="IoT endpoint hostname")
21-
optional.add_argument("--port", type=int, default=8883, metavar="", dest="input_port",
22-
help="Port (8883 mTLS, 443 ALPN)")
2321
required.add_argument("--cert", required=True, metavar="", dest="input_cert",
2422
help="Path to the certificate file to use during mTLS connection establishment")
2523
required.add_argument("--pkcs11_lib", required=True, metavar="", dest="input_pkcs11_lib_path",
@@ -34,15 +32,12 @@
3432
help="Slot ID containing the PKCS#11 token to use (optional).")
3533
optional.add_argument("--key_label", metavar="", dest="input_pkcs11_key_label",
3634
help="Label of private key on the PKCS#11 token (optional).")
37-
optional.add_argument("--ca_file", metavar="", dest="input_ca",
38-
help="Path to optional CA bundle (PEM)")
3935
optional.add_argument("--topic", default="test/topic", metavar="", dest="input_topic",
4036
help="Topic")
4137
optional.add_argument("--message", default="Hello from mqtt5 sample", metavar="", dest="input_message",
4238
help="Message payload")
4339
optional.add_argument("--count", type=int, default=5, metavar="", dest="input_count",
4440
help="Messages to publish (0 = infinite)")
45-
4641
optional.add_argument("--client_id", metavar="", dest="input_clientId", default=f"mqtt5-sample-{uuid.uuid4().hex[:8]}",
4742
help="Client ID")
4843

@@ -102,8 +97,6 @@ def on_lifecycle_disconnection(lifecycle_disconnect_data: mqtt5.LifecycleDisconn
10297
private_key_label=args.input_pkcs11_key_label,
10398
cert_filepath=args.input_cert,
10499
endpoint=args.input_endpoint,
105-
port=args.input_port,
106-
ca_filepath=args.input_ca,
107100
on_lifecycle_stopped=on_lifecycle_stopped,
108101
on_lifecycle_connection_success=on_lifecycle_connection_success,
109102
on_lifecycle_connection_failure=on_lifecycle_connection_failure,

samples/mqtt/mqtt5_x509.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ required arguments:
9797
9898
optional arguments:
9999
--client_id Client ID (default: mqtt5-sample-<uuid>)
100-
--ca_file Path to optional CA bundle (PEM) (default: None)
101100
--topic Topic (default: test/topic)
102101
--message Message payload (default: Hello from mqtt5 sample)
103102
--count Messages to publish (0 = infinite) (default: 5)

samples/mqtt/mqtt5_x509.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
# Optional Arguments
2727
optional.add_argument("--client_id", metavar="",dest="input_clientId", default=f"mqtt5-sample-{uuid.uuid4().hex[:8]}",
2828
help="Client ID")
29-
optional.add_argument("--ca_file", metavar="",dest="input_ca",
30-
help="Path to optional CA bundle (PEM)")
3129
optional.add_argument("--topic", metavar="",default="test/topic", dest="input_topic",
3230
help="Topic")
3331
optional.add_argument("--message", metavar="",default="Hello from mqtt5 sample", dest="input_message",
@@ -107,7 +105,6 @@ def on_lifecycle_disconnection(lifecycle_disconnect_data: mqtt5.LifecycleDisconn
107105
endpoint=args.input_endpoint,
108106
cert_filepath=args.input_cert,
109107
pri_key_filepath=args.input_key,
110-
ca_filepath=args.input_ca,
111108
on_publish_received=on_publish_received,
112109
on_lifecycle_stopped=on_lifecycle_stopped,
113110
on_lifecycle_attempting_connect=on_lifecycle_attempting_connect,

test/test_samples.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ def test_pubsub(self):
108108
"--cert", config.cert_filepath,
109109
"--key", config.key_filepath,
110110
"--client_id", create_client_id(),
111-
"--count", "1",
112-
"--verbosity", "Trace",
111+
"--count", "1"
113112
]
114113

115114
def stdout_checker(stdout):
@@ -128,8 +127,7 @@ def test_basic_discovery_response_only(self):
128127
"--region", config.region,
129128
"--cert", config.cert_filepath,
130129
"--key", config.key_filepath,
131-
"--thing_name", "CI_Greengrass_Discovery_Thing",
132-
"--verbosity", "Trace",
130+
"--thing_name", "CI_Greengrass_Discovery_Thing"
133131
]
134132

135133
def stdout_checker(stdout):

0 commit comments

Comments
 (0)