Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix static credentials example #592

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading