Skip to content

Request response samples, rebased #801

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
783d153
Checkpoint, shadow sample
bretambrose Oct 30, 2024
72141b9
Updates
bretambrose Oct 31, 2024
14de847
Interactive shadow sample and readme with walkthrough
Nov 1, 2024
b94e919
Checkpoint
Nov 3, 2024
a3dc9d0
basic provisioning README
bretambrose Nov 3, 2024
76cd7ed
CSR Provisioning sample
bretambrose Nov 3, 2024
9c3c2ad
Omit cert-key storage comment
bretambrose Nov 3, 2024
423ea09
Wording
bretambrose Nov 3, 2024
f6d99a5
Jobs sample checkpoint
bretambrose Nov 3, 2024
0984999
Job sandbox readme/walkthrough
bretambrose Nov 4, 2024
16ee2d5
Update format process and formatting
bretambrose Nov 4, 2024
3476980
Why aren't samples built via a cmake option?
Nov 5, 2024
8cd0257
Trivial change to invoke fresh CI
bretambrose Nov 11, 2024
e37ae77
Will this setup the env variables?
bretambrose Nov 11, 2024
2f2cf89
Manual test invoke of cli
bretambrose Nov 11, 2024
d07d8b1
Revert "Manual test invoke of cli"
bretambrose Nov 11, 2024
1fd59a7
non-change to trigger CI
bretambrose Nov 11, 2024
aaf05ab
Non-change
bretambrose Nov 11, 2024
2d34563
Non change
bretambrose Nov 11, 2024
6dab65b
Basic CI Prep
Nov 12, 2024
66e21e5
Skip service tests on macs where keychain access/code-signing is nece…
Nov 12, 2024
976dacf
Can't have empty test exe
Nov 12, 2024
81fbd33
Temporarily allow mac service testing
Nov 12, 2024
a263027
Builder with fleet provisioning env
Nov 13, 2024
1428002
Update samples for API changes and fix deprecated compile failures
Nov 18, 2024
2d48236
Fix sample reference in builder action
Nov 18, 2024
bc3b575
Fix sample CI paths
Nov 18, 2024
1cdd95e
Experiment for windows build failures; need to update codegen if succ…
Nov 18, 2024
f70d610
Checkpoint before main merge and regenerate
Feb 7, 2025
2a65c54
A bunch of CMake fixes (#769)
graebm Feb 5, 2025
61851c2
Regen
Feb 7, 2025
f542f77
Format is being weird and annoying, probably won't work
Feb 7, 2025
8d28e73
Fix shadow samples in CI (#780)
sfod Feb 21, 2025
9a17005
Add sanitizer CI job (#703)
sfod Feb 24, 2025
d4312ab
Codegen updates
Feb 26, 2025
de3af28
Format
Feb 27, 2025
42b8a2f
Updated codegen
Mar 10, 2025
8351ff1
Add a workaround for promise and old VS
sfodagain Apr 30, 2025
a72d508
Apply promis eworkaround to all samples
sfodagain Apr 30, 2025
f09a56b
Fix links in sample readme
sfodagain Apr 30, 2025
79da0e4
Fix links in readmes
sfodagain Apr 30, 2025
081ccf1
fixup
sfodagain May 1, 2025
9748b7c
Merge branch 'RequestResponseWorkspacePreFormat' into RequestResponse…
sfodagain May 1, 2025
2c568af
Remove extra credentials
sfodagain May 1, 2025
8892c75
Merge branch 'RequestResponseWorkspacePreFormat' into RequestResponse…
sfodagain May 1, 2025
0bf2f3e
Change build instructions for samples
sfodagain May 1, 2025
d138a3d
Handle cin errors in samples
sfodagain May 1, 2025
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
16 changes: 10 additions & 6 deletions .builder/actions/build_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ def run(self, env):

steps = []
samples = [
'samples/deprecated/fleet_provisioning/fleet_provisioning',
'samples/deprecated/fleet_provisioning/mqtt5_fleet_provisioning',
'samples/deprecated/jobs/job_execution',
'samples/deprecated/jobs/mqtt5_job_execution',
'samples/deprecated/shadow/shadow_sync',
'samples/deprecated/shadow/mqtt5_shadow_sync',
'samples/greengrass/basic_discovery',
'samples/greengrass/ipc',
'samples/fleet_provisioning/fleet_provisioning',
'samples/fleet_provisioning/mqtt5_fleet_provisioning',
'samples/jobs/job_execution',
'samples/jobs/mqtt5_job_execution',
'samples/fleet_provisioning/provision-basic',
'samples/fleet_provisioning/provision-csr',
'samples/jobs/jobs-sandbox',
'samples/mqtt/basic_connect',
'samples/mqtt/custom_authorizer_connect',
'samples/mqtt/pkcs11_connect',
Expand All @@ -40,8 +45,7 @@ def run(self, env):
"samples/pub_sub/cycle_pub_sub",
'samples/secure_tunneling/secure_tunnel',
'samples/secure_tunneling/tunnel_notification',
'samples/shadow/shadow_sync',
'samples/shadow/mqtt5_shadow_sync',
'samples/shadow/shadow-sandbox',
]

defender_samples = []
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_fleet_provisioning_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/fleet_provisioning/fleet_provisioning/fleet-provisioning",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/fleet_provisioning/fleet_provisioning/fleet-provisioning",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/fleet_provisioning/mqtt5_fleet_provisioning/mqtt5-fleet-provisioning",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/fleet_provisioning/mqtt5_fleet_provisioning/mqtt5-fleet-provisioning",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_jobs_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/jobs/job_execution/job-execution",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/jobs/job_execution/job-execution",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_jobs_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/jobs/mqtt5_job_execution/mqtt5-job-execution",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/jobs/mqtt5_job_execution/mqtt5-job-execution",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_shadow_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/shadow/shadow_sync/shadow-sync",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/shadow/shadow_sync/shadow-sync",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_shadow_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/shadow/mqtt5_shadow_sync/mqtt5-shadow-sync",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/shadow/mqtt5_shadow_sync/mqtt5-shadow-sync",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
Expand Down
29 changes: 28 additions & 1 deletion codebuild/samples/shadow-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -e

env

pushd $CODEBUILD_SRC_DIR/samples/shadow/shadow_sync
# v1 MQTT311 shadow sample
pushd $CODEBUILD_SRC_DIR/samples/deprecated/shadow/shadow_sync

mkdir _build
cd _build
Expand All @@ -17,3 +18,29 @@ echo "Shadow-Sync test"
./shadow-sync --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --thing_name CI_CodeBuild_Thing --is_ci true

popd

# v1 MQTT5 shadow sample
pushd $CODEBUILD_SRC_DIR/samples/deprecated/shadow/mqtt5_shadow_sync

mkdir _build
cd _build
cmake -DCMAKE_PREFIX_PATH=/tmp/install ..
make -j

ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')

echo "Shadow-Sync test"
./mqtt5-shadow-sync --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --thing_name CI_CodeBuild_Thing --is_ci true

popd

# v2 MQTT5 shadow sample - smaple is interactive so build but don't run

pushd $CODEBUILD_SRC_DIR/samples/shadow/shadow-sandbox

mkdir _build
cd _build
cmake -DCMAKE_PREFIX_PATH=/tmp/install ..
make -j

popd
16 changes: 11 additions & 5 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ project(aws-iot-device-sdk-cpp-v2-samples)

add_subdirectory(device_defender/basic_report)
add_subdirectory(device_defender/mqtt5_basic_report)
add_subdirectory(fleet_provisioning/provision-basic)
add_subdirectory(fleet_provisioning/provision-csr)
add_subdirectory(greengrass/ipc)
add_subdirectory(greengrass/basic_discovery)
add_subdirectory(fleet_provisioning/fleet_provisioning)
add_subdirectory(fleet_provisioning/mqtt5_fleet_provisioning)
add_subdirectory(jobs/job_execution)
add_subdirectory(jobs/mqtt5_job_execution)
add_subdirectory(jobs/jobs-sandbox)
add_subdirectory(mqtt/basic_connect)
add_subdirectory(mqtt/custom_authorizer_connect)
add_subdirectory(mqtt/pkcs11_connect)
Expand All @@ -25,4 +24,11 @@ add_subdirectory(pub_sub/cycle_pub_sub)
add_subdirectory(secure_tunneling/secure_tunnel)
add_subdirectory(secure_tunneling/tunnel_notification)
add_subdirectory(shadow/shadow_sync)
add_subdirectory(shadow/mqtt5_shadow_sync)


add_subdirectory(deprecated/shadow/shadow_sync)
add_subdirectory(deprecated/shadow/mqtt5_shadow_sync)
add_subdirectory(deprecated/fleet_provisioning/fleet_provisioning)
add_subdirectory(deprecated/fleet_provisioning/mqtt5_fleet_provisioning)
add_subdirectory(deprecated/jobs/job_execution)
add_subdirectory(deprecated/jobs/mqtt5_job_execution)
10 changes: 4 additions & 6 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
+ [MQTT over Websockets with Cognito](./mqtt5/mqtt5_pubsub/README.md#mqtt-over-websockets-with-cognito)
+ [HTTP Proxy](./mqtt5/mqtt5_pubsub/README.md#http-proxy)
* [Mqtt5 Shared Subscription](./mqtt5/mqtt5_shared_subscription/README.md)
* [Mqtt5 Jobs](./jobs/mqtt5_job_execution/README.md)
* [Mqtt5 Shadow](./shadow/mqtt5_shadow_sync/README.md)
* [Mqtt5 Fleet Provisioning](./fleet_provisioning/mqtt5_fleet_provisioning/README.md)
## MQTT311 Samples
* [Basic Pub-Sub](./pub_sub/basic_pub_sub/README.md)
* [Basic Connect](./mqtt/basic_connect/README.md)
Expand All @@ -22,10 +19,11 @@
* [Windows Certificate MQTT Connect](./mqtt/windows_cert_connect/README.md)
* [Custom Authorizer Connect](./mqtt/custom_authorizer_connect/README.md)
* [Cognito Connect](./mqtt/cognito_connect/README.md)
* [Shadow](./shadow/shadow_sync/README.md)
* [Jobs](./jobs/job_execution/README.md)
* [Fleet provisioning](./fleet_provisioning/fleet_provisioning/README.md)
## Other Samples
* [Jobs Sandbox](./jobs/jobs-sandbox/README.md)
* [Shadow Sandbox](./shadow/shadow-sandbox/README.md)
* [Basic Fleet Provisioning](./fleet_provisioning/provision-basic/README.md)
* [CSR Fleet Provisioning](./fleet_provisioning/provision-csr/README.md)
* [Secure Tunnel](./secure_tunneling/secure_tunnel/README.md)
* [Secure Tunnel Notification](./secure_tunneling/tunnel_notification/README.md)
* [Cycle Pub-Sub](./pub_sub/cycle_pub_sub/README.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.9...3.31)
# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12
project(fleet-provisioning CXX)

file(GLOB SRC_FILES
"*.cpp"
"../../../utils/CommandLineUtils.cpp"
"../../../utils/CommandLineUtils.h"
)

add_executable(${PROJECT_NAME} ${SRC_FILES})

set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 14)

#set warnings
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else ()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()

find_package(aws-crt-cpp REQUIRED)
find_package(IotIdentity-cpp REQUIRED)

install(TARGETS ${PROJECT_NAME} DESTINATION bin)

include(AwsSanitizers)
enable_language(C)
aws_add_sanitizers(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotIdentity-cpp)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fleet provisioning

[**Return to main sample list**](../../README.md)
[**Return to main sample list**](../../../README.md)

This sample uses the AWS IoT [Fleet provisioning](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html) to provision devices using either a CSR or Keys-And-Certificate and subsequently calls RegisterThing. This allows you to create new AWS IoT Core things using a Fleet Provisioning Template.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <fstream>

#include "../../utils/CommandLineUtils.h"
#include "../../../utils/CommandLineUtils.h"

using namespace Aws::Crt;
using namespace Aws::Iotidentity;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.9...3.31)
# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12
project(mqtt5-fleet-provisioning CXX)

file(GLOB SRC_FILES
"*.cpp"
"../../../utils/CommandLineUtils.cpp"
"../../../utils/CommandLineUtils.h"
)

add_executable(${PROJECT_NAME} ${SRC_FILES})

set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 14)

#set warnings
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else ()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()

find_package(aws-crt-cpp REQUIRED)
find_package(IotIdentity-cpp REQUIRED)

install(TARGETS ${PROJECT_NAME} DESTINATION bin)

include(AwsSanitizers)
enable_language(C)
aws_add_sanitizers(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotIdentity-cpp)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fleet provisioning

[**Return to main sample list**](../../README.md)
[**Return to main sample list**](../../../README.md)

This sample uses the AWS IoT [Fleet provisioning](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html) to provision devices using either a CSR or Keys-And-Certificate and subsequently calls RegisterThing. This allows you to create new AWS IoT Core things using a Fleet Provisioning Template.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <fstream>

#include "../../utils/CommandLineUtils.h"
#include "../../../utils/CommandLineUtils.h"

using namespace Aws::Crt;
using namespace Aws::Iotidentity;
Expand Down
32 changes: 32 additions & 0 deletions samples/deprecated/jobs/job_execution/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.9...3.31)
# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12
project(job-execution CXX)

file(GLOB SRC_FILES
"*.cpp"
"../../../utils/CommandLineUtils.cpp"
"../../../utils/CommandLineUtils.h"
)

add_executable(${PROJECT_NAME} ${SRC_FILES})

set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 14)

#set warnings
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else ()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()

find_package(aws-crt-cpp REQUIRED)
find_package(IotJobs-cpp REQUIRED)

install(TARGETS ${PROJECT_NAME} DESTINATION bin)

include(AwsSanitizers)
enable_language(C)
aws_add_sanitizers(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotJobs-cpp)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Jobs

[**Return to main sample list**](../../README.md)
[**Return to main sample list**](../../../README.md)

This sample uses the AWS IoT [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) Service to describe jobs, it also executes them. [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) is a service that allows you to define and respond to remote operation requests defined through the AWS IoT Core website or via any other device (or CLI command) that can access the [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) service.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <mutex>
#include <thread>

#include "../../utils/CommandLineUtils.h"
#include "../../../utils/CommandLineUtils.h"

using namespace Aws::Crt;
using namespace Aws::Iotjobs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ project(mqtt5-job-execution CXX)

file(GLOB SRC_FILES
"*.cpp"
"../../utils/CommandLineUtils.cpp"
"../../utils/CommandLineUtils.h"
"../../../utils/CommandLineUtils.cpp"
"../../../utils/CommandLineUtils.h"
)

add_executable(${PROJECT_NAME} ${SRC_FILES})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Jobs

[**Return to main sample list**](../../README.md)
[**Return to main sample list**](../../../README.md)

