Skip to content

Request response samples #763

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

Open
wants to merge 24 commits into
base: RequestResponseWorkspace
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d2abcb5
Checkpoint, shadow sample
bretambrose Oct 30, 2024
bdab63b
Updates
bretambrose Oct 31, 2024
d9ac0cd
Interactive shadow sample and readme with walkthrough
Nov 1, 2024
e2e0f34
Checkpoint
Nov 3, 2024
8f0aded
basic provisioning README
bretambrose Nov 3, 2024
d31f6cb
CSR Provisioning sample
bretambrose Nov 3, 2024
0ab6469
Omit cert-key storage comment
bretambrose Nov 3, 2024
90cab82
Wording
bretambrose Nov 3, 2024
c06a7bb
Jobs sample checkpoint
bretambrose Nov 3, 2024
1e2c0d0
Job sandbox readme/walkthrough
bretambrose Nov 4, 2024
764c808
\Merge branch 'RequestResponseWorkspace' into RequestResponseSamples
bretambrose Nov 5, 2024
2f42ab2
Why aren't samples built via a cmake option?
Nov 5, 2024
4a69b8a
Merge branch 'RequestResponseWorkspace' into RequestResponseSamples
Nov 18, 2024
00b1609
Update samples for API changes and fix deprecated compile failures
Nov 18, 2024
5ccc453
Fix sample reference in builder action
Nov 18, 2024
5789137
Fix sample CI paths
Nov 18, 2024
f2043c0
Experiment for windows build failures; need to update codegen if succ…
Nov 18, 2024
e711fce
Merge branch 'RequestResponseWorkspace' into RequestResponseSamples
Feb 27, 2025
9abecca
Merge branch 'RequestResponseWorkspace' into RequestResponseSamples
Feb 27, 2025
274e187
Merge branch 'RequestResponseWorkspace' into RequestResponseSamples
Mar 10, 2025
18b3e2b
Add a workaround for promise and old VS
sfodagain Apr 30, 2025
dbbc26e
Apply promis eworkaround to all samples
sfodagain Apr 30, 2025
3a6b81a
Fix links in sample readme
sfodagain Apr 30, 2025
66c8334
Fix links in readmes
sfodagain Apr 30, 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,28 @@
cmake_minimum_required(VERSION 3.9)
# 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)

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,28 @@
cmake_minimum_required(VERSION 3.9)
# 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)

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
28 changes: 28 additions & 0 deletions samples/deprecated/jobs/job_execution/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.9)
# 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)

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
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ project(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 @@ -28,7 +28,7 @@
#include <mutex>
#include <thread>

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

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