Skip to content

Commit

Permalink
fix static credentials example
Browse files Browse the repository at this point in the history
  • Loading branch information
jmklix committed Aug 30, 2024
1 parent 1ef6533 commit d10280a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions samples/utils/command_line_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,20 @@ def parse_sample_input_static_credentials_connect():
cmdUtils.register_command(CommandLineUtils.m_cmd_client_id, "<str>",
"Client ID to use for MQTT connection (optional, default='test-*').",
default="test-" + str(uuid4()))
cmdUtils.register_command(CommandLineUtils.m_cmd_signing_region, "<str>",
"The signing region used for the websocket signer",
False, str)
cmdUtils.register_command(CommandLineUtils.m_cmd_session_token, "<str>", "", default="test-" + str(uuid4()))
cmdUtils.register_command(CommandLineUtils.m_cmd_access_key_id, "<int>", "", type=int)
cmdUtils.register_command(CommandLineUtils.m_cmd_access_key_id, "<str>", "")
cmdUtils.register_command(CommandLineUtils.m_cmd_secret_access_key, "<str>", "")
cmdUtils.get_args()

cmdData = CommandLineUtils.CmdData()
cmdData.input_endpoint = cmdUtils.get_command_required(CommandLineUtils.m_cmd_endpoint)
cmdData.input_session_token = cmdUtils.get_command(CommandLineUtils.m_cmd_session_token)
cmdData.input_signing_region = cmdUtils.get_command_required(CommandLineUtils.m_cmd_signing_region, CommandLineUtils.m_cmd_region)
cmdData.input_access_key_id = cmdUtils.get_command(CommandLineUtils.m_cmd_access_key_id)
cmdData.input_secret_access_key = cmdUtils.get_command(CommandLineUtils.m_secret_access_key)
cmdData.input_secret_access_key = cmdUtils.get_command(CommandLineUtils.m_cmd_secret_access_key)
cmdData.input_clientId = cmdUtils.get_command(CommandLineUtils.m_cmd_client_id, "test-" + str(uuid4()))
cmdData.input_is_ci = cmdUtils.get_command(CommandLineUtils.m_cmd_is_ci, None) != None
return cmdData
Expand Down
4 changes: 2 additions & 2 deletions samples/websocket_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ If you want to use custom auth (or static creds, or basic auth, etc) instead,
then you will need to replace part of the sample (connection\_setup function) with a code snippet we provided in its corresponding readme.

* [Websocket Connection Using Custom Authentication](#websocket-connection-using-custom-authentication)
* [Websocket Connection Using Static Credentials](#websocket-connection-using-custom-authentication)
* [Websocket Connection Using Static Credentials](#websocket-connection-using-static-credentials)

This sample makes an MQTT connection via Websockets and then disconnects.
On startup, the device connects to the server via Websockets and then disconnects right after.
Expand Down Expand Up @@ -157,7 +157,7 @@ def connection_setup():
# See the Utils/CommandLineUtils for more information.
cmdData = CommandLineUtils.parse_sample_input_static_credentials_connect()

cred_provider = AwsCredentialsProvider.new_static(
cred_provider = auth.AwsCredentialsProvider.new_static(
access_key_id=cmdData.input_access_key_id,
secret_access_key=cmdData.input_secret_access_key,
session_token=cmdData.input_session_token)
Expand Down

0 comments on commit d10280a

Please sign in to comment.