This sample uses the AWS IoT [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) Service to describe jobs to execute, it them executes them. [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) is a service that allows you to define and respond to remote operation requests defined through the AWS IoT Core website or via any other device (or CLI command) that can access the [Jobs](https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html) service.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <mutex>
#include <thread>

#include "../../utils/CommandLineUtils.h"
#include "../../../utils/CommandLineUtils.h"

using namespace Aws::Crt;
using namespace Aws::Iotjobs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ project(mqtt5-shadow-sync CXX)

file(GLOB SRC_FILES
"*.cpp"
"../../utils/CommandLineUtils.cpp"
"../../utils/CommandLineUtils.h"
"../../../utils/CommandLineUtils.cpp"
"../../../utils/CommandLineUtils.h"
)

add_executable(${PROJECT_NAME} ${SRC_FILES})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shadow

[**Return to main sample list**](../../README.md)
[**Return to main sample list**](../../../README.md)

This sample uses the AWS IoT [Device Shadow](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html) Service to keep a property in sync between device and server. Imagine a light whose color may be changed through an app, or set by a local user.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <mutex>
#include <thread>

#include "../../utils/CommandLineUtils.h"
#include "../../../utils/CommandLineUtils.h"

using namespace Aws::Crt;
using namespace Aws::Iotshadow;
Expand Down
Loading