From 8e456cd8fcabacd496dfed411eff998a75d6e745 Mon Sep 17 00:00:00 2001 From: David Oguns <38018552+DavidOgunsAWS@users.noreply.github.com> Date: Fri, 30 Apr 2021 21:34:16 +0000 Subject: [PATCH 01/17] Updating aws-crt-cpp submodule for bug fixes. (#263) --- crt/aws-crt-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index e73de1836..27619f580 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit e73de183645977aa942fa96a179686c7efe88fdc +Subproject commit 27619f580520b852c68136c6b5f50f3c0dfebb82 From d357610b04d57ac3e9c76fa30bbf40010cd5e232 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 14 May 2021 11:49:22 -0700 Subject: [PATCH 02/17] crt update (#271) Update aws-crt-cpp to v0.13.6 to bring up the following: ### BUGFIX - Don't run aws-lc's codegen at build time, it just introduces complexity. - Some characters were not correctly URI-encoded - Fix crash when peer hangs up immediately following first non-TLS write. - Fix issue where TLS context initialization could fail on linux due to passing in buffers that weren't properly zero-terminated at their final length. - OpenSSL libcrypto.a detection fixes ### Optimization - Only using extra warning and werror flags on Debug build type - Add support to store and pass SDK Name & Version as a metric to IoT cloud --- crt/aws-crt-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index 27619f580..b71bb2e18 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit 27619f580520b852c68136c6b5f50f3c0dfebb82 +Subproject commit b71bb2e18b01fa785e5dddd6d231f6caf2cef056 From df16ccb07cc303e2f7f9b01d8ecb511214025612 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Fri, 14 May 2021 14:51:21 -0700 Subject: [PATCH 03/17] Use check-submodules action (#272) --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e50d429d2..ebf8c320b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,3 +118,16 @@ jobs: python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream + + check-submodules: + runs-on: ubuntu-latest + steps: + - name: Checkout Source + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + - name: Check Submodules + # note: using "@main" because "@${{env.BUILDER_VERSION}}" doesn't work + # https://github.com/actions/runner/issues/480 + uses: awslabs/aws-crt-builder/.github/actions/check-submodules@main From 57ded0046d1cda3b35fbe9298eed308392961435 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Tue, 18 May 2021 12:35:12 -0700 Subject: [PATCH 04/17] Update proxy-aware samples with new proxy options (#274) * Update proxy-aware samples with new proxy options --- crt/aws-crt-cpp | 2 +- samples/mqtt/basic_pub_sub/main.cpp | 48 +++++++++++++++-------------- samples/mqtt/raw_pub_sub/main.cpp | 25 +++++++++------ 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index b71bb2e18..5ad76e084 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit b71bb2e18b01fa785e5dddd6d231f6caf2cef056 +Subproject commit 5ad76e0844658b3e6f8c6988d83289ca9b922266 diff --git a/samples/mqtt/basic_pub_sub/main.cpp b/samples/mqtt/basic_pub_sub/main.cpp index 2754ff45e..5bdb09baf 100644 --- a/samples/mqtt/basic_pub_sub/main.cpp +++ b/samples/mqtt/basic_pub_sub/main.cpp @@ -44,9 +44,8 @@ static void s_printHelp() stdout, "signing_region: used for websocket signer it should only be specific if websockets are used. (required for " "websockets)\n"); - fprintf(stdout, "proxy_host: if you want to use a proxy with websockets, specify the host here (optional).\n"); - fprintf( - stdout, "proxy_port: defaults to 8080 is proxy_host is set. Set this to any value you'd like (optional).\n"); + fprintf(stdout, "proxy_host: host name of the http proxy to use (optional).\n"); + fprintf(stdout, "proxy_port: port of the http proxy to use (optional).\n"); fprintf(stdout, " x509: Use the x509 credentials provider while using websockets (optional)\n"); fprintf(stdout, " x509_role_alias: Role alias to use with the x509 credentials provider (required for x509)\n"); @@ -155,15 +154,19 @@ int main(int argc, char *argv[]) } useWebSocket = true; signingRegion = s_getCmdOption(argv, argv + argc, "--signing_region"); + } - if (s_cmdOptionExists(argv, argv + argc, "--proxy_host")) - { - proxyHost = s_getCmdOption(argv, argv + argc, "--proxy_host"); - } + if (s_cmdOptionExists(argv, argv + argc, "--proxy_host")) + { + proxyHost = s_getCmdOption(argv, argv + argc, "--proxy_host"); + } - if (s_cmdOptionExists(argv, argv + argc, "--proxy_port")) + if (s_cmdOptionExists(argv, argv + argc, "--proxy_port")) + { + int port = atoi(s_getCmdOption(argv, argv + argc, "--proxy_port")); + if (port > 0 && port <= UINT16_MAX) { - proxyPort = static_cast(atoi(s_getCmdOption(argv, argv + argc, "--proxy_port"))); + proxyPort = static_cast(port); } } @@ -265,6 +268,14 @@ int main(int argc, char *argv[]) exit(-1); } + Aws::Crt::Http::HttpClientConnectionProxyOptions proxyOptions; + if (!proxyHost.empty()) + { + proxyOptions.HostName = proxyHost; + proxyOptions.Port = proxyPort; + proxyOptions.AuthType = Aws::Crt::Http::AwsHttpProxyAuthenticationType::None; + } + Aws::Crt::Io::TlsContext x509TlsCtx; Aws::Iot::MqttClientConnectionConfigBuilder builder; @@ -275,15 +286,6 @@ int main(int argc, char *argv[]) else if (useWebSocket) { std::shared_ptr provider = nullptr; - - Aws::Crt::Http::HttpClientConnectionProxyOptions proxyOptions; - if (!proxyHost.empty()) - { - proxyOptions.HostName = proxyHost; - proxyOptions.Port = proxyPort; - proxyOptions.AuthType = Aws::Crt::Http::AwsHttpProxyAuthenticationType::None; - } - if (useX509) { Aws::Crt::Io::TlsContextOptions tlsCtxOptions = @@ -351,11 +353,6 @@ int main(int argc, char *argv[]) } Aws::Iot::WebsocketConfig config(signingRegion, provider); - if (!proxyHost.empty()) - { - config.ProxyOptions = proxyOptions; - } - builder = Aws::Iot::MqttClientConnectionConfigBuilder(config); } else @@ -363,6 +360,11 @@ int main(int argc, char *argv[]) s_printHelp(); } + if (!proxyHost.empty()) + { + builder.WithHttpProxyOptions(proxyOptions); + } + if (!caFile.empty()) { builder.WithCertificateAuthority(caFile.c_str()); diff --git a/samples/mqtt/raw_pub_sub/main.cpp b/samples/mqtt/raw_pub_sub/main.cpp index 0a39efabc..8337eeda3 100644 --- a/samples/mqtt/raw_pub_sub/main.cpp +++ b/samples/mqtt/raw_pub_sub/main.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -36,9 +37,8 @@ static void s_printHelp() " in your trust store, set this.\n"); fprintf(stdout, "\tIt's the path to a CA file in PEM format\n"); fprintf(stdout, "use_websocket: if specified, uses a websocket over https (optional)\n"); - fprintf(stdout, "proxy_host: if you want to use a proxy with websockets, specify the host here (optional).\n"); - fprintf( - stdout, "proxy_port: defaults to 8080 is proxy_host is set. Set this to any value you'd like (optional).\n"); + fprintf(stdout, "proxy_host: host name of the http proxy to use (optional).\n"); + fprintf(stdout, "proxy_port: port of the http proxy to use (optional).\n"); fprintf(stdout, "user_name: User name to send with mqtt connect.\n"); fprintf(stdout, "password: Password to send with mqtt connect.\n"); fprintf(stdout, "protocol_name: (optional) defaults to x-amzn-mqtt-ca.\n"); @@ -124,14 +124,19 @@ int main(int argc, char *argv[]) { protocolName = "http/1.1"; useWebSocket = true; - if (s_cmdOptionExists(argv, argv + argc, "--proxy_host")) - { - proxyHost = s_getCmdOption(argv, argv + argc, "--proxy_host"); - } + } - if (s_cmdOptionExists(argv, argv + argc, "--proxy_port")) + if (s_cmdOptionExists(argv, argv + argc, "--proxy_host")) + { + proxyHost = s_getCmdOption(argv, argv + argc, "--proxy_host"); + } + + if (s_cmdOptionExists(argv, argv + argc, "--proxy_port")) + { + int port = atoi(s_getCmdOption(argv, argv + argc, "--proxy_port")); + if (port > 0 && port <= UINT16_MAX) { - proxyPort = static_cast(atoi(s_getCmdOption(argv, argv + argc, "--proxy_port"))); + proxyPort = static_cast(port); } } @@ -274,7 +279,7 @@ int main(int argc, char *argv[]) Http::HttpClientConnectionProxyOptions proxyOptions; proxyOptions.HostName = proxyHost; proxyOptions.Port = proxyPort; - connection->SetWebsocketProxyOptions(proxyOptions); + connection->SetHttpProxyOptions(proxyOptions); } /* From 5bc679703d32675aa25ec12999bcf985520ad379 Mon Sep 17 00:00:00 2001 From: Greg Breen Date: Wed, 19 May 2021 22:26:00 +0800 Subject: [PATCH 05/17] Updated GCC minimum in README from 4.4 to 4.8 (#275) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a872e23b7..cdc9f4cc4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ to C++ by the [aws-crt-cpp](https://github.com/awslabs/aws-crt-cpp) package. * C++ 11 or higher * CMake 3.1+ -* Clang 3.9+ or GCC 4.4+ or MSVC 2015+ +* Clang 3.9+ or GCC 4.8+ or MSVC 2015+ ### Build from source From a0e4ee52d9080f3d98fb34a55405ffb26295f15f Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Fri, 28 May 2021 14:42:29 -0700 Subject: [PATCH 06/17] Pull in crt that fixed Windows SNI issue (#279) --- crt/aws-crt-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index 5ad76e084..ef01c60ce 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit 5ad76e0844658b3e6f8c6988d83289ca9b922266 +Subproject commit ef01c60ce97c926a6f9bb454ea61bb123fbe56de From b425c9595a0ca88f6ba909e81f9ea0553cd2295c Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Tue, 22 Jun 2021 13:31:23 -0700 Subject: [PATCH 07/17] Update aws-crt-cpp for bugfixes (#289) Update aws-crt-cpp for bugfixes: v0.13.8 -> v0.14.1 * BUGFIX: Fix build issue where aws-lc attempt to install during cmake configure stage. * BUGFIX: On Windows only, reverts the cached CRL check when validating a server certificate chain using a root CA override. * BUGFIX: On Apple only, fix Server Name Indicator (SNI) check when custom root-CA is used. --- crt/aws-crt-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index ef01c60ce..d0288ab99 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit ef01c60ce97c926a6f9bb454ea61bb123fbe56de +Subproject commit d0288ab9911308f7bf4d5e8ba31e770e8c94e9a9 From 163fdf3bff9cc2a51f5d0aeca3d9356f665583a3 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Tue, 22 Jun 2021 14:02:05 -0700 Subject: [PATCH 08/17] use ACTUAL tagged commit for aws-crt-cpp v0.14.1 (#290) --- crt/aws-crt-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index d0288ab99..5ae0bd8d5 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit d0288ab9911308f7bf4d5e8ba31e770e8c94e9a9 +Subproject commit 5ae0bd8d56a84da9c554a22bd57383fd10f85bcf From f10166027c6889cbcd294f796aaaca3397d174c4 Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Mon, 26 Apr 2021 00:29:15 -0700 Subject: [PATCH 09/17] Implement EventStream RPC & Greengrass IPC Client --- CMakeLists.txt | 2 + crt/aws-crt-cpp | 2 +- eventstream_rpc/CMakeLists.txt | 123 + .../cmake/eventstreamrpc-cpp-config.cmake | 9 + .../aws/eventstreamrpc/EventStreamClient.h | 678 ++ .../include/aws/eventstreamrpc/Exports.h | 20 + eventstream_rpc/source/EventStreamClient.cpp | 1549 ++++ eventstream_rpc/tests/CMakeLists.txt | 53 + .../tests/DefaultConnectionConfig.cpp | 16 + eventstream_rpc/tests/EchoTestRpcClient.cpp | 61 + eventstream_rpc/tests/EchoTestRpcModel.cpp | 1390 ++++ .../tests/EventStreamClientTest.cpp | 527 ++ .../tests/include/awstest/EchoTestRpcClient.h | 48 + .../tests/include/awstest/EchoTestRpcModel.h | 871 +++ .../tests/include/awstest/Exports.h | 20 + greengrass_ipc/CMakeLists.txt | 120 + .../cmake/greengrassipc-cpp-config.cmake | 9 + .../include/aws/greengrass/Exports.h | 20 + .../aws/greengrass/GreengrassCoreIpcClient.h | 73 + .../aws/greengrass/GreengrassCoreIpcModel.h | 3967 ++++++++++ .../source/DefaultConnectionConfig.cpp | 37 + .../source/GreengrassCoreIpcClient.cpp | 207 + .../source/GreengrassCoreIpcModel.cpp | 6626 +++++++++++++++++ 23 files changed, 16427 insertions(+), 1 deletion(-) create mode 100644 eventstream_rpc/CMakeLists.txt create mode 100644 eventstream_rpc/cmake/eventstreamrpc-cpp-config.cmake create mode 100644 eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h create mode 100644 eventstream_rpc/include/aws/eventstreamrpc/Exports.h create mode 100644 eventstream_rpc/source/EventStreamClient.cpp create mode 100644 eventstream_rpc/tests/CMakeLists.txt create mode 100644 eventstream_rpc/tests/DefaultConnectionConfig.cpp create mode 100644 eventstream_rpc/tests/EchoTestRpcClient.cpp create mode 100644 eventstream_rpc/tests/EchoTestRpcModel.cpp create mode 100644 eventstream_rpc/tests/EventStreamClientTest.cpp create mode 100644 eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h create mode 100644 eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h create mode 100644 eventstream_rpc/tests/include/awstest/Exports.h create mode 100644 greengrass_ipc/CMakeLists.txt create mode 100644 greengrass_ipc/cmake/greengrassipc-cpp-config.cmake create mode 100644 greengrass_ipc/include/aws/greengrass/Exports.h create mode 100644 greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h create mode 100644 greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h create mode 100644 greengrass_ipc/source/DefaultConnectionConfig.cpp create mode 100644 greengrass_ipc/source/GreengrassCoreIpcClient.cpp create mode 100644 greengrass_ipc/source/GreengrassCoreIpcModel.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ae9c4e25..ff2b3b7c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,8 @@ add_subdirectory(jobs) add_subdirectory(shadow) add_subdirectory(discovery) add_subdirectory(identity) +add_subdirectory(eventstream_rpc) +add_subdirectory(greengrass_ipc) if (NOT BYO_CRYPTO) # TODO: get these working with BYO_CRYPTO add_subdirectory(iotdevicecommon) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index 5ae0bd8d5..a40d8831b 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit 5ae0bd8d56a84da9c554a22bd57383fd10f85bcf +Subproject commit a40d8831be6bd4b411264ca52168a776b5c05b9b diff --git a/eventstream_rpc/CMakeLists.txt b/eventstream_rpc/CMakeLists.txt new file mode 100644 index 000000000..3b8d14939 --- /dev/null +++ b/eventstream_rpc/CMakeLists.txt @@ -0,0 +1,123 @@ +cmake_minimum_required(VERSION 3.1) +project(EventstreamRpc-cpp CXX) + +set(RUNTIME_DIRECTORY bin) + +if (UNIX AND NOT APPLE) + include(GNUInstallDirs) +elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + + if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") + set(FIND_LIBRARY_USE_LIB64_PATHS true) + endif() +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") + +if (NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() + +file(GLOB AWS_EVENTSTREAMRPC_HEADERS + "include/aws/eventstreamrpc/*.h" +) + +file(GLOB AWS_EVENTSTREAMRPC_SRC + "source/*.cpp" +) + +file(GLOB AWS_EVENTSTREAMRPC_CPP_SRC + ${AWS_EVENTSTREAMRPC_SRC} +) + +if (WIN32) + if (MSVC) + source_group("Header Files\\aws\\eventstreamrpc\\" FILES ${AWS_EVENTSTREAMRPC_HEADERS}) + + source_group("Source Files" FILES ${AWS_EVENTSTREAMRPC_SRC}) + endif () +endif() + +add_library(EventstreamRpc-cpp ${AWS_EVENTSTREAMRPC_CPP_SRC}) + +set_target_properties(EventstreamRpc-cpp PROPERTIES LINKER_LANGUAGE CXX) + +set(CMAKE_C_FLAGS_DEBUGOPT "") + +#set warnings +if (MSVC) + target_compile_options(EventstreamRpc-cpp PRIVATE /W4 /WX) +else () + target_compile_options(EventstreamRpc-cpp PRIVATE -Wall -Wno-long-long -pedantic -Werror) +endif () + +if (CMAKE_BUILD_TYPE STREQUAL "" OR CMAKE_BUILD_TYPE MATCHES Debug) + target_compile_definitions(EventstreamRpc-cpp PRIVATE "-DDEBUG_BUILD") +endif () + +if (BUILD_SHARED_LIBS) + target_compile_definitions(EventstreamRpc-cpp PUBLIC "-DAWS_EVENTSTREAMRPC_USE_IMPORT_EXPORT") + target_compile_definitions(EventstreamRpc-cpp PRIVATE "-DAWS_EVENTSTREAMRPC_EXPORTS") + + install(TARGETS EventstreamRpc-cpp + EXPORT EventstreamRpc-cpp-targets + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + NAMELINK_SKIP + COMPONENT Runtime + RUNTIME + DESTINATION ${RUNTIME_DIRECTORY} + COMPONENT Runtime) + + install(TARGETS EventstreamRpc-cpp + EXPORT EventstreamRpc-cpp-targets + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + NAMELINK_ONLY + COMPONENT Development) +else() + install(TARGETS EventstreamRpc-cpp + EXPORT EventstreamRpc-cpp-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development) +endif() + +target_include_directories(EventstreamRpc-cpp PUBLIC + $ + $) + +if (NOT IS_SUBDIRECTORY_INCLUDE) + aws_use_package(aws-crt-cpp) +endif() + + +target_link_libraries(EventstreamRpc-cpp ${DEP_AWS_LIBS}) + +install(FILES ${AWS_EVENTSTREAMRPC_HEADERS} DESTINATION "include/aws/eventstreamrpc/" COMPONENT Development) + +if (BUILD_SHARED_LIBS) + set(TARGET_DIR "shared") +else() + set(TARGET_DIR "static") +endif() + +install(EXPORT "EventstreamRpc-cpp-targets" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/EventstreamRpc-cpp/cmake/${TARGET_DIR}" + NAMESPACE AWS:: + COMPONENT Development) + +configure_file("cmake/eventstreamrpc-cpp-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/eventstreamrpc-cpp-config.cmake" + @ONLY) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/eventstreamrpc-cpp-config.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/EventstreamRpc-cpp/cmake/" + COMPONENT Development) + +if (BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/eventstream_rpc/cmake/eventstreamrpc-cpp-config.cmake b/eventstream_rpc/cmake/eventstreamrpc-cpp-config.cmake new file mode 100644 index 000000000..8e68cfbfe --- /dev/null +++ b/eventstream_rpc/cmake/eventstreamrpc-cpp-config.cmake @@ -0,0 +1,9 @@ +include(CMakeFindDependencyMacro) + +find_dependency(aws-crt-cpp) + +if (BUILD_SHARED_LIBS) + include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +else() + include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +endif() diff --git a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h new file mode 100644 index 000000000..2821fe97c --- /dev/null +++ b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h @@ -0,0 +1,678 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +namespace Aws +{ + namespace Crt + { + namespace Io + { + class ClientBootstrap; + } + } // namespace Crt + namespace Eventstreamrpc + { + class EventStreamHeader; + class MessageAmendment; + class ClientOperation; + class ClientConnection; + class ClientContinuation; + + using HeaderValueType = aws_event_stream_header_value_type; + using MessageType = aws_event_stream_rpc_message_type; + + /** + * A callback prototype that is called upon flushing a message over the wire. + * @param errorCode A non-zero value if an error occured while attempting to flush the message. + */ + using OnMessageFlushCallback = std::function; + + /** + * Allows the application to add headers and change the payload of the CONNECT + * packet sent out by the client. + * @return The `MessageAmendment` for the client to use during an attempt to connect. + */ + using ConnectMessageAmender = std::function; + + /** + * A wrapper around an `aws_event_stream_header_value_pair` object. + */ + class AWS_EVENTSTREAMRPC_API EventStreamHeader final + { + public: + EventStreamHeader(const EventStreamHeader &lhs) noexcept; + EventStreamHeader(EventStreamHeader &&rhs) noexcept; + EventStreamHeader &operator=(const EventStreamHeader &lhs) noexcept; + ~EventStreamHeader() noexcept; + EventStreamHeader( + const struct aws_event_stream_header_value_pair &header, + Crt::Allocator *allocator = Crt::g_allocator); + EventStreamHeader(const Crt::String &name, bool value); + EventStreamHeader(const Crt::String &name, int8_t value); + EventStreamHeader(const Crt::String &name, int16_t value); + EventStreamHeader(const Crt::String &name, int32_t value); + EventStreamHeader(const Crt::String &name, int64_t value); + EventStreamHeader(const Crt::String &name, Crt::DateTime &value); + EventStreamHeader( + const Crt::String &name, + const Crt::String &value, + Crt::Allocator *allocator = Crt::g_allocator) noexcept; + EventStreamHeader(const Crt::String &name, Crt::ByteBuf &value); + EventStreamHeader(const Crt::String &name, Crt::UUID value); + + HeaderValueType GetHeaderValueType(); + Crt::String GetHeaderName() const noexcept; + void SetHeaderName(const Crt::String &); + + bool GetValueAsBoolean(bool &); + bool GetValueAsByte(int8_t &); + bool GetValueAsShort(int16_t &); + bool GetValueAsInt(int32_t &); + bool GetValueAsLong(int64_t &); + bool GetValueAsTimestamp(Crt::DateTime &); + bool GetValueAsString(Crt::String &) const noexcept; + bool GetValueAsBytes(Crt::ByteBuf &); + bool GetValueAsUUID(Crt::UUID &); + + const struct aws_event_stream_header_value_pair *GetUnderlyingHandle() const; + + bool operator==(const EventStreamHeader &other) const noexcept; + + private: + Crt::Allocator *m_allocator; + Crt::ByteBuf m_valueByteBuf; + struct aws_event_stream_header_value_pair m_underlyingHandle; + }; + + /** + * A means to append headers or modify the payload of a message to be sent by the client. + * @note The exception specifiers for move, copy constructors & assignment operators are required since + * this class is usually wrapped with `Crt::Optional`. + */ + class AWS_EVENTSTREAMRPC_API MessageAmendment final + { + public: + MessageAmendment(const MessageAmendment &lhs); + MessageAmendment(MessageAmendment &&rhs); + MessageAmendment &operator=(const MessageAmendment &lhs); + ~MessageAmendment() noexcept; + explicit MessageAmendment(Crt::Allocator *allocator = Crt::g_allocator) noexcept; + MessageAmendment( + const Crt::List &headers, + Crt::Optional &payload, + Crt::Allocator *allocator) noexcept; + MessageAmendment( + const Crt::List &headers, + Crt::Allocator *allocator = Crt::g_allocator) noexcept; + MessageAmendment( + Crt::List &&headers, + Crt::Allocator *allocator = Crt::g_allocator) noexcept; + MessageAmendment(const Crt::ByteBuf &payload, Crt::Allocator *allocator = Crt::g_allocator) noexcept; + void AddHeader(EventStreamHeader &&header) noexcept; + void SetPayload(const Crt::Optional &payload) noexcept; + Crt::List &GetHeaders() noexcept; + const Crt::Optional &GetPayload() const noexcept; + + private: + Crt::List m_headers; + Crt::Optional m_payload; + Crt::Allocator *m_allocator; + }; + + /** + * Configuration structure holding all configurations relating to eventstream RPC connection establishment + */ + class ConnectionConfig + { + public: + ConnectionConfig() noexcept : m_clientBootstrap(nullptr), m_connectRequestCallback(nullptr) {} + Crt::Optional GetHostName() const noexcept { return m_hostName; } + Crt::Optional GetPort() const noexcept { return m_port; } + Crt::Optional GetSocketOptions() const noexcept { return m_socketOptions; } + Crt::Optional GetConnectAmendment() const noexcept { return m_connectAmendment; } + Crt::Optional GetTlsConnectionOptions() const noexcept + { + return m_tlsConnectionOptions; + } + Crt::Io::ClientBootstrap *GetClientBootstrap() const noexcept { return m_clientBootstrap; } + OnMessageFlushCallback GetConnectRequestCallback() const noexcept { return m_connectRequestCallback; } + ConnectMessageAmender GetConnectMessageAmender() const noexcept + { + return [&](void) -> const MessageAmendment & { return m_connectAmendment; }; + } + + void SetHostName(Crt::String hostName) noexcept { m_hostName = hostName; } + void SetPort(uint16_t port) noexcept { m_port = port; } + void SetSocketOptions(const Crt::Io::SocketOptions &socketOptions) noexcept + { + m_socketOptions = socketOptions; + } + void SetConnectAmendment(const MessageAmendment &connectAmendment) noexcept + { + m_connectAmendment = connectAmendment; + } + void SetTlsConnectionOptions(Crt::Io::TlsConnectionOptions tlsConnectionOptions) noexcept + { + m_tlsConnectionOptions = tlsConnectionOptions; + } + void SetClientBootstrap(Crt::Io::ClientBootstrap *clientBootstrap) noexcept + { + m_clientBootstrap = clientBootstrap; + } + void SetConnectRequestCallback(OnMessageFlushCallback connectRequestCallback) noexcept + { + m_connectRequestCallback = connectRequestCallback; + } + + protected: + Crt::Optional m_hostName; + Crt::Optional m_port; + Crt::Optional m_socketOptions; + Crt::Optional m_tlsConnectionOptions; + Crt::Io::ClientBootstrap *m_clientBootstrap; + MessageAmendment m_connectAmendment; + OnMessageFlushCallback m_connectRequestCallback; + }; + + class AWS_EVENTSTREAMRPC_API ConnectionLifecycleHandler + { + public: + /** + * This callback is only invoked upon receiving a CONNECT_ACK with the + * CONNECTION_ACCEPTED flag set by the server. Therefore, once this callback + * is invoked, the `ClientConnection` is ready to be used for sending messages. + */ + virtual void OnConnectCallback(); + /** + * Invoked upon connection shutdown. `errorCode` will specify + * shutdown reason. A graceful connection close will set `errorCode` to + * `AWS_ERROR_SUCCESS` or 0. + */ + virtual void OnDisconnectCallback(int errorCode); + /** + * Invoked upon receiving an error. Use the return value to determine + * whether or not to force the connection to close. Keep in mind that once + * closed, the `ClientConnection` can no longer send messages. + */ + virtual bool OnErrorCallback(int errorCode); + /** + * Invoked upon receiving a ping from the server. The `headers` and `payload` + * refer to what is contained in the ping message. + */ + virtual void OnPingCallback( + const Crt::List &headers, + const Crt::Optional &payload); + }; + + /* User data passed to callbacks for a new stream. */ + class ContinuationCallbackData + { + public: + ContinuationCallbackData( + ClientContinuation *clientContinuation, + Crt::Allocator *allocator = Crt::g_allocator) noexcept + : clientContinuation(clientContinuation), allocator(allocator) + { + continuationDestroyed = false; + } + ContinuationCallbackData(const ContinuationCallbackData &lhs) noexcept = delete; + bool continuationDestroyed; + std::mutex callbackMutex; + ClientContinuation *clientContinuation; + Crt::Allocator *allocator; + }; + + class AWS_EVENTSTREAMRPC_API ClientContinuationHandler + { + public: + /** + * Invoked when a message is received on this continuation. + */ + virtual void OnContinuationMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags) = 0; + /** + * Invoked when the continuation is closed. + * + * Once the continuation is closed, no more messages may be sent or received. + * The continuation is closed when a message is sent or received with + * the TERMINATE_STREAM flag, or when the connection shuts down. + */ + virtual void OnContinuationClosed() = 0; + ~ClientContinuationHandler() noexcept; + + private: + friend class ClientContinuation; + ContinuationCallbackData *m_callbackData; + }; + + enum EventStreamRpcStatusCode + { + EVENT_STREAM_RPC_SUCCESS = 0, + EVENT_STREAM_RPC_NULL_PARAMETER, + EVENT_STREAM_RPC_UNINITIALIZED, + EVENT_STREAM_RPC_ALLOCATION_ERROR, + EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED, + EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED, + EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED, + EVENT_STREAM_RPC_CONNECTION_CLOSED, + EVENT_STREAM_RPC_CONTINUATION_CLOSED, + EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE, + EVENT_STREAM_RPC_UNMAPPED_DATA, + EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE, + EVENT_STREAM_RPC_CRT_ERROR + }; + + struct RpcError + { + EventStreamRpcStatusCode baseStatus; + int crtError; + operator bool() const noexcept { return baseStatus == EVENT_STREAM_RPC_SUCCESS; } + Crt::String ErrorToString(); + }; + + class AWS_EVENTSTREAMRPC_API ClientContinuation final + { + public: + ClientContinuation( + ClientConnection *connection, + ClientContinuationHandler &continuationHandler, + Crt::Allocator *allocator) noexcept; + ~ClientContinuation() noexcept; + std::future Activate( + const Crt::String &operation, + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + bool IsClosed() noexcept; + void Release() noexcept; + std::future SendMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + + private: + friend class ClientOperation; + Crt::Allocator *m_allocator; + ClientContinuationHandler &m_continuationHandler; + struct aws_event_stream_rpc_client_continuation_token *m_continuationToken; + static void s_onContinuationMessage( + struct aws_event_stream_rpc_client_continuation_token *continuationToken, + const struct aws_event_stream_rpc_message_args *messageArgs, + void *userData) noexcept; + static void s_onContinuationClosed( + struct aws_event_stream_rpc_client_continuation_token *continuationToken, + void *userData) noexcept; + }; + + class AWS_EVENTSTREAMRPC_API AbstractShapeBase + { + public: + AbstractShapeBase() noexcept; + virtual ~AbstractShapeBase() noexcept; + static void s_customDeleter(AbstractShapeBase *shape) noexcept; + virtual void SerializeToJsonObject(Crt::JsonObject &payloadObject) const = 0; + virtual Crt::String GetModelName() const noexcept = 0; + + protected: + Crt::Allocator *m_allocator; + }; + + class AWS_EVENTSTREAMRPC_API OperationError : public AbstractShapeBase + { + public: + explicit OperationError() noexcept; + static void s_customDeleter(OperationError *shape) noexcept; + virtual void SerializeToJsonObject(Crt::JsonObject &payloadObject) const override; + virtual Crt::Optional GetMessage() noexcept = 0; + }; + + /** + * Base class for all operation stream handlers. + * For operations with a streaming response (0+ messages that may arrive + * after the initial response). + */ + class AWS_EVENTSTREAMRPC_API StreamResponseHandler + { + public: + /** + * Invoked when stream is closed, so no more messages will be received. + */ + virtual void OnStreamClosed(); + + protected: + friend class ClientOperation; + /** + * Invoked when a message is received on this continuation. + */ + virtual void OnStreamEvent(Crt::ScopedResource response); + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + virtual bool OnStreamError(Crt::ScopedResource operationError, RpcError rpcError); + }; + + enum AWS_EVENTSTREAMRPC_API ResultType + { + OPERATION_RESPONSE, + OPERATION_ERROR, + RPC_ERROR + }; + + class AWS_EVENTSTREAMRPC_API TaggedResult + { + public: + TaggedResult() noexcept; + explicit TaggedResult(Crt::ScopedResource response) noexcept; + explicit TaggedResult(Crt::ScopedResource error) noexcept; + explicit TaggedResult(RpcError rpcError) noexcept; + TaggedResult(TaggedResult &&rhs) noexcept; + TaggedResult &operator=(TaggedResult &&rhs) noexcept; + ~TaggedResult() noexcept; + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept; + + AbstractShapeBase *GetOperationResponse() const noexcept; + OperationError *GetOperationError() const noexcept; + RpcError GetRpcError() const noexcept; + ResultType GetResultType() const noexcept { return m_responseType; } + + private: + union AWS_EVENTSTREAMRPC_API OperationResult { + OperationResult(Crt::ScopedResource &&response) noexcept + : m_response(std::move(response)) + { + } + OperationResult(Crt::ScopedResource &&error) noexcept : m_error(std::move(error)) {} + OperationResult() noexcept : m_response(nullptr) {} + ~OperationResult() noexcept {}; + Crt::ScopedResource m_response; + Crt::ScopedResource m_error; + }; + ResultType m_responseType; + OperationResult m_operationResult; + RpcError m_rpcError; + }; + + using ExpectedResponseFactory = std::function< + Crt::ScopedResource(const Crt::StringView &payload, Crt::Allocator *allocator)>; + using ErrorResponseFactory = std::function< + Crt::ScopedResource(const Crt::StringView &payload, Crt::Allocator *allocator)>; + + using LoneResponseRetriever = std::function; + using StreamingResponseRetriever = std::function; + using ErrorResponseRetriever = std::function; + + class AWS_EVENTSTREAMRPC_API ResponseRetriever + { + /* An interface shared by all operations for retrieving the response object given the model name. */ + public: + virtual ExpectedResponseFactory GetInitialResponseFromModelName(const Crt::String &modelName) const + noexcept = 0; + virtual ExpectedResponseFactory GetStreamingResponseFromModelName(const Crt::String &modelName) const + noexcept = 0; + virtual ErrorResponseFactory GetOperationErrorFromModelName(const Crt::String &modelName) const + noexcept = 0; + }; + + class AWS_EVENTSTREAMRPC_API ServiceModel + { + public: + virtual Crt::ScopedResource AllocateOperationErrorFromPayload( + const Crt::String &errorModelName, + Crt::StringView stringView, + Crt::Allocator *allocator) const noexcept = 0; + }; + + class AWS_EVENTSTREAMRPC_API OperationModelContext + { + public: + OperationModelContext(const ServiceModel &serviceModel) noexcept; + virtual Crt::ScopedResource AllocateInitialResponseFromPayload( + Crt::StringView stringView, + Crt::Allocator *allocator) const noexcept = 0; + virtual Crt::ScopedResource AllocateStreamingResponseFromPayload( + Crt::StringView stringView, + Crt::Allocator *allocator) const noexcept = 0; + virtual Crt::String GetInitialResponseModelName() const noexcept = 0; + virtual Crt::String GetRequestModelName() const noexcept = 0; + virtual Crt::Optional GetStreamingResponseModelName() const noexcept = 0; + virtual Crt::String GetOperationName() const noexcept = 0; + Crt::ScopedResource AllocateOperationErrorFromPayload( + const Crt::String &errorModelName, + Crt::StringView stringView, + Crt::Allocator *allocator) const noexcept + { + return m_serviceModel.AllocateOperationErrorFromPayload(errorModelName, stringView, allocator); + } + + private: + const ServiceModel &m_serviceModel; + }; + + class AWS_EVENTSTREAMRPC_API ClientOperation : private ClientContinuationHandler + { + public: + ClientOperation( + ClientConnection &connection, + StreamResponseHandler *streamHandler, + const OperationModelContext &operationModelContext, + Crt::Allocator *allocator) noexcept; + ~ClientOperation() noexcept; + ClientOperation(const ClientOperation &clientOperation) noexcept = delete; + ClientOperation(ClientOperation &&clientOperation) noexcept; + std::future Close(OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + std::future GetOperationResult() noexcept; + + protected: + std::future Activate( + const AbstractShapeBase *shape, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future SendStreamEvent( + AbstractShapeBase *shape, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + virtual Crt::String GetModelName() const noexcept = 0; + const OperationModelContext &m_operationModelContext; + + private: + EventStreamRpcStatusCode HandleData(const Crt::Optional &payload); + EventStreamRpcStatusCode HandleError( + const Crt::String &modelName, + const Crt::Optional &payload, + uint32_t messageFlags); + /** + * Invoked when a message is received on this continuation. + */ + void OnContinuationMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags) override; + /** + * Invoked when the continuation is closed. + * + * Once the continuation is closed, no more messages may be sent or received. + * The continuation is closed when a message is sent or received with + * the TERMINATE_STREAM flag, or when the connection shuts down. + */ + void OnContinuationClosed() override; + + const EventStreamHeader *GetHeaderByName( + const Crt::List &headers, + const Crt::String &name) noexcept; + + enum CloseState + { + WONT_CLOSE = 0, + WILL_CLOSE, + ALREADY_CLOSED + }; + + uint32_t m_messageCount; + Crt::Allocator *m_allocator; + StreamResponseHandler *m_streamHandler; + ClientContinuation m_clientContinuation; + /* This mutex protects m_resultReceived & m_closeState. */ + std::mutex m_continuationMutex; + bool m_resultReceived; + std::promise m_initialResponsePromise; + CloseState m_closeState; + std::atomic_int m_numCloses; + std::atomic_bool m_streamClosedCalled; + std::promise m_closedPromise; + std::condition_variable m_promiseReady; + }; + + class AWS_EVENTSTREAMRPC_API ClientConnection final + { + public: + ClientConnection(Crt::Allocator *allocator = Crt::g_allocator) noexcept; + ~ClientConnection() noexcept; + ClientConnection(const ClientConnection &) noexcept = delete; + ClientConnection &operator=(const ClientConnection &) noexcept = delete; + ClientConnection(ClientConnection &&) noexcept; + ClientConnection &operator=(ClientConnection &&) noexcept; + + std::future Connect( + const ConnectionConfig &connectionOptions, + ConnectionLifecycleHandler *connectionLifecycleHandler, + Crt::Io::ClientBootstrap &clientBootstrap) noexcept; + + std::future SendPing( + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + + std::future SendPingResponse( + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + + ClientContinuation NewStream(ClientContinuationHandler &clientContinuationHandler) noexcept; + + void Close() noexcept; + + bool IsOpen() const noexcept + { + if (this->m_underlyingConnection == nullptr) + { + return false; + } + else + { + return aws_event_stream_rpc_client_connection_is_open(this->m_underlyingConnection); + } + } + + /** + * @return true if the instance is in a valid state, false otherwise. + */ + operator bool() const noexcept { return IsOpen(); } + + private: + friend class ClientContinuation; + friend std::future ClientOperation::Close(OnMessageFlushCallback onMessageFlushCallback) noexcept; + enum ClientState + { + DISCONNECTED = 1, + CONNECTING_SOCKET, + WAITING_FOR_CONNECT_ACK, + CONNECTED, + DISCONNECTING, + }; + std::mutex m_continuationVectorMutex; + Crt::Vector m_continuationCallbackVector; + /* This recursive mutex protects m_clientState & m_connectionWillSetup */ + std::recursive_mutex m_stateMutex; + Crt::Allocator *m_allocator; + struct aws_event_stream_rpc_client_connection *m_underlyingConnection; + ClientState m_clientState; + ConnectionLifecycleHandler *m_lifecycleHandler; + ConnectMessageAmender m_connectMessageAmender; + std::promise m_connectionSetupPromise; + bool m_connectionWillSetup; + std::promise m_connectAckedPromise; + std::promise m_closedPromise; + bool m_onConnectCalled; + RpcError m_closeReason; + OnMessageFlushCallback m_onConnectRequestCallback; + Crt::Io::SocketOptions m_socketOptions; + ConnectionConfig m_connectionConfig; + std::future SendProtocolMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + + static void s_onConnectionShutdown( + struct aws_event_stream_rpc_client_connection *connection, + int errorCode, + void *userData) noexcept; + static void s_onConnectionSetup( + struct aws_event_stream_rpc_client_connection *connection, + int errorCode, + void *userData) noexcept; + static void s_onProtocolMessage( + struct aws_event_stream_rpc_client_connection *connection, + const struct aws_event_stream_rpc_message_args *messageArgs, + void *userData) noexcept; + + static void s_protocolMessageCallback(int errorCode, void *userData) noexcept; + static std::future s_sendProtocolMessage( + ClientConnection *connection, + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + + static std::future s_sendPing( + ClientConnection *connection, + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + + static std::future s_sendPingResponse( + ClientConnection *connection, + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + }; + } // namespace Eventstreamrpc +} // namespace Aws diff --git a/eventstream_rpc/include/aws/eventstreamrpc/Exports.h b/eventstream_rpc/include/aws/eventstreamrpc/Exports.h new file mode 100644 index 000000000..feb6f30b2 --- /dev/null +++ b/eventstream_rpc/include/aws/eventstreamrpc/Exports.h @@ -0,0 +1,20 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#if defined(AWS_EVENTSTREAMRPC_USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) +# ifdef AWS_EVENTSTREAMRPC_USE_IMPORT_EXPORT +# ifdef AWS_EVENTSTREAMRPC_EXPORTS +# define AWS_EVENTSTREAMRPC_API __declspec(dllexport) +# else +# define AWS_EVENTSTREAMRPC_API __declspec(dllimport) +# endif /* AWS_EVENTSTREAMRPC_EXPORTS */ +# else +# define AWS_EVENTSTREAMRPC_API +# endif /* AWS_EVENTSTREAMRPC_USE_IMPORT_EXPORT */ + +#else /* defined (AWS_EVENTSTREAMRPC_USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ +# define AWS_EVENTSTREAMRPC_API +#endif /* defined (AWS_EVENTSTREAMRPC__USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp new file mode 100644 index 000000000..9d0b33d8f --- /dev/null +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -0,0 +1,1549 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include +#include +#include + +#include +#include + +#include +#include + +constexpr auto EVENTSTREAM_VERSION_HEADER = ":version"; +constexpr auto EVENTSTREAM_VERSION_STRING = "0.1.0"; +constexpr auto CONTENT_TYPE_HEADER = ":content-type"; +constexpr auto CONTENT_TYPE_APPLICATION_JSON = "application/json"; +constexpr auto SERVICE_MODEL_TYPE_HEADER = "service-model-type"; + +namespace Aws +{ + namespace Eventstreamrpc + { + /* Because `std::function` cannot be typecasted to void *, we must contain it in a struct. */ + struct OnMessageFlushCallbackContainer + { + explicit OnMessageFlushCallbackContainer(Crt::Allocator *allocator) : allocator(allocator) {} + Crt::Allocator *allocator; + OnMessageFlushCallback onMessageFlushCallback; + std::promise onFlushPromise; + }; + + MessageAmendment::MessageAmendment(Crt::Allocator *allocator) noexcept + : m_headers(), m_payload(), m_allocator(allocator) + { + } + + MessageAmendment::MessageAmendment(const Crt::ByteBuf &payload, Crt::Allocator *allocator) noexcept + : m_headers(), m_payload(Crt::ByteBufNewCopy(allocator, payload.buffer, payload.len)), + m_allocator(allocator) + { + } + + MessageAmendment::MessageAmendment( + const Crt::List &headers, + Crt::Allocator *allocator) noexcept + : m_headers(headers), m_payload(), m_allocator(allocator) + { + } + + MessageAmendment::MessageAmendment(Crt::List &&headers, Crt::Allocator *allocator) noexcept + : m_headers(headers), m_payload(), m_allocator(allocator) + { + } + + MessageAmendment::MessageAmendment( + const Crt::List &headers, + Crt::Optional &payload, + Crt::Allocator *allocator) noexcept + : m_headers(headers), m_payload(), m_allocator(allocator) + { + if (payload.has_value()) + { + m_payload = Crt::ByteBufNewCopy(allocator, payload.value().buffer, payload.value().len); + } + } + + MessageAmendment::MessageAmendment(const MessageAmendment &lhs) + : m_headers(lhs.m_headers), m_payload(), m_allocator(lhs.m_allocator) + { + if (lhs.m_payload.has_value()) + { + m_payload = + Crt::ByteBufNewCopy(lhs.m_allocator, lhs.m_payload.value().buffer, lhs.m_payload.value().len); + } + } + + MessageAmendment &MessageAmendment::operator=(const MessageAmendment &lhs) + { + m_headers = lhs.m_headers; + if (lhs.m_payload.has_value()) + { + m_payload = + Crt::ByteBufNewCopy(lhs.m_allocator, lhs.m_payload.value().buffer, lhs.m_payload.value().len); + } + m_allocator = lhs.m_allocator; + + return *this; + } + + MessageAmendment::MessageAmendment(MessageAmendment &&rhs) + : m_headers(std::move(rhs.m_headers)), m_payload(rhs.m_payload), m_allocator(rhs.m_allocator) + { + rhs.m_allocator = nullptr; + rhs.m_payload = Crt::Optional(); + } + + Crt::List &MessageAmendment::GetHeaders() noexcept { return m_headers; } + + const Crt::Optional &MessageAmendment::GetPayload() const noexcept { return m_payload; } + + void MessageAmendment::SetPayload(const Crt::Optional &payload) noexcept + { + if (payload.has_value()) + { + m_payload = Crt::ByteBufNewCopy(m_allocator, payload.value().buffer, payload.value().len); + } + } + + MessageAmendment::~MessageAmendment() noexcept + { + if (m_payload.has_value()) + { + Crt::ByteBufDelete(m_payload.value()); + } + } + + class EventStreamCppToNativeCrtBuilder + { + private: + friend class ClientConnection; + friend class ClientContinuation; + static int s_fillNativeHeadersArray( + const Crt::List &headers, + struct aws_array_list *headersArray, + Crt::Allocator *m_allocator = Crt::g_allocator) + { + AWS_ZERO_STRUCT(*headersArray); + /* Check if the connection has expired before attempting to send. */ + int errorCode = aws_event_stream_headers_list_init(headersArray, m_allocator); + + if (!errorCode) + { + /* Populate the array with the underlying handle of each EventStreamHeader. */ + for (auto &i : headers) + { + errorCode = aws_array_list_push_back(headersArray, i.GetUnderlyingHandle()); + + if (errorCode) + { + break; + } + } + } + + return errorCode; + } + }; + + ClientConnection &ClientConnection::operator=(ClientConnection &&rhs) noexcept + { + m_allocator = std::move(rhs.m_allocator); + m_underlyingConnection = rhs.m_underlyingConnection; + rhs.m_stateMutex.lock(); + m_clientState = rhs.m_clientState; + rhs.m_stateMutex.unlock(); + m_lifecycleHandler = rhs.m_lifecycleHandler; + m_connectMessageAmender = rhs.m_connectMessageAmender; + m_connectAckedPromise = std::move(rhs.m_connectAckedPromise); + m_closedPromise = std::move(rhs.m_closedPromise); + m_onConnectRequestCallback = rhs.m_onConnectRequestCallback; + + /* Reset rhs. */ + rhs.m_allocator = nullptr; + rhs.m_underlyingConnection = nullptr; + rhs.m_clientState = DISCONNECTED; + rhs.m_lifecycleHandler = nullptr; + rhs.m_connectMessageAmender = nullptr; + rhs.m_closedPromise = {}; + rhs.m_onConnectRequestCallback = nullptr; + + return *this; + } + + ClientConnection::ClientConnection(ClientConnection &&rhs) noexcept : m_lifecycleHandler(rhs.m_lifecycleHandler) + { + *this = std::move(rhs); + } + + ClientConnection::ClientConnection(Crt::Allocator *allocator) noexcept + : m_allocator(allocator), m_underlyingConnection(nullptr), m_clientState(DISCONNECTED), + m_lifecycleHandler(nullptr), m_connectMessageAmender(nullptr), m_connectionWillSetup(false), + m_onConnectRequestCallback(nullptr) + { + } + + ClientConnection::~ClientConnection() noexcept + { + m_stateMutex.lock(); + if (m_connectionWillSetup) + { + m_stateMutex.unlock(); + m_connectionSetupPromise.get_future().wait(); + } + m_stateMutex.lock(); + if (m_clientState != DISCONNECTED) + { + Close(); + m_stateMutex.unlock(); + m_closedPromise.get_future().wait(); + } + /* Cover the case in which the if statements are not hit. */ + m_stateMutex.unlock(); + m_stateMutex.unlock(); + + m_underlyingConnection = nullptr; + + for (auto *i : m_continuationCallbackVector) + { + Crt::Delete(i, m_allocator); + } + } + + bool ConnectionLifecycleHandler::OnErrorCallback(int errorCode) + { + (void)errorCode; + /* Returning true implies that the connection will close upon receiving an error. */ + return true; + } + + void ConnectionLifecycleHandler::OnPingCallback( + const Crt::List &headers, + const Crt::Optional &payload) + { + (void)headers; + (void)payload; + } + + void ConnectionLifecycleHandler::OnConnectCallback() {} + + void ConnectionLifecycleHandler::OnDisconnectCallback(int errorCode) { (void)errorCode; } + + std::future ClientConnection::Connect( + const ConnectionConfig &connectionConfig, + ConnectionLifecycleHandler *connectionLifecycleHandler, + Crt::Io::ClientBootstrap &clientBootstrap) noexcept + { + EventStreamRpcStatusCode baseError = EVENT_STREAM_RPC_SUCCESS; + struct aws_event_stream_rpc_client_connection_options connOptions; + + { + const std::lock_guard lock(m_stateMutex); + if (m_clientState == DISCONNECTED) + { + m_clientState = CONNECTING_SOCKET; + m_onConnectCalled = false; + m_connectionSetupPromise = {}; + m_connectAckedPromise = {}; + m_closedPromise = {}; + m_closeReason = {EVENT_STREAM_RPC_UNINITIALIZED, 0}; + m_connectionConfig = connectionConfig; + m_lifecycleHandler = connectionLifecycleHandler; + } + else + { + baseError = EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED; + } + } + + m_onConnectRequestCallback = m_connectionConfig.GetConnectRequestCallback(); + + if (baseError == EVENT_STREAM_RPC_SUCCESS) + { + AWS_ZERO_STRUCT(connOptions); + Crt::String hostName; + if (m_connectionConfig.GetHostName().has_value()) + { + hostName = m_connectionConfig.GetHostName().value(); + connOptions.host_name = hostName.c_str(); + } + else + { + baseError = EVENT_STREAM_RPC_NULL_PARAMETER; + } + if (m_connectionConfig.GetPort().has_value()) + { + connOptions.port = m_connectionConfig.GetPort().value(); + } + else + { + baseError = EVENT_STREAM_RPC_NULL_PARAMETER; + } + + connOptions.bootstrap = clientBootstrap.GetUnderlyingHandle(); + } + + if (baseError) + { + std::promise errorPromise; + errorPromise.set_value({baseError, 0}); + return errorPromise.get_future(); + } + + if (m_connectionConfig.GetSocketOptions().has_value()) + { + m_socketOptions = m_connectionConfig.GetSocketOptions().value(); + } + connOptions.socket_options = &m_socketOptions.GetImpl(); + + connOptions.on_connection_setup = ClientConnection::s_onConnectionSetup; + connOptions.on_connection_protocol_message = ClientConnection::s_onProtocolMessage; + connOptions.on_connection_shutdown = ClientConnection::s_onConnectionShutdown; + connOptions.user_data = reinterpret_cast(this); + + m_lifecycleHandler = connectionLifecycleHandler; + m_connectMessageAmender = m_connectionConfig.GetConnectMessageAmender(); + + if (m_connectionConfig.GetTlsConnectionOptions().has_value()) + { + connOptions.tls_options = m_connectionConfig.GetTlsConnectionOptions()->GetUnderlyingHandle(); + } + + int crtError = aws_event_stream_rpc_client_connection_connect(m_allocator, &connOptions); + + if (crtError) + { + std::promise errorPromise; + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while attempting to establish the connection: %s", + aws_error_debug_str(crtError)); + errorPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, crtError}); + return errorPromise.get_future(); + } + else + { + const std::lock_guard lock(m_stateMutex); + m_connectionWillSetup = true; + } + + return m_connectAckedPromise.get_future(); + } + + std::future ClientConnection::SendPing( + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return s_sendPing(this, headers, payload, onMessageFlushCallback); + } + + std::future ClientConnection::SendPingResponse( + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return s_sendPingResponse(this, headers, payload, onMessageFlushCallback); + } + + std::future ClientConnection::s_sendPing( + ClientConnection *connection, + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return s_sendProtocolMessage( + connection, headers, payload, AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PING, 0, onMessageFlushCallback); + } + + std::future ClientConnection::s_sendPingResponse( + ClientConnection *connection, + const Crt::List &headers, + const Crt::Optional &payload, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return s_sendProtocolMessage( + connection, + headers, + payload, + AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PING_RESPONSE, + 0, + onMessageFlushCallback); + } + + std::future ClientConnection::SendProtocolMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return s_sendProtocolMessage(this, headers, payload, messageType, messageFlags, onMessageFlushCallback); + } + + void ClientConnection::s_protocolMessageCallback(int errorCode, void *userData) noexcept + { + auto *callbackData = static_cast(userData); + + if (errorCode) + { + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while attempting to send a message: %s", + aws_error_debug_str(errorCode)); + callbackData->onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + } + else + { + callbackData->onFlushPromise.set_value({EVENT_STREAM_RPC_SUCCESS, 0}); + } + + /* Call the user-provided callback. */ + if (callbackData->onMessageFlushCallback) + { + callbackData->onMessageFlushCallback(errorCode); + } + + Crt::Delete(callbackData, callbackData->allocator); + } + + std::future ClientConnection::s_sendProtocolMessage( + ClientConnection *connection, + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + std::promise onFlushPromise; + OnMessageFlushCallbackContainer *callbackContainer = nullptr; + struct aws_array_list headersArray; + + /* The caller should never pass a NULL connection. */ + AWS_PRECONDITION(connection != nullptr); + + int errorCode = EventStreamCppToNativeCrtBuilder::s_fillNativeHeadersArray( + headers, &headersArray, connection->m_allocator); + + if (!errorCode) + { + struct aws_event_stream_rpc_message_args msg_args; + msg_args.headers = (struct aws_event_stream_header_value_pair *)headersArray.data; + msg_args.headers_count = headers.size(); + msg_args.payload = payload.has_value() ? (aws_byte_buf *)(&(payload.value())) : nullptr; + msg_args.message_type = messageType; + msg_args.message_flags = messageFlags; + + /* This heap allocation is necessary so that the flush callback can still be invoked when this function + * returns. */ + callbackContainer = + Crt::New(connection->m_allocator, connection->m_allocator); + callbackContainer->onMessageFlushCallback = onMessageFlushCallback; + callbackContainer->onFlushPromise = std::move(onFlushPromise); + + errorCode = aws_event_stream_rpc_client_connection_send_protocol_message( + connection->m_underlyingConnection, + &msg_args, + ClientConnection::s_protocolMessageCallback, + reinterpret_cast(callbackContainer)); + } + + /* Cleanup. */ + if (aws_array_list_is_valid(&headersArray)) + { + aws_array_list_clean_up(&headersArray); + } + + if (errorCode) + { + onFlushPromise = std::move(callbackContainer->onFlushPromise); + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while queueing a message to be sent on the connection: %s", + aws_error_debug_str(errorCode)); + onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + Crt::Delete(callbackContainer, connection->m_allocator); + } + else + { + return callbackContainer->onFlushPromise.get_future(); + } + + return onFlushPromise.get_future(); + } + + void ClientConnection::Close() noexcept + { + const std::lock_guard lock(m_stateMutex); + + if (IsOpen()) + { + aws_event_stream_rpc_client_connection_close(this->m_underlyingConnection, AWS_OP_SUCCESS); + } + else if (m_clientState == CONNECTING_SOCKET && !m_connectionWillSetup) + { + m_connectAckedPromise.set_value({EVENT_STREAM_RPC_CONNECTION_CLOSED, 0}); + } + + if (m_clientState != DISCONNECTING && m_clientState != DISCONNECTED) + { + m_clientState = DISCONNECTING; + } + + if (m_closeReason.baseStatus == EVENT_STREAM_RPC_UNINITIALIZED) + { + m_closeReason = {EVENT_STREAM_RPC_CONNECTION_CLOSED, 0}; + } + } + + EventStreamHeader::EventStreamHeader( + const struct aws_event_stream_header_value_pair &header, + Crt::Allocator *allocator) + : m_allocator(allocator), m_valueByteBuf({}), m_underlyingHandle(header) + { + } + + EventStreamHeader::EventStreamHeader( + const Crt::String &name, + const Crt::String &value, + Crt::Allocator *allocator) noexcept + : m_allocator(allocator), + m_valueByteBuf(Crt::ByteBufNewCopy(allocator, (uint8_t *)value.c_str(), value.length())) + { + m_underlyingHandle.header_name_len = static_cast(name.length()); + size_t length; + if (name.length() > INT8_MAX) + { + length = INT8_MAX; + } + else + { + length = static_cast(name.length()); + } + (void)memcpy(m_underlyingHandle.header_name, name.c_str(), length); + m_underlyingHandle.header_value_type = AWS_EVENT_STREAM_HEADER_STRING; + m_underlyingHandle.header_value.variable_len_val = m_valueByteBuf.buffer; + m_underlyingHandle.header_value_len = (uint16_t)m_valueByteBuf.len; + } + + EventStreamHeader::~EventStreamHeader() noexcept + { + if (aws_byte_buf_is_valid(&m_valueByteBuf)) + Crt::ByteBufDelete(m_valueByteBuf); + } + + EventStreamHeader::EventStreamHeader(const EventStreamHeader &lhs) noexcept + : m_allocator(lhs.m_allocator), + m_valueByteBuf(Crt::ByteBufNewCopy(lhs.m_allocator, lhs.m_valueByteBuf.buffer, lhs.m_valueByteBuf.len)), + m_underlyingHandle(lhs.m_underlyingHandle) + { + m_underlyingHandle.header_value.variable_len_val = m_valueByteBuf.buffer; + m_underlyingHandle.header_value_len = static_cast(m_valueByteBuf.len); + } + + EventStreamHeader &EventStreamHeader::operator=(const EventStreamHeader &lhs) noexcept + { + m_allocator = lhs.m_allocator; + m_valueByteBuf = Crt::ByteBufNewCopy(lhs.m_allocator, lhs.m_valueByteBuf.buffer, lhs.m_valueByteBuf.len); + m_underlyingHandle = lhs.m_underlyingHandle; + m_underlyingHandle.header_value.variable_len_val = m_valueByteBuf.buffer; + m_underlyingHandle.header_value_len = static_cast(m_valueByteBuf.len); + return *this; + } + + EventStreamHeader::EventStreamHeader(EventStreamHeader &&rhs) noexcept + : m_allocator(rhs.m_allocator), m_valueByteBuf(rhs.m_valueByteBuf), + m_underlyingHandle(rhs.m_underlyingHandle) + { + rhs.m_valueByteBuf.allocator = nullptr; + rhs.m_valueByteBuf.buffer = nullptr; + } + + const struct aws_event_stream_header_value_pair *EventStreamHeader::GetUnderlyingHandle() const + { + return &m_underlyingHandle; + } + + Crt::String EventStreamHeader::GetHeaderName() const noexcept + { + return Crt::String(m_underlyingHandle.header_name, m_underlyingHandle.header_name_len, m_allocator); + } + + bool EventStreamHeader::GetValueAsString(Crt::String &value) const noexcept + { + if (m_underlyingHandle.header_value_type != AWS_EVENT_STREAM_HEADER_STRING) + { + return false; + } + value = Crt::String( + reinterpret_cast(m_underlyingHandle.header_value.variable_len_val), + m_underlyingHandle.header_value_len, + m_allocator); + + return true; + } + + ClientContinuation ClientConnection::NewStream(ClientContinuationHandler &clientContinuationHandler) noexcept + { + return ClientContinuation(this, clientContinuationHandler, m_allocator); + } + + void ClientConnection::s_onConnectionSetup( + struct aws_event_stream_rpc_client_connection *connection, + int errorCode, + void *userData) noexcept + { + /* The `userData` pointer is used to pass `this` of a `ClientConnection` object. */ + auto *thisConnection = static_cast(userData); + + const std::lock_guard lock(thisConnection->m_stateMutex); + + if (errorCode) + { + thisConnection->m_clientState = DISCONNECTED; + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while setting up the connection: %s", + aws_error_debug_str(errorCode)); + thisConnection->m_connectAckedPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + aws_event_stream_rpc_client_connection_release(connection); + thisConnection->m_underlyingConnection = nullptr; + /* No connection to close on error, so no need to check return value of the callback. */ + (void)thisConnection->m_lifecycleHandler->OnErrorCallback(errorCode); + } + else if (thisConnection->m_clientState == DISCONNECTING || thisConnection->m_clientState == DISCONNECTED) + { + thisConnection->m_underlyingConnection = connection; + thisConnection->m_closeReason = {EVENT_STREAM_RPC_CONNECTION_CLOSED, 0}; + thisConnection->Close(); + } + else + { + thisConnection->m_clientState = WAITING_FOR_CONNECT_ACK; + thisConnection->m_underlyingConnection = connection; + MessageAmendment messageAmendment; + auto &messageAmendmentHeaders = messageAmendment.GetHeaders(); + + if (thisConnection->m_connectMessageAmender) + { + MessageAmendment connectAmendment(thisConnection->m_connectMessageAmender()); + auto &amenderHeaderList = connectAmendment.GetHeaders(); + /* The version header is necessary for establishing the connection. */ + messageAmendment.AddHeader(EventStreamHeader( + Crt::String(EVENTSTREAM_VERSION_HEADER), + Crt::String(EVENTSTREAM_VERSION_STRING), + thisConnection->m_allocator)); + /* Note that we are prepending headers from the user-provided amender. */ + if (amenderHeaderList.size() > 0) + { + messageAmendmentHeaders.splice(messageAmendmentHeaders.end(), amenderHeaderList); + } + messageAmendment.SetPayload(connectAmendment.GetPayload()); + } + + /* Send a CONNECT packet to the server. */ + s_sendProtocolMessage( + thisConnection, + messageAmendment.GetHeaders(), + messageAmendment.GetPayload(), + AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_CONNECT, + 0U, + thisConnection->m_onConnectRequestCallback); + } + + thisConnection->m_connectionSetupPromise.set_value(); + } + + void MessageAmendment::AddHeader(EventStreamHeader &&header) noexcept { m_headers.emplace_back(header); } + + void ClientConnection::s_onConnectionShutdown( + struct aws_event_stream_rpc_client_connection *connection, + int errorCode, + void *userData) noexcept + { + (void)connection; + /* The `userData` pointer is used to pass `this` of a `ClientConnection` object. */ + auto *thisConnection = static_cast(userData); + + const std::lock_guard lock(thisConnection->m_stateMutex); + + if (thisConnection->m_closeReason.baseStatus == EVENT_STREAM_RPC_UNINITIALIZED && errorCode) + { + thisConnection->m_closeReason = {EVENT_STREAM_RPC_CRT_ERROR, errorCode}; + } + + thisConnection->m_underlyingConnection = nullptr; + + if (thisConnection->m_closeReason.baseStatus != EVENT_STREAM_RPC_UNINITIALIZED && + !thisConnection->m_onConnectCalled) + { + thisConnection->m_connectAckedPromise.set_value(thisConnection->m_closeReason); + } + + thisConnection->m_clientState = DISCONNECTED; + + if (thisConnection->m_onConnectCalled) + { + thisConnection->m_lifecycleHandler->OnDisconnectCallback(errorCode); + thisConnection->m_onConnectCalled = false; + } + + if (errorCode) + { + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while shutting down the connection: %s", + aws_error_debug_str(errorCode)); + thisConnection->m_closedPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + } + else + { + thisConnection->m_closedPromise.set_value({EVENT_STREAM_RPC_SUCCESS, errorCode}); + } + } + + void ClientConnection::s_onProtocolMessage( + struct aws_event_stream_rpc_client_connection *connection, + const struct aws_event_stream_rpc_message_args *messageArgs, + void *userData) noexcept + { + AWS_PRECONDITION(messageArgs != nullptr); + (void)connection; + + /* The `userData` pointer is used to pass `this` of a `ClientConnection` object. */ + auto *thisConnection = static_cast(userData); + Crt::List pingHeaders; + + switch (messageArgs->message_type) + { + case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_CONNECT_ACK: + thisConnection->m_stateMutex.lock(); + if (thisConnection->m_clientState == WAITING_FOR_CONNECT_ACK) + { + if (messageArgs->message_flags & AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_CONNECTION_ACCEPTED) + { + thisConnection->m_clientState = CONNECTED; + thisConnection->m_onConnectCalled = true; + thisConnection->m_connectAckedPromise.set_value({EVENT_STREAM_RPC_SUCCESS, 0}); + thisConnection->m_lifecycleHandler->OnConnectCallback(); + } + else + { + thisConnection->m_closeReason = {EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED, 0}; + thisConnection->Close(); + } + } + else + { + /* Unexpected CONNECT_ACK received. */ + } + thisConnection->m_stateMutex.unlock(); + + break; + + case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PING: + + for (size_t i = 0; i < messageArgs->headers_count; ++i) + { + pingHeaders.emplace_back( + EventStreamHeader(messageArgs->headers[i], thisConnection->m_allocator)); + } + + if (messageArgs->payload) + { + thisConnection->m_lifecycleHandler->OnPingCallback(pingHeaders, *messageArgs->payload); + } + else + { + thisConnection->m_lifecycleHandler->OnPingCallback(pingHeaders, Crt::Optional()); + } + + break; + + case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PING_RESPONSE: + return; + break; + + case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PROTOCOL_ERROR: + case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_INTERNAL_ERROR: + + if (thisConnection->m_lifecycleHandler->OnErrorCallback(AWS_ERROR_EVENT_STREAM_RPC_PROTOCOL_ERROR)) + { + thisConnection->Close(); + } + + break; + + default: + return; + + if (thisConnection->m_lifecycleHandler->OnErrorCallback(EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE)) + { + thisConnection->Close(); + } + + break; + } + } + + void AbstractShapeBase::s_customDeleter(AbstractShapeBase *shape) noexcept + { + if (shape->m_allocator != nullptr) + Crt::Delete(shape, shape->m_allocator); + } + + ClientContinuation::ClientContinuation( + ClientConnection *connection, + ClientContinuationHandler &continuationHandler, + Crt::Allocator *allocator) noexcept + : m_allocator(allocator), m_continuationHandler(continuationHandler), m_continuationToken(nullptr) + { + struct aws_event_stream_rpc_client_stream_continuation_options options; + options.on_continuation = ClientContinuation::s_onContinuationMessage; + options.on_continuation_closed = ClientContinuation::s_onContinuationClosed; + + const std::lock_guard lock(connection->m_continuationVectorMutex); + ContinuationCallbackData *callbackData = Crt::New(m_allocator, this, m_allocator); + connection->m_continuationCallbackVector.emplace_back(callbackData); + + m_continuationHandler.m_callbackData = callbackData; + options.user_data = reinterpret_cast(callbackData); + + if (connection->IsOpen()) + { + m_continuationToken = + aws_event_stream_rpc_client_connection_new_stream(connection->m_underlyingConnection, &options); + if (m_continuationToken == nullptr) + { + Crt::Delete(callbackData, m_allocator); + connection->m_continuationCallbackVector.pop_back(); + m_continuationHandler.m_callbackData = nullptr; + } + } + } + + ClientContinuation::~ClientContinuation() noexcept + { + if (m_continuationToken) + { + aws_event_stream_rpc_client_continuation_release(m_continuationToken); + m_continuationToken = nullptr; + } + } + + ClientContinuationHandler::~ClientContinuationHandler() noexcept + { + if (m_callbackData) + { + m_callbackData->callbackMutex.lock(); + m_callbackData->continuationDestroyed = true; + m_callbackData->callbackMutex.unlock(); + } + } + + void ClientContinuation::s_onContinuationMessage( + struct aws_event_stream_rpc_client_continuation_token *continuationToken, + const struct aws_event_stream_rpc_message_args *messageArgs, + void *userData) noexcept + { + (void)continuationToken; + /* The `userData` pointer is used to pass a `ContinuationCallbackData` object. */ + auto *callbackData = static_cast(userData); + auto *thisContinuation = callbackData->clientContinuation; + + Crt::List continuationMessageHeaders; + for (size_t i = 0; i < messageArgs->headers_count; ++i) + { + continuationMessageHeaders.emplace_back( + EventStreamHeader(messageArgs->headers[i], thisContinuation->m_allocator)); + } + + Crt::Optional payload; + + if (messageArgs->payload) + { + payload = Crt::Optional(*messageArgs->payload); + } + else + { + payload = Crt::Optional(); + } + + const std::lock_guard lock(callbackData->callbackMutex); + if (callbackData->continuationDestroyed) + return; + thisContinuation->m_continuationHandler.OnContinuationMessage( + continuationMessageHeaders, payload, messageArgs->message_type, messageArgs->message_flags); + } + + void ClientContinuation::s_onContinuationClosed( + struct aws_event_stream_rpc_client_continuation_token *continuationToken, + void *userData) noexcept + { + (void)continuationToken; + + /* The `userData` pointer is used to pass a `ContinuationCallbackData` object. */ + auto *callbackData = static_cast(userData); + + const std::lock_guard lock(callbackData->callbackMutex); + if (callbackData->continuationDestroyed) + return; + + auto *thisContinuation = callbackData->clientContinuation; + thisContinuation->m_continuationHandler.OnContinuationClosed(); + } + + std::future ClientContinuation::Activate( + const Crt::String &operationName, + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + struct aws_array_list headersArray; + OnMessageFlushCallbackContainer *callbackContainer = nullptr; + std::promise onFlushPromise; + + if (m_continuationToken == nullptr) + { + onFlushPromise.set_value({EVENT_STREAM_RPC_CONNECTION_CLOSED, 0}); + return onFlushPromise.get_future(); + } + + if (IsClosed()) + { + onFlushPromise.set_value({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0}); + return onFlushPromise.get_future(); + } + + int errorCode = + EventStreamCppToNativeCrtBuilder::s_fillNativeHeadersArray(headers, &headersArray, m_allocator); + + if (!errorCode) + { + struct aws_event_stream_rpc_message_args msg_args; + msg_args.headers = (struct aws_event_stream_header_value_pair *)headersArray.data; + msg_args.headers_count = headers.size(); + msg_args.payload = payload.has_value() ? (aws_byte_buf *)(&(payload.value())) : nullptr; + msg_args.message_type = messageType; + msg_args.message_flags = messageFlags; + + /* This heap allocation is necessary so that the flush callback can still be invoked when this function + * returns. */ + callbackContainer = Crt::New(m_allocator, m_allocator); + callbackContainer->onMessageFlushCallback = onMessageFlushCallback; + callbackContainer->onFlushPromise = std::move(onFlushPromise); + + errorCode = aws_event_stream_rpc_client_continuation_activate( + m_continuationToken, + Crt::ByteCursorFromCString(operationName.c_str()), + &msg_args, + ClientConnection::s_protocolMessageCallback, + reinterpret_cast(callbackContainer)); + } + + /* Cleanup. */ + if (aws_array_list_is_valid(&headersArray)) + { + aws_array_list_clean_up(&headersArray); + } + + if (errorCode) + { + onFlushPromise = std::move(callbackContainer->onFlushPromise); + onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + Crt::Delete(callbackContainer, m_allocator); + } + else + { + return callbackContainer->onFlushPromise.get_future(); + } + + return onFlushPromise.get_future(); + } + + std::future ClientContinuation::SendMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + struct aws_array_list headersArray; + OnMessageFlushCallbackContainer *callbackContainer = nullptr; + std::promise onFlushPromise; + + if (IsClosed()) + { + onFlushPromise.set_value({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0}); + return onFlushPromise.get_future(); + } + + int errorCode = + EventStreamCppToNativeCrtBuilder::s_fillNativeHeadersArray(headers, &headersArray, m_allocator); + + if (!errorCode) + { + struct aws_event_stream_rpc_message_args msg_args; + msg_args.headers = (struct aws_event_stream_header_value_pair *)headersArray.data; + msg_args.headers_count = headers.size(); + msg_args.payload = payload.has_value() ? (aws_byte_buf *)(&(payload.value())) : nullptr; + msg_args.message_type = messageType; + msg_args.message_flags = messageFlags; + + /* This heap allocation is necessary so that the flush callback can still be invoked when this function + * returns. */ + callbackContainer = Crt::New(m_allocator, m_allocator); + callbackContainer->onMessageFlushCallback = onMessageFlushCallback; + callbackContainer->onFlushPromise = std::move(onFlushPromise); + + if (m_continuationToken) + { + errorCode = aws_event_stream_rpc_client_continuation_send_message( + m_continuationToken, + &msg_args, + ClientConnection::s_protocolMessageCallback, + reinterpret_cast(callbackContainer)); + } + } + + /* Cleanup. */ + if (aws_array_list_is_valid(&headersArray)) + { + aws_array_list_clean_up(&headersArray); + } + + if (errorCode) + { + onFlushPromise = std::move(callbackContainer->onFlushPromise); + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while queueing a message to be sent on a stream: %s", + aws_error_debug_str(errorCode)); + onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + Crt::Delete(callbackContainer, m_allocator); + } + else + { + return callbackContainer->onFlushPromise.get_future(); + } + + return onFlushPromise.get_future(); + } + + bool ClientContinuation::IsClosed() noexcept + { + if (!m_continuationToken) + { + return true; + } + else + { + return aws_event_stream_rpc_client_continuation_is_closed(m_continuationToken); + } + } + + OperationModelContext::OperationModelContext(const ServiceModel &serviceModel) noexcept + : m_serviceModel(serviceModel) + { + } + + OperationError::OperationError() noexcept {} + + void OperationError::SerializeToJsonObject(Crt::JsonObject &payloadObject) const { (void)payloadObject; } + + AbstractShapeBase::AbstractShapeBase() noexcept : m_allocator(nullptr) {} + + AbstractShapeBase::~AbstractShapeBase() noexcept {} + + ClientOperation::ClientOperation( + ClientConnection &connection, + StreamResponseHandler *streamHandler, + const OperationModelContext &operationModelContext, + Crt::Allocator *allocator) noexcept + : m_operationModelContext(operationModelContext), m_messageCount(0), m_allocator(allocator), + m_streamHandler(streamHandler), m_clientContinuation(connection.NewStream(*this)), + m_closeState(WONT_CLOSE), m_numCloses(0), m_streamClosedCalled(false) + { + } + + ClientOperation::ClientOperation(ClientOperation &&rhs) noexcept + : m_operationModelContext(rhs.m_operationModelContext), m_messageCount(std::move(rhs.m_messageCount)), + m_allocator(std::move(rhs.m_allocator)), m_streamHandler(rhs.m_streamHandler), + m_clientContinuation(std::move(rhs.m_clientContinuation)), + m_initialResponsePromise(std::move(rhs.m_initialResponsePromise)) + { + } + + ClientOperation::~ClientOperation() noexcept + { + Close().wait(); + if (m_numCloses.load() > 0) + { + m_closedPromise.get_future().wait(); + } + } + + TaggedResult::TaggedResult(Crt::ScopedResource operationResponse) noexcept + : m_responseType(OPERATION_RESPONSE) + { + m_operationResult.m_response = std::move(operationResponse); + } + + TaggedResult::~TaggedResult() noexcept + { + if (m_responseType == OPERATION_RESPONSE) + { + m_operationResult.m_response.~unique_ptr(); + } + else if (m_responseType == OPERATION_ERROR) + { + m_operationResult.m_error.~unique_ptr(); + } + } + + TaggedResult::TaggedResult(Crt::ScopedResource operationError) noexcept + : m_responseType(OPERATION_ERROR), m_rpcError({EVENT_STREAM_RPC_UNINITIALIZED, 0}) + { + m_operationResult.m_error = std::move(operationError); + } + + TaggedResult &TaggedResult::operator=(TaggedResult &&rhs) noexcept + { + m_responseType = rhs.m_responseType; + if (m_responseType == OPERATION_RESPONSE) + { + m_operationResult.m_response = std::move(rhs.m_operationResult.m_response); + } + else if (m_responseType == OPERATION_ERROR) + { + m_operationResult.m_error = std::move(rhs.m_operationResult.m_error); + } + m_rpcError = rhs.m_rpcError; + rhs.m_rpcError = {EVENT_STREAM_RPC_UNINITIALIZED, 0}; + + return *this; + } + + TaggedResult::TaggedResult(RpcError rpcError) noexcept + : m_responseType(RPC_ERROR), m_operationResult(), m_rpcError(rpcError) + { + } + + TaggedResult::TaggedResult() noexcept + : m_responseType(RPC_ERROR), m_operationResult(), m_rpcError({EVENT_STREAM_RPC_UNINITIALIZED, 0}) + { + } + + TaggedResult::TaggedResult(TaggedResult &&rhs) noexcept + { + m_responseType = rhs.m_responseType; + if (m_responseType == OPERATION_RESPONSE) + { + m_operationResult.m_response = std::move(rhs.m_operationResult.m_response); + } + else if (m_responseType == OPERATION_ERROR) + { + m_operationResult.m_error = std::move(rhs.m_operationResult.m_error); + } + m_rpcError = rhs.m_rpcError; + rhs.m_rpcError = {EVENT_STREAM_RPC_UNINITIALIZED, 0}; + } + + TaggedResult::operator bool() const noexcept { return m_responseType == OPERATION_RESPONSE; } + + AbstractShapeBase *TaggedResult::GetOperationResponse() const noexcept + { + return (m_responseType == OPERATION_RESPONSE) ? m_operationResult.m_response.get() : nullptr; + } + + OperationError *TaggedResult::GetOperationError() const noexcept + { + return (m_responseType == OPERATION_ERROR) ? m_operationResult.m_error.get() : nullptr; + } + + RpcError TaggedResult::GetRpcError() const noexcept + { + if (m_responseType == RPC_ERROR) + { + return m_rpcError; + } + else + { + /* Assume success since an application response or error was received. */ + return {EVENT_STREAM_RPC_SUCCESS, 0}; + } + } + + std::future ClientOperation::GetOperationResult() noexcept + { + { + const std::lock_guard lock(m_continuationMutex); + + if (m_clientContinuation.IsClosed() && !m_resultReceived) + { + AWS_LOGF_ERROR(AWS_LS_EVENT_STREAM_RPC_CLIENT, "The underlying stream is already closed."); + m_initialResponsePromise.set_value(TaggedResult({EVENT_STREAM_RPC_CONNECTION_CLOSED, 0})); + m_resultReceived = true; + } + } + + return m_initialResponsePromise.get_future(); + } + + const EventStreamHeader *ClientOperation::GetHeaderByName( + const Crt::List &headers, + const Crt::String &name) noexcept + { + for (auto it = headers.begin(); it != headers.end(); ++it) + { + if (name == it->GetHeaderName()) + { + return &(*it); + } + } + return nullptr; + } + + EventStreamRpcStatusCode ClientOperation::HandleData(const Crt::Optional &payload) + { + Crt::StringView payloadStringView; + if (payload.has_value()) + { + payloadStringView = Crt::ByteCursorToStringView(Crt::ByteCursorFromByteBuf(payload.value())); + } + + /* The value of this hashmap contains the function that allocates the response object from the + * payload. */ + /* Responses after the first message don't necessarily have the same shape as the first. */ + Crt::ScopedResource response; + if (m_messageCount == 1) + { + response = m_operationModelContext.AllocateInitialResponseFromPayload(payloadStringView, m_allocator); + } + else + { + response = m_operationModelContext.AllocateStreamingResponseFromPayload(payloadStringView, m_allocator); + } + + if (response.get() == nullptr) + { + AWS_LOGF_ERROR(AWS_LS_EVENT_STREAM_RPC_CLIENT, "Failed to allocate a response from the payload."); + return EVENT_STREAM_RPC_ALLOCATION_ERROR; + } + + if (m_messageCount == 1) + { + const std::lock_guard lock(m_continuationMutex); + m_resultReceived = true; + m_initialResponsePromise.set_value(TaggedResult(std::move(response))); + } + else + { + if (m_streamHandler) + m_streamHandler->OnStreamEvent(std::move(response)); + } + + return EVENT_STREAM_RPC_SUCCESS; + } + + EventStreamRpcStatusCode ClientOperation::HandleError( + const Crt::String &modelName, + const Crt::Optional &payload, + uint32_t messageFlags) + { + bool streamAlreadyTerminated = messageFlags & AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_TERMINATE_STREAM; + + Crt::StringView payloadStringView; + if (payload.has_value()) + { + payloadStringView = Crt::ByteCursorToStringView(Crt::ByteCursorFromByteBuf(payload.value())); + } + + /* The value of this hashmap contains the function that allocates the error from the + * payload. */ + Crt::ScopedResource error = + m_operationModelContext.AllocateOperationErrorFromPayload(modelName, payloadStringView, m_allocator); + if (error.get() == nullptr) + return EVENT_STREAM_RPC_UNMAPPED_DATA; + TaggedResult taggedResult(std::move(error)); + if (m_messageCount == 1) + { + { + const std::lock_guard lock(m_continuationMutex); + m_resultReceived = true; + m_initialResponsePromise.set_value(std::move(taggedResult)); + } + /* Close the stream unless the server already closed it for us. This condition is checked + * so that TERMINATE_STREAM messages aren't resent by the client. */ + if (!streamAlreadyTerminated && !m_clientContinuation.IsClosed()) + { + Close().wait(); + } + } + else + { + bool shouldCloseNow = true; + if (m_streamHandler) + shouldCloseNow = m_streamHandler->OnStreamError(std::move(error), {EVENT_STREAM_RPC_SUCCESS, 0}); + if (!streamAlreadyTerminated && shouldCloseNow && !m_clientContinuation.IsClosed()) + { + Close().wait(); + } + } + + return EVENT_STREAM_RPC_SUCCESS; + } + + bool StreamResponseHandler::OnStreamError(Crt::ScopedResource operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + /* Note: Always returning true forces the stream to close when an error occurs. */ + return true; + } + + void StreamResponseHandler::OnStreamEvent(Crt::ScopedResource response) {} + + void StreamResponseHandler::OnStreamClosed() {} + + void ClientOperation::OnContinuationMessage( + const Crt::List &headers, + const Crt::Optional &payload, + MessageType messageType, + uint32_t messageFlags) + { + EventStreamRpcStatusCode errorCode = EVENT_STREAM_RPC_SUCCESS; + const EventStreamHeader *modelHeader = nullptr; + const EventStreamHeader *contentHeader = nullptr; + Crt::String modelName; + + if (messageFlags & AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_TERMINATE_STREAM) + { + const std::lock_guard lock(m_continuationMutex); + m_closeState = WILL_CLOSE; + m_numCloses.fetch_add(1); + } + + m_messageCount += 1; + + modelHeader = GetHeaderByName(headers, Crt::String(SERVICE_MODEL_TYPE_HEADER)); + if (modelHeader == nullptr) + { + /* Missing required service model type header. */ + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A required header (%s) could not be found in the message.", + SERVICE_MODEL_TYPE_HEADER); + errorCode = EVENT_STREAM_RPC_UNMAPPED_DATA; + } + + /* Verify that the model name matches. */ + if (!errorCode) + { + modelHeader->GetValueAsString(modelName); + if (messageType == AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_MESSAGE) + { + if (m_messageCount == 1 && m_operationModelContext.GetInitialResponseModelName() != modelName) + { + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "The model name of the initial response did not match its expected model name."); + errorCode = EVENT_STREAM_RPC_UNMAPPED_DATA; + } + else if ( + m_messageCount > 1 && m_operationModelContext.GetStreamingResponseModelName().has_value() && + m_operationModelContext.GetStreamingResponseModelName().value() != modelName) + { + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "The model name of a subsequent response did not match its expected model name."); + errorCode = EVENT_STREAM_RPC_UNMAPPED_DATA; + } + } + } + + if (!errorCode) + { + Crt::String contentType; + contentHeader = GetHeaderByName(headers, Crt::String(CONTENT_TYPE_HEADER)); + if (contentHeader == nullptr) + { + /* Missing required content type header. */ + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A required header (%s) could not be found in the message.", + CONTENT_TYPE_HEADER); + errorCode = EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE; + } + else if (contentHeader->GetValueAsString(contentType) && contentType != CONTENT_TYPE_APPLICATION_JSON) + { + /* Missing required content type header. */ + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "The content type (%s) header was specified with an unsupported value (%s).", + CONTENT_TYPE_HEADER, + contentType.c_str()); + errorCode = EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE; + } + } + + if (!errorCode) + { + if (messageType == AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_MESSAGE) + { + errorCode = HandleData(payload); + } + else + { + errorCode = HandleError(modelName, payload, messageFlags); + } + } + + if (errorCode) + { + if (m_messageCount == 1) + { + const std::lock_guard lock(m_continuationMutex); + m_resultReceived = true; + RpcError promiseValue = {(EventStreamRpcStatusCode)errorCode, 0}; + m_initialResponsePromise.set_value(TaggedResult(promiseValue)); + } + else + { + bool shouldClose = true; + if (m_streamHandler) + shouldClose = m_streamHandler->OnStreamError(nullptr, {errorCode, 0}); + if (!m_clientContinuation.IsClosed() && shouldClose) + { + Close().wait(); + } + } + } + } + + std::future ClientOperation::Activate( + const AbstractShapeBase *shape, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + /* Promises must be reset in case the client would like to send a subsequent request with the same + * `ClientOperation`. */ + m_initialResponsePromise = {}; + m_closedPromise = {}; + { + const std::lock_guard lock(m_continuationMutex); + m_resultReceived = false; + if (m_closeState != WILL_CLOSE) + m_closeState = WONT_CLOSE; + } + + Crt::List headers; + headers.emplace_back(EventStreamHeader( + Crt::String(CONTENT_TYPE_HEADER), Crt::String(CONTENT_TYPE_APPLICATION_JSON), m_allocator)); + headers.emplace_back( + EventStreamHeader(Crt::String(SERVICE_MODEL_TYPE_HEADER), GetModelName(), m_allocator)); + Crt::JsonObject payloadObject; + shape->SerializeToJsonObject(payloadObject); + Crt::String payloadString = payloadObject.View().WriteCompact(); + return m_clientContinuation.Activate( + GetModelName(), + headers, + Crt::ByteBufFromCString(payloadString.c_str()), + AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_MESSAGE, + 0, + onMessageFlushCallback); + } + + void ClientOperation::OnContinuationClosed() + { + std::unique_lock lock(m_continuationMutex); + if (!m_resultReceived) + { + m_initialResponsePromise.set_value(TaggedResult({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0})); + m_resultReceived = true; + } + + m_numCloses.fetch_sub(1); + if (m_numCloses.load() == 0 && m_closeState != ALREADY_CLOSED) + { + m_closedPromise.set_value(); + m_closeState = ALREADY_CLOSED; + if (!m_streamClosedCalled.load() && m_streamHandler) + { + m_streamHandler->OnStreamClosed(); + m_streamClosedCalled.store(true); + } + } + } + + std::future ClientOperation::Close(OnMessageFlushCallback onMessageFlushCallback) noexcept + { + if (m_numCloses.load() > 0 || m_clientContinuation.IsClosed()) + { + std::promise errorPromise; + errorPromise.set_value({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0}); + return errorPromise.get_future(); + } + else + { + std::promise onTerminatePromise; + + int errorCode = AWS_OP_ERR; + struct aws_event_stream_rpc_message_args msg_args; + msg_args.headers = nullptr; + msg_args.headers_count = 0; + msg_args.payload = nullptr; + msg_args.message_type = AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_MESSAGE; + msg_args.message_flags = AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_TERMINATE_STREAM; + + /* This heap allocation is necessary so that the flush callback can still be invoked when this function + * returns. */ + OnMessageFlushCallbackContainer *callbackContainer = + Crt::New(m_allocator, m_allocator); + callbackContainer->onMessageFlushCallback = onMessageFlushCallback; + callbackContainer->onFlushPromise = std::move(onTerminatePromise); + + if (m_clientContinuation.m_continuationToken) + { + errorCode = aws_event_stream_rpc_client_continuation_send_message( + m_clientContinuation.m_continuationToken, + &msg_args, + ClientConnection::s_protocolMessageCallback, + reinterpret_cast(callbackContainer)); + } + + if (errorCode) + { + onTerminatePromise = std::move(callbackContainer->onFlushPromise); + std::promise errorPromise; + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "A CRT error occurred while closing the stream: %s", + aws_error_debug_str(errorCode)); + onTerminatePromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + Crt::Delete(callbackContainer, m_allocator); + } + else + { + const std::lock_guard lock(m_continuationMutex); + m_closeState = WILL_CLOSE; + m_numCloses.fetch_add(1); + return callbackContainer->onFlushPromise.get_future(); + } + + return onTerminatePromise.get_future(); + } + } + + void OperationError::s_customDeleter(OperationError *shape) noexcept + { + AbstractShapeBase::s_customDeleter(shape); + } + + } /* namespace Eventstreamrpc */ +} // namespace Aws \ No newline at end of file diff --git a/eventstream_rpc/tests/CMakeLists.txt b/eventstream_rpc/tests/CMakeLists.txt new file mode 100644 index 000000000..1ddeb9771 --- /dev/null +++ b/eventstream_rpc/tests/CMakeLists.txt @@ -0,0 +1,53 @@ +include(AwsTestHarness) +enable_testing() +include(CTest) + +file(GLOB AWS_ECHOTESTRPC_HEADERS + "include/awstest/*.h" +) + +file(GLOB AWS_ECHOTESTRPC_SRC + "EchoTestRpcClient.cpp" + "EchoTestRpcModel.cpp" +) + +if (WIN32) + if (MSVC) + source_group("Header Files\\awstest\\" FILES ${AWS_ECHOTESTRPC_HEADERS}) + source_group("Source Files" FILES ${AWS_ECHOTESTRPC_SRC}) + endif () +endif() + +if (UNIX AND NOT APPLE) + include(GNUInstallDirs) +elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + + if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") + set(FIND_LIBRARY_USE_LIB64_PATHS true) + endif() +endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") +if (NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() + +install(FILES ${AWS_ECHOTESTRPC_HEADERS} DESTINATION "include/awstest/" COMPONENT Development) + +file(GLOB TEST_SRC "*.cpp") +file(GLOB TEST_HDRS "*.h") +file(GLOB TESTS ${TEST_HDRS} ${TEST_SRC}) + +set(TEST_BINARY_NAME ${PROJECT_NAME}-tests) + +aws_use_package(aws-crt-cpp) +aws_use_package(EventstreamRpc-cpp) +add_test_case(OperateWhileDisconnected) +# The tests below can be commented out when an EchoRPC Server is running on 127.0.0.1:8033 +#add_test_case(EventStreamConnect) +#add_test_case(EchoOperation) +#add_test_case(StressTestClient) +generate_cpp_test_driver(${TEST_BINARY_NAME}) +target_include_directories(${TEST_BINARY_NAME} PUBLIC + $ + $) diff --git a/eventstream_rpc/tests/DefaultConnectionConfig.cpp b/eventstream_rpc/tests/DefaultConnectionConfig.cpp new file mode 100644 index 000000000..c75002c98 --- /dev/null +++ b/eventstream_rpc/tests/DefaultConnectionConfig.cpp @@ -0,0 +1,16 @@ +#include + +namespace Awstest +{ + DefaultConnectionConfig::DefaultConnectionConfig() noexcept + { + m_hostName = Aws::Crt::String("127.0.0.1"); + m_port = 8033; + Aws::Crt::Io::SocketOptions socketOptions; + socketOptions.SetSocketDomain(Aws::Crt::Io::SocketDomain::IPv4); + socketOptions.SetSocketType(Aws::Crt::Io::SocketType::Stream); + m_socketOptions = std::move(socketOptions); + m_connectAmendment.AddHeader( + EventStreamHeader(Aws::Crt::String("client-name"), Aws::Crt::String("accepted.testy_mc_testerson"))); + } +} // namespace Awstest diff --git a/eventstream_rpc/tests/EchoTestRpcClient.cpp b/eventstream_rpc/tests/EchoTestRpcClient.cpp new file mode 100644 index 000000000..ab257baf5 --- /dev/null +++ b/eventstream_rpc/tests/EchoTestRpcClient.cpp @@ -0,0 +1,61 @@ +#include +#include + +namespace Awstest +{ + EchoTestRpcClient::EchoTestRpcClient( + Aws::Crt::Io::ClientBootstrap &clientBootstrap, + Aws::Crt::Allocator *allocator) noexcept + : m_connection(allocator), m_clientBootstrap(clientBootstrap), m_allocator(allocator) + { + m_echoTestRpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("awstest#ServiceError"), ServiceError::s_allocateFromPayload); + } + + std::future EchoTestRpcClient::Connect( + ConnectionLifecycleHandler &lifecycleHandler, + const ConnectionConfig &connectionConfig) noexcept + { + return m_connection.Connect(connectionConfig, &lifecycleHandler, m_clientBootstrap); + } + + void EchoTestRpcClient::Close() noexcept { m_connection.Close(); } + + EchoTestRpcClient::~EchoTestRpcClient() noexcept { Close(); } + + GetAllProductsOperation EchoTestRpcClient::NewGetAllProducts() noexcept + { + return GetAllProductsOperation( + m_connection, m_echoTestRpcServiceModel.m_getAllProductsOperationContext, m_allocator); + } + CauseServiceErrorOperation EchoTestRpcClient::NewCauseServiceError() noexcept + { + return CauseServiceErrorOperation( + m_connection, m_echoTestRpcServiceModel.m_causeServiceErrorOperationContext, m_allocator); + } + CauseStreamServiceToErrorOperation EchoTestRpcClient::NewCauseStreamServiceToError( + CauseStreamServiceToErrorStreamHandler &streamHandler) noexcept + { + return CauseStreamServiceToErrorOperation( + m_connection, + &streamHandler, + m_echoTestRpcServiceModel.m_causeStreamServiceToErrorOperationContext, + m_allocator); + } + EchoStreamMessagesOperation EchoTestRpcClient::NewEchoStreamMessages( + EchoStreamMessagesStreamHandler &streamHandler) noexcept + { + return EchoStreamMessagesOperation( + m_connection, &streamHandler, m_echoTestRpcServiceModel.m_echoStreamMessagesOperationContext, m_allocator); + } + EchoMessageOperation EchoTestRpcClient::NewEchoMessage() noexcept + { + return EchoMessageOperation(m_connection, m_echoTestRpcServiceModel.m_echoMessageOperationContext, m_allocator); + } + GetAllCustomersOperation EchoTestRpcClient::NewGetAllCustomers() noexcept + { + return GetAllCustomersOperation( + m_connection, m_echoTestRpcServiceModel.m_getAllCustomersOperationContext, m_allocator); + } + +} // namespace Awstest diff --git a/eventstream_rpc/tests/EchoTestRpcModel.cpp b/eventstream_rpc/tests/EchoTestRpcModel.cpp new file mode 100644 index 000000000..0ba00cdf7 --- /dev/null +++ b/eventstream_rpc/tests/EchoTestRpcModel.cpp @@ -0,0 +1,1390 @@ +#include +#include + +namespace Awstest +{ + void Product::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_name.has_value()) + { + payloadObject.WithString("name", m_name.value()); + } + if (m_price.has_value()) + { + payloadObject.WithDouble("price", static_cast(m_price.value())); + } + } + + void Product::s_loadFromJsonView(Product &product, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("name")) + { + product.m_name = Aws::Crt::Optional(jsonView.GetString("name")); + } + if (jsonView.ValueExists("price")) + { + product.m_price = Aws::Crt::Optional(static_cast(jsonView.GetDouble("price"))); + } + } + + Aws::Crt::String Product::GetModelName() const noexcept { return Aws::Crt::String("awstest#Product"); } + + Aws::Crt::ScopedResource Product::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape(Aws::Crt::New(allocator), Product::s_customDeleter); + shape->m_allocator = allocator; + Product::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void Product::s_customDeleter(Product *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void Customer::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_id.has_value()) + { + payloadObject.WithInt64("id", m_id.value()); + } + if (m_firstName.has_value()) + { + payloadObject.WithString("firstName", m_firstName.value()); + } + if (m_lastName.has_value()) + { + payloadObject.WithString("lastName", m_lastName.value()); + } + } + + void Customer::s_loadFromJsonView(Customer &customer, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("id")) + { + customer.m_id = Aws::Crt::Optional(jsonView.GetInt64("id")); + } + if (jsonView.ValueExists("firstName")) + { + customer.m_firstName = Aws::Crt::Optional(jsonView.GetString("firstName")); + } + if (jsonView.ValueExists("lastName")) + { + customer.m_lastName = Aws::Crt::Optional(jsonView.GetString("lastName")); + } + } + + Aws::Crt::String Customer::GetModelName() const noexcept { return Aws::Crt::String("awstest#Customer"); } + + Aws::Crt::ScopedResource Customer::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape(Aws::Crt::New(allocator), Customer::s_customDeleter); + shape->m_allocator = allocator; + Customer::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void Customer::s_customDeleter(Customer *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void Pair::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_key.has_value()) + { + payloadObject.WithString("key", m_key.value()); + } + if (m_value.has_value()) + { + payloadObject.WithString("value", m_value.value()); + } + } + + void Pair::s_loadFromJsonView(Pair &pair, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("key")) + { + pair.m_key = Aws::Crt::Optional(jsonView.GetString("key")); + } + if (jsonView.ValueExists("value")) + { + pair.m_value = Aws::Crt::Optional(jsonView.GetString("value")); + } + } + + Aws::Crt::String Pair::GetModelName() const noexcept { return Aws::Crt::String("awstest#Pair"); } + + Aws::Crt::ScopedResource Pair::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape(Aws::Crt::New(allocator), Pair::s_customDeleter); + shape->m_allocator = allocator; + Pair::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void Pair::s_customDeleter(Pair *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void MessageData::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_stringMessage.has_value()) + { + payloadObject.WithString("stringMessage", m_stringMessage.value()); + } + if (m_booleanMessage.has_value()) + { + payloadObject.WithBool("booleanMessage", m_booleanMessage.value()); + } + if (m_timeMessage.has_value()) + { + payloadObject.WithDouble("timeMessage", m_timeMessage.value().SecondsWithMSPrecision()); + } + if (m_documentMessage.has_value()) + { + payloadObject.WithObject("documentMessage", m_documentMessage.value()); + } + if (m_enumMessage.has_value()) + { + payloadObject.WithString("enumMessage", m_enumMessage.value()); + } + if (m_blobMessage.has_value()) + { + if (m_blobMessage.value().size() > 0) + { + payloadObject.WithString("blobMessage", Aws::Crt::Base64Encode(m_blobMessage.value())); + } + } + if (m_stringListMessage.has_value()) + { + Aws::Crt::JsonObject stringList; + Aws::Crt::Vector stringListJsonArray; + for (const auto &stringListItem : m_stringListMessage.value()) + { + Aws::Crt::JsonObject stringListJsonArrayItem; + stringListJsonArrayItem.AsString(stringListItem); + stringListJsonArray.emplace_back(std::move(stringListJsonArrayItem)); + } + stringList.AsArray(std::move(stringListJsonArray)); + payloadObject.WithObject("stringListMessage", std::move(stringList)); + } + if (m_keyValuePairList.has_value()) + { + Aws::Crt::JsonObject keyValuePairList; + Aws::Crt::Vector keyValuePairListJsonArray; + for (const auto &keyValuePairListItem : m_keyValuePairList.value()) + { + Aws::Crt::JsonObject keyValuePairListJsonArrayItem; + keyValuePairListItem.SerializeToJsonObject(keyValuePairListJsonArrayItem); + keyValuePairListJsonArray.emplace_back(std::move(keyValuePairListJsonArrayItem)); + } + keyValuePairList.AsArray(std::move(keyValuePairListJsonArray)); + payloadObject.WithObject("keyValuePairList", std::move(keyValuePairList)); + } + if (m_stringToValue.has_value()) + { + Aws::Crt::JsonObject stringToValueValue; + for (const auto &stringToValueItem : m_stringToValue.value()) + { + Aws::Crt::JsonObject stringToValueJsonObject; + stringToValueItem.second.SerializeToJsonObject(stringToValueJsonObject); + stringToValueValue.WithObject(stringToValueItem.first, std::move(stringToValueJsonObject)); + } + payloadObject.WithObject("stringToValue", std::move(stringToValueValue)); + } + } + + void MessageData::s_loadFromJsonView(MessageData &messageData, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("stringMessage")) + { + messageData.m_stringMessage = Aws::Crt::Optional(jsonView.GetString("stringMessage")); + } + if (jsonView.ValueExists("booleanMessage")) + { + messageData.m_booleanMessage = Aws::Crt::Optional(jsonView.GetBool("booleanMessage")); + } + if (jsonView.ValueExists("timeMessage")) + { + messageData.m_timeMessage = + Aws::Crt::Optional(Aws::Crt::DateTime(jsonView.GetDouble("timeMessage"))); + } + if (jsonView.ValueExists("documentMessage")) + { + messageData.m_documentMessage = + Aws::Crt::Optional(jsonView.GetJsonObject("documentMessage").Materialize()); + } + if (jsonView.ValueExists("enumMessage")) + { + messageData.m_enumMessage = Aws::Crt::Optional(jsonView.GetString("enumMessage")); + } + if (jsonView.ValueExists("blobMessage")) + { + if (jsonView.GetString("blobMessage").size() > 0) + { + messageData.m_blobMessage = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("blobMessage"))); + } + } + if (jsonView.ValueExists("stringListMessage")) + { + messageData.m_stringListMessage = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &stringListJsonView : jsonView.GetArray("stringListMessage")) + { + Aws::Crt::Optional stringListItem; + stringListItem = Aws::Crt::Optional(stringListJsonView.AsString()); + messageData.m_stringListMessage.value().push_back(stringListItem.value()); + } + } + if (jsonView.ValueExists("keyValuePairList")) + { + messageData.m_keyValuePairList = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &keyValuePairListJsonView : jsonView.GetArray("keyValuePairList")) + { + Aws::Crt::Optional keyValuePairListItem; + keyValuePairListItem = Pair(); + Pair::s_loadFromJsonView(keyValuePairListItem.value(), keyValuePairListJsonView); + messageData.m_keyValuePairList.value().push_back(keyValuePairListItem.value()); + } + } + if (jsonView.ValueExists("stringToValue")) + { + messageData.m_stringToValue = Aws::Crt::Map(); + for (const auto &stringToValuePair : jsonView.GetJsonObject("stringToValue").GetAllObjects()) + { + Aws::Crt::Optional stringToValueValue; + stringToValueValue = Product(); + Product::s_loadFromJsonView(stringToValueValue.value(), stringToValuePair.second); + messageData.m_stringToValue.value()[stringToValuePair.first] = stringToValueValue.value(); + } + } + } + + void MessageData::SetEnumMessage(FruitEnum enumMessage) noexcept + { + switch (enumMessage) + { + case FRUIT_ENUM_APPLE: + m_enumMessage = Aws::Crt::String("apl"); + break; + case FRUIT_ENUM_ORANGE: + m_enumMessage = Aws::Crt::String("org"); + break; + case FRUIT_ENUM_BANANA: + m_enumMessage = Aws::Crt::String("ban"); + break; + case FRUIT_ENUM_PINEAPPLE: + m_enumMessage = Aws::Crt::String("pin"); + break; + default: + break; + } + } + + Aws::Crt::Optional MessageData::GetEnumMessage() noexcept + { + if (!m_enumMessage.has_value()) + return Aws::Crt::Optional(); + if (m_enumMessage.value() == Aws::Crt::String("apl")) + { + return Aws::Crt::Optional(FRUIT_ENUM_APPLE); + } + if (m_enumMessage.value() == Aws::Crt::String("org")) + { + return Aws::Crt::Optional(FRUIT_ENUM_ORANGE); + } + if (m_enumMessage.value() == Aws::Crt::String("ban")) + { + return Aws::Crt::Optional(FRUIT_ENUM_BANANA); + } + if (m_enumMessage.value() == Aws::Crt::String("pin")) + { + return Aws::Crt::Optional(FRUIT_ENUM_PINEAPPLE); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String MessageData::GetModelName() const noexcept { return Aws::Crt::String("awstest#MessageData"); } + + Aws::Crt::ScopedResource MessageData::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), MessageData::s_customDeleter); + shape->m_allocator = allocator; + MessageData::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void MessageData::s_customDeleter(MessageData *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void EchoStreamingMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_STREAM_MESSAGE && m_streamMessage.has_value()) + { + Aws::Crt::JsonObject messageDataValue; + m_streamMessage.value().SerializeToJsonObject(messageDataValue); + payloadObject.WithObject("streamMessage", std::move(messageDataValue)); + } + else if (m_chosenMember == TAG_KEY_VALUE_PAIR && m_keyValuePair.has_value()) + { + Aws::Crt::JsonObject pairValue; + m_keyValuePair.value().SerializeToJsonObject(pairValue); + payloadObject.WithObject("keyValuePair", std::move(pairValue)); + } + } + + void EchoStreamingMessage::s_loadFromJsonView( + EchoStreamingMessage &echoStreamingMessage, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("streamMessage")) + { + echoStreamingMessage.m_streamMessage = MessageData(); + MessageData::s_loadFromJsonView( + echoStreamingMessage.m_streamMessage.value(), jsonView.GetJsonObject("streamMessage")); + echoStreamingMessage.m_chosenMember = TAG_STREAM_MESSAGE; + } + else if (jsonView.ValueExists("keyValuePair")) + { + echoStreamingMessage.m_keyValuePair = Pair(); + Pair::s_loadFromJsonView( + echoStreamingMessage.m_keyValuePair.value(), jsonView.GetJsonObject("keyValuePair")); + echoStreamingMessage.m_chosenMember = TAG_KEY_VALUE_PAIR; + } + } + + EchoStreamingMessage &EchoStreamingMessage::operator=(const EchoStreamingMessage &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_STREAM_MESSAGE) + { + m_streamMessage = objectToCopy.m_streamMessage; + m_chosenMember = objectToCopy.m_chosenMember; + } + else if (objectToCopy.m_chosenMember == TAG_KEY_VALUE_PAIR) + { + m_keyValuePair = objectToCopy.m_keyValuePair; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingMessage"); + } + + Aws::Crt::ScopedResource EchoStreamingMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), EchoStreamingMessage::s_customDeleter); + shape->m_allocator = allocator; + EchoStreamingMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void EchoStreamingMessage::s_customDeleter(EchoStreamingMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetAllProductsResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_products.has_value()) + { + Aws::Crt::JsonObject productMapValue; + for (const auto &productMapItem : m_products.value()) + { + Aws::Crt::JsonObject productMapJsonObject; + productMapItem.second.SerializeToJsonObject(productMapJsonObject); + productMapValue.WithObject(productMapItem.first, std::move(productMapJsonObject)); + } + payloadObject.WithObject("products", std::move(productMapValue)); + } + } + + void GetAllProductsResponse::s_loadFromJsonView( + GetAllProductsResponse &getAllProductsResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("products")) + { + getAllProductsResponse.m_products = Aws::Crt::Map(); + for (const auto &productMapPair : jsonView.GetJsonObject("products").GetAllObjects()) + { + Aws::Crt::Optional productMapValue; + productMapValue = Product(); + Product::s_loadFromJsonView(productMapValue.value(), productMapPair.second); + getAllProductsResponse.m_products.value()[productMapPair.first] = productMapValue.value(); + } + } + } + + Aws::Crt::String GetAllProductsResponse::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllProductsResponse"); + } + + Aws::Crt::ScopedResource GetAllProductsResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetAllProductsResponse::s_customDeleter); + shape->m_allocator = allocator; + GetAllProductsResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetAllProductsResponse::s_customDeleter(GetAllProductsResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetAllProductsRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void GetAllProductsRequest::s_loadFromJsonView( + GetAllProductsRequest &getAllProductsRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)getAllProductsRequest; + (void)jsonView; + } + + Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllProductsRequest"); + } + + Aws::Crt::ScopedResource GetAllProductsRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetAllProductsRequest::s_customDeleter); + shape->m_allocator = allocator; + GetAllProductsRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetAllProductsRequest::s_customDeleter(GetAllProductsRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetAllCustomersResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_customers.has_value()) + { + Aws::Crt::JsonObject customerList; + Aws::Crt::Vector customerListJsonArray; + for (const auto &customerListItem : m_customers.value()) + { + Aws::Crt::JsonObject customerListJsonArrayItem; + customerListItem.SerializeToJsonObject(customerListJsonArrayItem); + customerListJsonArray.emplace_back(std::move(customerListJsonArrayItem)); + } + customerList.AsArray(std::move(customerListJsonArray)); + payloadObject.WithObject("customers", std::move(customerList)); + } + } + + void GetAllCustomersResponse::s_loadFromJsonView( + GetAllCustomersResponse &getAllCustomersResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("customers")) + { + getAllCustomersResponse.m_customers = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &customerListJsonView : jsonView.GetArray("customers")) + { + Aws::Crt::Optional customerListItem; + customerListItem = Customer(); + Customer::s_loadFromJsonView(customerListItem.value(), customerListJsonView); + getAllCustomersResponse.m_customers.value().push_back(customerListItem.value()); + } + } + } + + Aws::Crt::String GetAllCustomersResponse::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllCustomersResponse"); + } + + Aws::Crt::ScopedResource GetAllCustomersResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetAllCustomersResponse::s_customDeleter); + shape->m_allocator = allocator; + GetAllCustomersResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetAllCustomersResponse::s_customDeleter(GetAllCustomersResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetAllCustomersRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void GetAllCustomersRequest::s_loadFromJsonView( + GetAllCustomersRequest &getAllCustomersRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)getAllCustomersRequest; + (void)jsonView; + } + + Aws::Crt::String GetAllCustomersRequest::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllCustomersRequest"); + } + + Aws::Crt::ScopedResource GetAllCustomersRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetAllCustomersRequest::s_customDeleter); + shape->m_allocator = allocator; + GetAllCustomersRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetAllCustomersRequest::s_customDeleter(GetAllCustomersRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void EchoMessageResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + Aws::Crt::JsonObject messageDataValue; + m_message.value().SerializeToJsonObject(messageDataValue); + payloadObject.WithObject("message", std::move(messageDataValue)); + } + } + + void EchoMessageResponse::s_loadFromJsonView( + EchoMessageResponse &echoMessageResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + echoMessageResponse.m_message = MessageData(); + MessageData::s_loadFromJsonView(echoMessageResponse.m_message.value(), jsonView.GetJsonObject("message")); + } + } + + Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoMessageResponse"); + } + + Aws::Crt::ScopedResource EchoMessageResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), EchoMessageResponse::s_customDeleter); + shape->m_allocator = allocator; + EchoMessageResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void EchoMessageResponse::s_customDeleter(EchoMessageResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void EchoMessageRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + Aws::Crt::JsonObject messageDataValue; + m_message.value().SerializeToJsonObject(messageDataValue); + payloadObject.WithObject("message", std::move(messageDataValue)); + } + } + + void EchoMessageRequest::s_loadFromJsonView( + EchoMessageRequest &echoMessageRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + echoMessageRequest.m_message = MessageData(); + MessageData::s_loadFromJsonView(echoMessageRequest.m_message.value(), jsonView.GetJsonObject("message")); + } + } + + Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoMessageRequest"); + } + + Aws::Crt::ScopedResource EchoMessageRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), EchoMessageRequest::s_customDeleter); + shape->m_allocator = allocator; + EchoMessageRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void EchoMessageRequest::s_customDeleter(EchoMessageRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void EchoStreamingResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void EchoStreamingResponse::s_loadFromJsonView( + EchoStreamingResponse &echoStreamingResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)echoStreamingResponse; + (void)jsonView; + } + + Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingResponse"); + } + + Aws::Crt::ScopedResource EchoStreamingResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), EchoStreamingResponse::s_customDeleter); + shape->m_allocator = allocator; + EchoStreamingResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void EchoStreamingResponse::s_customDeleter(EchoStreamingResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void EchoStreamingRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void EchoStreamingRequest::s_loadFromJsonView( + EchoStreamingRequest &echoStreamingRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)echoStreamingRequest; + (void)jsonView; + } + + Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingRequest"); + } + + Aws::Crt::ScopedResource EchoStreamingRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), EchoStreamingRequest::s_customDeleter); + shape->m_allocator = allocator; + EchoStreamingRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void EchoStreamingRequest::s_customDeleter(EchoStreamingRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ServiceError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + if (m_value.has_value()) + { + payloadObject.WithString("value", m_value.value()); + } + } + + void ServiceError::s_loadFromJsonView(ServiceError &serviceError, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + serviceError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + if (jsonView.ValueExists("value")) + { + serviceError.m_value = Aws::Crt::Optional(jsonView.GetString("value")); + } + } + + Aws::Crt::String ServiceError::GetModelName() const noexcept { return Aws::Crt::String("awstest#ServiceError"); } + + Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ServiceError::s_customDeleter); + shape->m_allocator = allocator; + ServiceError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void ServiceError::s_customDeleter(ServiceError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void CauseServiceErrorResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void CauseServiceErrorResponse::s_loadFromJsonView( + CauseServiceErrorResponse &causeServiceErrorResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)causeServiceErrorResponse; + (void)jsonView; + } + + Aws::Crt::String CauseServiceErrorResponse::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#CauseServiceErrorResponse"); + } + + Aws::Crt::ScopedResource CauseServiceErrorResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), CauseServiceErrorResponse::s_customDeleter); + shape->m_allocator = allocator; + CauseServiceErrorResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void CauseServiceErrorResponse::s_customDeleter(CauseServiceErrorResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void CauseServiceErrorRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void CauseServiceErrorRequest::s_loadFromJsonView( + CauseServiceErrorRequest &causeServiceErrorRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)causeServiceErrorRequest; + (void)jsonView; + } + + Aws::Crt::String CauseServiceErrorRequest::GetModelName() const noexcept + { + return Aws::Crt::String("awstest#CauseServiceErrorRequest"); + } + + Aws::Crt::ScopedResource CauseServiceErrorRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), CauseServiceErrorRequest::s_customDeleter); + shape->m_allocator = allocator; + CauseServiceErrorRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void CauseServiceErrorRequest::s_customDeleter(CauseServiceErrorRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + GetAllProductsOperationContext::GetAllProductsOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetAllProductsOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return GetAllProductsResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetAllProductsOperationContext::AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetAllProductsOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllProductsRequest"); + } + + Aws::Crt::String GetAllProductsOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllProductsResponse"); + } + + Aws::Crt::Optional GetAllProductsOperationContext::GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetAllProductsOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("awstest#GetAllProducts"); + } + + std::future GetAllProductsOperation::GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { return GetAllProductsResult(GetOperationResult().get()); }); + } + + GetAllProductsOperation::GetAllProductsOperation( + ClientConnection &connection, + const GetAllProductsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetAllProductsOperation::Activate( + const GetAllProductsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetAllProductsOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + CauseServiceErrorOperationContext::CauseServiceErrorOperationContext( + const EchoTestRpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource CauseServiceErrorOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return CauseServiceErrorResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource CauseServiceErrorOperationContext::AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String CauseServiceErrorOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("awstest#CauseServiceErrorRequest"); + } + + Aws::Crt::String CauseServiceErrorOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("awstest#CauseServiceErrorResponse"); + } + + Aws::Crt::Optional CauseServiceErrorOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String CauseServiceErrorOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("awstest#CauseServiceError"); + } + + std::future CauseServiceErrorOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return CauseServiceErrorResult(GetOperationResult().get()); }); + } + + CauseServiceErrorOperation::CauseServiceErrorOperation( + ClientConnection &connection, + const CauseServiceErrorOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future CauseServiceErrorOperation::Activate( + const CauseServiceErrorRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String CauseServiceErrorOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + void CauseStreamServiceToErrorStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool CauseStreamServiceToErrorStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + if (operationError->GetModelName() == Aws::Crt::String("awstest#ServiceError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + return true; + } + + CauseStreamServiceToErrorOperationContext::CauseStreamServiceToErrorOperationContext( + const EchoTestRpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource CauseStreamServiceToErrorOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return EchoStreamingResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource CauseStreamServiceToErrorOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return EchoStreamingMessage::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String CauseStreamServiceToErrorOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingRequest"); + } + + Aws::Crt::String CauseStreamServiceToErrorOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingResponse"); + } + + Aws::Crt::Optional CauseStreamServiceToErrorOperationContext::GetStreamingResponseModelName() + const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingMessage"); + } + + Aws::Crt::String CauseStreamServiceToErrorOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("awstest#CauseStreamServiceToError"); + } + + std::future CauseStreamServiceToErrorOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return CauseStreamServiceToErrorResult(GetOperationResult().get()); }); + } + + CauseStreamServiceToErrorOperation::CauseStreamServiceToErrorOperation( + ClientConnection &connection, + CauseStreamServiceToErrorStreamHandler *streamHandler, + const CauseStreamServiceToErrorOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future CauseStreamServiceToErrorOperation::Activate( + const EchoStreamingRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String CauseStreamServiceToErrorOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + void EchoStreamMessagesStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool EchoStreamMessagesStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + return true; + } + + EchoStreamMessagesOperationContext::EchoStreamMessagesOperationContext( + const EchoTestRpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource EchoStreamMessagesOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return EchoStreamingResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource EchoStreamMessagesOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return EchoStreamingMessage::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String EchoStreamMessagesOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingRequest"); + } + + Aws::Crt::String EchoStreamMessagesOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamingResponse"); + } + + Aws::Crt::Optional EchoStreamMessagesOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::String("awstest#EchoStreamingMessage"); + } + + Aws::Crt::String EchoStreamMessagesOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("awstest#EchoStreamMessages"); + } + + std::future EchoStreamMessagesOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return EchoStreamMessagesResult(GetOperationResult().get()); }); + } + + EchoStreamMessagesOperation::EchoStreamMessagesOperation( + ClientConnection &connection, + EchoStreamMessagesStreamHandler *streamHandler, + const EchoStreamMessagesOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future EchoStreamMessagesOperation::Activate( + const EchoStreamingRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String EchoStreamMessagesOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + EchoMessageOperationContext::EchoMessageOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource EchoMessageOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return EchoMessageResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource EchoMessageOperationContext::AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String EchoMessageOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoMessageRequest"); + } + + Aws::Crt::String EchoMessageOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("awstest#EchoMessageResponse"); + } + + Aws::Crt::Optional EchoMessageOperationContext::GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String EchoMessageOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("awstest#EchoMessage"); + } + + std::future EchoMessageOperation::GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { return EchoMessageResult(GetOperationResult().get()); }); + } + + EchoMessageOperation::EchoMessageOperation( + ClientConnection &connection, + const EchoMessageOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future EchoMessageOperation::Activate( + const EchoMessageRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String EchoMessageOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GetAllCustomersOperationContext::GetAllCustomersOperationContext( + const EchoTestRpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetAllCustomersOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return GetAllCustomersResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetAllCustomersOperationContext::AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetAllCustomersOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllCustomersRequest"); + } + + Aws::Crt::String GetAllCustomersOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("awstest#GetAllCustomersResponse"); + } + + Aws::Crt::Optional GetAllCustomersOperationContext::GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetAllCustomersOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("awstest#GetAllCustomers"); + } + + std::future GetAllCustomersOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return GetAllCustomersResult(GetOperationResult().get()); }); + } + + GetAllCustomersOperation::GetAllCustomersOperation( + ClientConnection &connection, + const GetAllCustomersOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetAllCustomersOperation::Activate( + const GetAllCustomersRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetAllCustomersOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + EchoTestRpcServiceModel::EchoTestRpcServiceModel() noexcept + : m_getAllProductsOperationContext(*this), m_causeServiceErrorOperationContext(*this), + m_causeStreamServiceToErrorOperationContext(*this), m_echoStreamMessagesOperationContext(*this), + m_echoMessageOperationContext(*this), m_getAllCustomersOperationContext(*this) + { + } + + Aws::Crt::ScopedResource EchoTestRpcServiceModel::AllocateOperationErrorFromPayload( + const Aws::Crt::String &errorModelName, + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + auto it = m_modelNameToErrorResponse.find(errorModelName); + if (it == m_modelNameToErrorResponse.end()) + { + return nullptr; + } + else + { + return it->second(stringView, allocator); + } + } + + void EchoTestRpcServiceModel::AssignModelNameToErrorResponse( + Aws::Crt::String modelName, + ErrorResponseFactory factory) noexcept + { + m_modelNameToErrorResponse[modelName] = factory; + } +} // namespace Awstest diff --git a/eventstream_rpc/tests/EventStreamClientTest.cpp b/eventstream_rpc/tests/EventStreamClientTest.cpp new file mode 100644 index 000000000..a7bf41aa6 --- /dev/null +++ b/eventstream_rpc/tests/EventStreamClientTest.cpp @@ -0,0 +1,527 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include + +#include + +#include + +#include +#include +#include + +using namespace Aws::Crt; +using namespace Aws::Eventstreamrpc; +using namespace Awstest; + +struct EventStreamClientTestContext +{ + std::unique_ptr apiHandle; + std::unique_ptr elGroup; + std::unique_ptr resolver; + std::unique_ptr clientBootstrap; +}; + +static EventStreamClientTestContext s_testContext; + +static int s_testSetup(struct aws_allocator *allocator, void *ctx) +{ + auto *testContext = static_cast(ctx); + + testContext->apiHandle = std::unique_ptr(new ApiHandle(allocator)); + testContext->elGroup = std::unique_ptr(new Io::EventLoopGroup(0, allocator)); + testContext->resolver = + std::unique_ptr(new Io::DefaultHostResolver(*testContext->elGroup, 8, 30, allocator)); + testContext->clientBootstrap = std::unique_ptr( + new Io::ClientBootstrap(*testContext->elGroup, *testContext->resolver, allocator)); + + return AWS_ERROR_SUCCESS; +} + +static int s_testTeardown(struct aws_allocator *allocator, int setup_result, void *ctx) +{ + auto *testContext = static_cast(ctx); + + testContext->elGroup.reset(); + testContext->resolver.reset(); + testContext->clientBootstrap.reset(); + /* The ApiHandle must be deallocated last or a deadlock occurs. */ + testContext->apiHandle.reset(); + + return AWS_ERROR_SUCCESS; +} + +static int s_TestEventStreamConnect(struct aws_allocator *allocator, void *ctx); +static int s_TestEchoOperation(struct aws_allocator *allocator, void *ctx); +static int s_TestOperationWhileDisconnected(struct aws_allocator *allocator, void *ctx); + +class TestLifecycleHandler : public ConnectionLifecycleHandler +{ + public: + TestLifecycleHandler() + { + semaphoreULock = std::unique_lock(semaphoreLock); + isConnected = false; + lastErrorCode = AWS_OP_ERR; + } + + void OnConnectCallback() override + { + std::lock_guard lockGuard(semaphoreLock); + + isConnected = true; + + semaphore.notify_one(); + } + + void OnDisconnectCallback(int errorCode) override + { + std::lock_guard lockGuard(semaphoreLock); + + lastErrorCode = errorCode; + + semaphore.notify_one(); + } + + void WaitOnCondition(std::function condition) { semaphore.wait(semaphoreULock, condition); } + + private: + friend int s_TestEventStreamConnect(struct aws_allocator *allocator, void *ctx); + std::condition_variable semaphore; + std::mutex semaphoreLock; + std::unique_lock semaphoreULock; + int isConnected; + int lastErrorCode; +}; + +static void s_onMessageFlush(int errorCode) +{ + (void)errorCode; +} + +AWS_TEST_CASE_FIXTURE(EventStreamConnect, s_testSetup, s_TestEventStreamConnect, s_testTeardown, &s_testContext); +static int s_TestEventStreamConnect(struct aws_allocator *allocator, void *ctx) +{ + auto *testContext = static_cast(ctx); + + { + MessageAmendment connectionAmendment; + auto messageAmender = [&](void) -> const MessageAmendment & { return connectionAmendment; }; + + ConnectionConfig accessDeniedConfig; + accessDeniedConfig.SetHostName(Aws::Crt::String("127.0.0.1")); + accessDeniedConfig.SetPort(8033U); + + /* Happy path case. */ + { + ConnectionLifecycleHandler lifecycleHandler; + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + client.Close(); + } + + /* Empty amendment headers. */ + { + TestLifecycleHandler lifecycleHandler; + ClientConnection connection(allocator); + auto future = connection.Connect(accessDeniedConfig, &lifecycleHandler, *testContext->clientBootstrap); + ASSERT_TRUE(future.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED); + } + + /* Rejected client-name header. */ + { + TestLifecycleHandler lifecycleHandler; + ClientConnection connection(allocator); + connectionAmendment.AddHeader(EventStreamHeader( + Aws::Crt::String("client-name"), Aws::Crt::String("rejected.testy_mc_testerson"), allocator)); + auto future = connection.Connect(accessDeniedConfig, &lifecycleHandler, *testContext->clientBootstrap); + ASSERT_TRUE(future.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED); + } + + /* Connect without taking its future then immediately close. */ + { + ConnectionLifecycleHandler lifecycleHandler; + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + client.Close(); + client.Close(); + ASSERT_FALSE(client.IsConnected()); + } + } + + return AWS_OP_SUCCESS; +} + +AWS_TEST_CASE_FIXTURE( + OperateWhileDisconnected, + s_testSetup, + s_TestOperationWhileDisconnected, + s_testTeardown, + &s_testContext); +static int s_TestOperationWhileDisconnected(struct aws_allocator *allocator, void *ctx) +{ + auto *testContext = static_cast(ctx); + + /* Don't connect at all and try running operations as normal. */ + { + ConnectionLifecycleHandler lifecycleHandler; + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto echoMessage = client.NewEchoMessage(); + EchoMessageRequest echoMessageRequest; + MessageData messageData; + Aws::Crt::String expectedMessage("l33t"); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + ASSERT_TRUE(requestFuture.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_CLOSED); + auto result = echoMessage.GetOperationResult().get(); + ASSERT_FALSE(result); + auto error = result.GetRpcError(); + ASSERT_TRUE(error.baseStatus == EVENT_STREAM_RPC_CONNECTION_CLOSED); + } + + /* Idempotent close and its safety. */ + { + ConnectionLifecycleHandler lifecycleHandler; + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + client.Close(); + client.Close(); + } + + return AWS_OP_SUCCESS; +} + +AWS_TEST_CASE_FIXTURE(EchoOperation, s_testSetup, s_TestEchoOperation, s_testTeardown, &s_testContext); +static int s_TestEchoOperation(struct aws_allocator *allocator, void *ctx) +{ + auto *testContext = static_cast(ctx); + ConnectionLifecycleHandler lifecycleHandler; + Aws::Crt::String expectedMessage("Async I0 FTW"); + EchoMessageRequest echoMessageRequest; + MessageData messageData; + messageData.SetStringMessage(expectedMessage); + + /* Perform a regular echo operation. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + auto echoMessage = client.NewEchoMessage(); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + auto result = echoMessage.GetResult().get(); + ASSERT_TRUE(result); + auto response = result.GetOperationResponse(); + ASSERT_NOT_NULL(response); + ASSERT_TRUE(response->GetMessage().value().GetStringMessage().value() == expectedMessage); + } + + /* Attempt a connection, close it, then try running operations as normal. */ + { + ConnectionLifecycleHandler lifecycleHandler; + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + client.Close(); + auto echoMessage = client.NewEchoMessage(); + EchoMessageRequest echoMessageRequest; + MessageData messageData; + Aws::Crt::String expectedMessage("l33t"); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + ASSERT_TRUE(requestFuture.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_CLOSED); + auto result = echoMessage.GetOperationResult().get(); + ASSERT_FALSE(result); + auto error = result.GetRpcError(); + ASSERT_TRUE(error.baseStatus == EVENT_STREAM_RPC_CONNECTION_CLOSED); + } + + /* Perform a regular echo operation but one after another without waiting. + * Only the response from the first operation will be received. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + auto echoMessage = client.NewEchoMessage(); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + MessageData differentMessage; + differentMessage.SetBooleanMessage(true); + echoMessageRequest.SetMessage(differentMessage); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + auto result = echoMessage.GetResult().get(); + ASSERT_TRUE(result); + auto response = result.GetOperationResponse(); + ASSERT_NOT_NULL(response); + ASSERT_TRUE(response->GetMessage().value().GetStringMessage().value() == expectedMessage); + } + + /* Closing the stream should be idempotent. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + auto echoMessage = client.NewEchoMessage(); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + MessageData differentMessage; + differentMessage.SetBooleanMessage(true); + echoMessageRequest.SetMessage(differentMessage); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + echoMessage.Close().wait(); + echoMessage.Close().wait(); + echoMessage.Close().wait(); + echoMessage.Close().wait(); + } + + /* Close without waiting on activation or close futures. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + auto echoMessage = client.NewEchoMessage(); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + MessageData differentMessage; + differentMessage.SetBooleanMessage(true); + echoMessageRequest.SetMessage(differentMessage); + echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + echoMessage.Close(); + echoMessage.Close(); + echoMessage.Close(); + echoMessage.Close(); + } + + /* Close without waiting for TERMINATE_STREAM to flush then immediately trying to activate. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + auto echoMessage = client.NewEchoMessage(); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + MessageData differentMessage; + differentMessage.SetBooleanMessage(true); + echoMessageRequest.SetMessage(differentMessage); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + auto closeFuture = echoMessage.Close(); + requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + closeFuture.wait(); + requestFuture.wait(); + } + + /* Connect thrice and verify that the future of the first attempt succeeds. + * The rest of the attempts must fail with an error. + * Use the client to perform an operation and verify that the operation still succeeds. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + auto failedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(failedStatus.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED); + failedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + ASSERT_TRUE(failedStatus.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED); + auto echoMessage = client.NewEchoMessage(); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + auto result = echoMessage.GetResult().get(); + ASSERT_TRUE(result); + auto response = result.GetOperationResponse(); + ASSERT_NOT_NULL(response); + ASSERT_TRUE(response->GetMessage().value().GetStringMessage().value() == expectedMessage); + } + + /* Connect twice sequentially. + * Use the client to perform an operation and verify that the operation still succeeds. */ + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED); + auto echoMessage = client.NewEchoMessage(); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + auto result = echoMessage.GetResult().get(); + ASSERT_TRUE(result); + auto response = result.GetOperationResponse(); + ASSERT_NOT_NULL(response); + ASSERT_TRUE(response->GetMessage().value().GetStringMessage().value() == expectedMessage); + } + + return AWS_OP_SUCCESS; +} + +class ThreadPool +{ + public: + ThreadPool(int numThreads = std::thread::hardware_concurrency()) noexcept + : m_numThreads(numThreads), m_stopped(false) + { + m_terminatePool = false; + for (int i = 0; i < numThreads; i++) + { + m_threadPool.push_back(std::thread(&ThreadPool::TaskConsumer, this)); + } + m_taskErrorCode = AWS_OP_SUCCESS; + } + + void AddTask(std::function task) noexcept + { + { + std::unique_lock lock(m_queueMutex); + m_queue.push(task); + } + m_taskReady.notify_one(); + } + + void Shutdown() noexcept + { + { + std::unique_lock lock(m_poolMutex); + m_terminatePool = true; + } + + /* Wake up all threads so that they can complete. */ + m_taskReady.notify_all(); + + /* Wait for all threads to complete. */ + for (std::thread &thread : m_threadPool) + { + thread.join(); + } + + m_threadPool.clear(); + m_stopped = true; + } + + void BlockUntilTasksFinish() noexcept + { + while (true) + { + if (m_queueMutex.try_lock()) + { + if (m_queue.empty()) + { + m_queueMutex.unlock(); + break; + } + else + { + m_queueMutex.unlock(); + std::this_thread::yield(); + } + } + } + } + + int GetErrorCode() noexcept { return m_taskErrorCode; } + + ~ThreadPool() noexcept + { + if (!m_stopped) + Shutdown(); + } + + private: + int m_numThreads; + std::mutex m_poolMutex; + std::vector m_threadPool; + std::mutex m_queueMutex; + std::queue> m_queue; + std::condition_variable m_taskReady; + bool m_terminatePool; + int m_taskErrorCode; + bool m_stopped; + + void TaskConsumer() + { + while (true) + { + { + std::unique_lock lock(m_queueMutex); + + m_taskReady.wait(lock, [this] { return !m_queue.empty() || m_terminatePool; }); + if (!m_queue.empty()) + { + std::function currentJob = m_queue.front(); + if (currentJob) + { + int errorCode = currentJob(); + if (errorCode) + m_taskErrorCode = errorCode; + } + m_queue.pop(); + } + if (m_terminatePool) + { + break; + } + } + } + } +}; + +AWS_TEST_CASE_FIXTURE(StressTestClient, s_testSetup, s_TestStressClient, s_testTeardown, &s_testContext); +static int s_TestStressClient(struct aws_allocator *allocator, void *ctx) +{ + auto *testContext = static_cast(ctx); + ThreadPool threadPool; + ConnectionLifecycleHandler lifecycleHandler; + Aws::Crt::String expectedMessage("Async I0 FTW"); + EchoMessageRequest echoMessageRequest; + MessageData messageData; + messageData.SetStringMessage(expectedMessage); + + { + Awstest::EchoTestRpcClient client(*testContext->clientBootstrap, allocator); + auto connectedStatus = client.Connect(lifecycleHandler); + ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS); + auto invokeOperation = [&](void) -> int { + auto echoMessage = client.NewEchoMessage(); + messageData.SetStringMessage(expectedMessage); + echoMessageRequest.SetMessage(messageData); + auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); + requestFuture.wait(); + auto result = echoMessage.GetResult().get(); + ASSERT_TRUE(result); + auto response = result.GetOperationResponse(); + ASSERT_NOT_NULL(response); + ASSERT_TRUE(response->GetMessage().value().GetStringMessage().value() == expectedMessage); + + return AWS_OP_SUCCESS; + }; + + for (int i = 0; i < 100; i++) + threadPool.AddTask(invokeOperation); + + threadPool.BlockUntilTasksFinish(); + + if (threadPool.GetErrorCode() != AWS_OP_SUCCESS) + return threadPool.GetErrorCode(); + } + + return AWS_OP_SUCCESS; +} diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h new file mode 100644 index 000000000..188823567 --- /dev/null +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h @@ -0,0 +1,48 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* This file is generated. */ + +#include + +using namespace Aws::Eventstreamrpc; + +namespace Awstest +{ + class DefaultConnectionConfig : public ConnectionConfig + { + public: + DefaultConnectionConfig() noexcept; + }; + + class EchoTestRpcClient + { + public: + EchoTestRpcClient( + Aws::Crt::Io::ClientBootstrap &clientBootstrap, + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + std::future Connect( + ConnectionLifecycleHandler &lifecycleHandler, + const ConnectionConfig &connectionConfig = DefaultConnectionConfig()) noexcept; + bool IsConnected() const noexcept { return m_connection.IsOpen(); } + void Close() noexcept; + GetAllProductsOperation NewGetAllProducts() noexcept; + CauseServiceErrorOperation NewCauseServiceError() noexcept; + CauseStreamServiceToErrorOperation NewCauseStreamServiceToError( + CauseStreamServiceToErrorStreamHandler &) noexcept; + EchoStreamMessagesOperation NewEchoStreamMessages(EchoStreamMessagesStreamHandler &) noexcept; + EchoMessageOperation NewEchoMessage() noexcept; + GetAllCustomersOperation NewGetAllCustomers() noexcept; + ~EchoTestRpcClient() noexcept; + + private: + EchoTestRpcServiceModel m_echoTestRpcServiceModel; + ClientConnection m_connection; + Aws::Crt::Io::ClientBootstrap &m_clientBootstrap; + Aws::Crt::Allocator *m_allocator; + MessageAmendment m_connectAmendment; + }; +} // namespace Awstest diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h new file mode 100644 index 000000000..e97003756 --- /dev/null +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h @@ -0,0 +1,871 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* This file is generated. */ + +#include + +#include +#include + +using namespace Aws::Eventstreamrpc; + +namespace Awstest +{ + class EchoTestRpcClient; + class EchoTestRpcServiceModel; + class Product : public AbstractShapeBase + { + public: + Product() noexcept {} + Product(const Product &) = default; + void SetName(const Aws::Crt::String &name) noexcept { m_name = name; } + Aws::Crt::Optional GetName() noexcept { return m_name; } + void SetPrice(const float &price) noexcept { m_price = price; } + Aws::Crt::Optional GetPrice() noexcept { return m_price; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(Product &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(Product *) noexcept; + /* This needs to be defined so that `Product` can be used as a key in maps. */ + bool operator<(const Product &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_name; + Aws::Crt::Optional m_price; + }; + + class Customer : public AbstractShapeBase + { + public: + Customer() noexcept {} + Customer(const Customer &) = default; + void SetId(const int64_t &id) noexcept { m_id = id; } + Aws::Crt::Optional GetId() noexcept { return m_id; } + void SetFirstName(const Aws::Crt::String &firstName) noexcept { m_firstName = firstName; } + Aws::Crt::Optional GetFirstName() noexcept { return m_firstName; } + void SetLastName(const Aws::Crt::String &lastName) noexcept { m_lastName = lastName; } + Aws::Crt::Optional GetLastName() noexcept { return m_lastName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(Customer &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(Customer *) noexcept; + /* This needs to be defined so that `Customer` can be used as a key in maps. */ + bool operator<(const Customer &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_id; + Aws::Crt::Optional m_firstName; + Aws::Crt::Optional m_lastName; + }; + + enum FruitEnum + { + FRUIT_ENUM_APPLE, + FRUIT_ENUM_ORANGE, + FRUIT_ENUM_BANANA, + FRUIT_ENUM_PINEAPPLE + }; + + class Pair : public AbstractShapeBase + { + public: + Pair() noexcept {} + Pair(const Pair &) = default; + void SetKey(const Aws::Crt::String &key) noexcept { m_key = key; } + Aws::Crt::Optional GetKey() noexcept { return m_key; } + void SetValue(const Aws::Crt::String &value) noexcept { m_value = value; } + Aws::Crt::Optional GetValue() noexcept { return m_value; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(Pair &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(Pair *) noexcept; + /* This needs to be defined so that `Pair` can be used as a key in maps. */ + bool operator<(const Pair &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_key; + Aws::Crt::Optional m_value; + }; + + class MessageData : public AbstractShapeBase + { + public: + MessageData() noexcept {} + MessageData(const MessageData &) = default; + void SetStringMessage(const Aws::Crt::String &stringMessage) noexcept { m_stringMessage = stringMessage; } + Aws::Crt::Optional GetStringMessage() noexcept { return m_stringMessage; } + void SetBooleanMessage(const bool &booleanMessage) noexcept { m_booleanMessage = booleanMessage; } + Aws::Crt::Optional GetBooleanMessage() noexcept { return m_booleanMessage; } + void SetTimeMessage(const Aws::Crt::DateTime &timeMessage) noexcept { m_timeMessage = timeMessage; } + Aws::Crt::Optional GetTimeMessage() noexcept { return m_timeMessage; } + void SetDocumentMessage(const Aws::Crt::JsonObject &documentMessage) noexcept + { + m_documentMessage = documentMessage; + } + Aws::Crt::Optional GetDocumentMessage() noexcept { return m_documentMessage; } + void SetEnumMessage(FruitEnum enumMessage) noexcept; + Aws::Crt::Optional GetEnumMessage() noexcept; + void SetBlobMessage(const Aws::Crt::Vector &blobMessage) noexcept { m_blobMessage = blobMessage; } + Aws::Crt::Optional> GetBlobMessage() noexcept { return m_blobMessage; } + void SetStringListMessage(const Aws::Crt::Vector &stringListMessage) noexcept + { + m_stringListMessage = stringListMessage; + } + Aws::Crt::Optional> GetStringListMessage() noexcept + { + return m_stringListMessage; + } + void SetKeyValuePairList(const Aws::Crt::Vector &keyValuePairList) noexcept + { + m_keyValuePairList = keyValuePairList; + } + Aws::Crt::Optional> GetKeyValuePairList() noexcept { return m_keyValuePairList; } + void SetStringToValue(const Aws::Crt::Map &stringToValue) noexcept + { + m_stringToValue = stringToValue; + } + Aws::Crt::Optional> GetStringToValue() noexcept + { + return m_stringToValue; + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(MessageData &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(MessageData *) noexcept; + /* This needs to be defined so that `MessageData` can be used as a key in maps. */ + bool operator<(const MessageData &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_stringMessage; + Aws::Crt::Optional m_booleanMessage; + Aws::Crt::Optional m_timeMessage; + Aws::Crt::Optional m_documentMessage; + Aws::Crt::Optional m_enumMessage; + Aws::Crt::Optional> m_blobMessage; + Aws::Crt::Optional> m_stringListMessage; + Aws::Crt::Optional> m_keyValuePairList; + Aws::Crt::Optional> m_stringToValue; + }; + + class EchoStreamingMessage : public AbstractShapeBase + { + public: + EchoStreamingMessage() noexcept {} + EchoStreamingMessage &operator=(const EchoStreamingMessage &) noexcept; + EchoStreamingMessage(const EchoStreamingMessage &objectToCopy) { *this = objectToCopy; } + void SetStreamMessage(const MessageData &streamMessage) noexcept + { + m_streamMessage = streamMessage; + m_chosenMember = TAG_STREAM_MESSAGE; + } + Aws::Crt::Optional GetStreamMessage() noexcept + { + if (m_chosenMember == TAG_STREAM_MESSAGE) + { + return m_streamMessage; + } + else + { + return Aws::Crt::Optional(); + } + } + void SetKeyValuePair(const Pair &keyValuePair) noexcept + { + m_keyValuePair = keyValuePair; + m_chosenMember = TAG_KEY_VALUE_PAIR; + } + Aws::Crt::Optional GetKeyValuePair() noexcept + { + if (m_chosenMember == TAG_KEY_VALUE_PAIR) + { + return m_keyValuePair; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(EchoStreamingMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(EchoStreamingMessage *) noexcept; + /* This needs to be defined so that `EchoStreamingMessage` can be used as a key in maps. */ + bool operator<(const EchoStreamingMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_STREAM_MESSAGE, + TAG_KEY_VALUE_PAIR + } m_chosenMember; + Aws::Crt::Optional m_streamMessage; + Aws::Crt::Optional m_keyValuePair; + }; + + class GetAllProductsResponse : public AbstractShapeBase + { + public: + GetAllProductsResponse() noexcept {} + GetAllProductsResponse(const GetAllProductsResponse &) = default; + void SetProducts(const Aws::Crt::Map &products) noexcept { m_products = products; } + Aws::Crt::Optional> GetProducts() noexcept { return m_products; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetAllProductsResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetAllProductsResponse *) noexcept; + /* This needs to be defined so that `GetAllProductsResponse` can be used as a key in maps. */ + bool operator<(const GetAllProductsResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_products; + }; + + class GetAllProductsRequest : public AbstractShapeBase + { + public: + GetAllProductsRequest() noexcept {} + GetAllProductsRequest(const GetAllProductsRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetAllProductsRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetAllProductsRequest *) noexcept; + /* This needs to be defined so that `GetAllProductsRequest` can be used as a key in maps. */ + bool operator<(const GetAllProductsRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class GetAllCustomersResponse : public AbstractShapeBase + { + public: + GetAllCustomersResponse() noexcept {} + GetAllCustomersResponse(const GetAllCustomersResponse &) = default; + void SetCustomers(const Aws::Crt::Vector &customers) noexcept { m_customers = customers; } + Aws::Crt::Optional> GetCustomers() noexcept { return m_customers; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetAllCustomersResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetAllCustomersResponse *) noexcept; + /* This needs to be defined so that `GetAllCustomersResponse` can be used as a key in maps. */ + bool operator<(const GetAllCustomersResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_customers; + }; + + class GetAllCustomersRequest : public AbstractShapeBase + { + public: + GetAllCustomersRequest() noexcept {} + GetAllCustomersRequest(const GetAllCustomersRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetAllCustomersRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetAllCustomersRequest *) noexcept; + /* This needs to be defined so that `GetAllCustomersRequest` can be used as a key in maps. */ + bool operator<(const GetAllCustomersRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class EchoMessageResponse : public AbstractShapeBase + { + public: + EchoMessageResponse() noexcept {} + EchoMessageResponse(const EchoMessageResponse &) = default; + void SetMessage(const MessageData &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(EchoMessageResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(EchoMessageResponse *) noexcept; + /* This needs to be defined so that `EchoMessageResponse` can be used as a key in maps. */ + bool operator<(const EchoMessageResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class EchoMessageRequest : public AbstractShapeBase + { + public: + EchoMessageRequest() noexcept {} + EchoMessageRequest(const EchoMessageRequest &) = default; + void SetMessage(const MessageData &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(EchoMessageRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(EchoMessageRequest *) noexcept; + /* This needs to be defined so that `EchoMessageRequest` can be used as a key in maps. */ + bool operator<(const EchoMessageRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class EchoStreamingResponse : public AbstractShapeBase + { + public: + EchoStreamingResponse() noexcept {} + EchoStreamingResponse(const EchoStreamingResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(EchoStreamingResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(EchoStreamingResponse *) noexcept; + /* This needs to be defined so that `EchoStreamingResponse` can be used as a key in maps. */ + bool operator<(const EchoStreamingResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class EchoStreamingRequest : public AbstractShapeBase + { + public: + EchoStreamingRequest() noexcept {} + EchoStreamingRequest(const EchoStreamingRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(EchoStreamingRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(EchoStreamingRequest *) noexcept; + /* This needs to be defined so that `EchoStreamingRequest` can be used as a key in maps. */ + bool operator<(const EchoStreamingRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class ServiceError : public OperationError + { + public: + ServiceError() noexcept {} + ServiceError(const ServiceError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SetValue(const Aws::Crt::String &value) noexcept { m_value = value; } + Aws::Crt::Optional GetValue() noexcept { return m_value; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ServiceError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ServiceError *) noexcept; + /* This needs to be defined so that `ServiceError` can be used as a key in maps. */ + bool operator<(const ServiceError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + Aws::Crt::Optional m_value; + }; + + class CauseServiceErrorResponse : public AbstractShapeBase + { + public: + CauseServiceErrorResponse() noexcept {} + CauseServiceErrorResponse(const CauseServiceErrorResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(CauseServiceErrorResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(CauseServiceErrorResponse *) noexcept; + /* This needs to be defined so that `CauseServiceErrorResponse` can be used as a key in maps. */ + bool operator<(const CauseServiceErrorResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class CauseServiceErrorRequest : public AbstractShapeBase + { + public: + CauseServiceErrorRequest() noexcept {} + CauseServiceErrorRequest(const CauseServiceErrorRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(CauseServiceErrorRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(CauseServiceErrorRequest *) noexcept; + /* This needs to be defined so that `CauseServiceErrorRequest` can be used as a key in maps. */ + bool operator<(const CauseServiceErrorRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class GetAllProductsOperationContext : public OperationModelContext + { + public: + GetAllProductsOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetAllProductsResult + { + public: + GetAllProductsResult() noexcept {} + GetAllProductsResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + GetAllProductsResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetAllProductsOperation : public ClientOperation + { + public: + GetAllProductsOperation( + ClientConnection &connection, + const GetAllProductsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetAllProductsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class CauseServiceErrorOperationContext : public OperationModelContext + { + public: + CauseServiceErrorOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class CauseServiceErrorResult + { + public: + CauseServiceErrorResult() noexcept {} + CauseServiceErrorResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + CauseServiceErrorResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class CauseServiceErrorOperation : public ClientOperation + { + public: + CauseServiceErrorOperation( + ClientConnection &connection, + const CauseServiceErrorOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const CauseServiceErrorRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class CauseStreamServiceToErrorStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(EchoStreamingMessage *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class CauseStreamServiceToErrorOperationContext : public OperationModelContext + { + public: + CauseStreamServiceToErrorOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class CauseStreamServiceToErrorResult + { + public: + CauseStreamServiceToErrorResult() noexcept {} + CauseStreamServiceToErrorResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) + { + } + EchoStreamingResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class CauseStreamServiceToErrorOperation : public ClientOperation + { + public: + CauseStreamServiceToErrorOperation( + ClientConnection &connection, + CauseStreamServiceToErrorStreamHandler *streamHandler, + const CauseStreamServiceToErrorOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const EchoStreamingRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class EchoStreamMessagesStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(EchoStreamingMessage *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class EchoStreamMessagesOperationContext : public OperationModelContext + { + public: + EchoStreamMessagesOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class EchoStreamMessagesResult + { + public: + EchoStreamMessagesResult() noexcept {} + EchoStreamMessagesResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + EchoStreamingResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class EchoStreamMessagesOperation : public ClientOperation + { + public: + EchoStreamMessagesOperation( + ClientConnection &connection, + EchoStreamMessagesStreamHandler *streamHandler, + const EchoStreamMessagesOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const EchoStreamingRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class EchoMessageOperationContext : public OperationModelContext + { + public: + EchoMessageOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class EchoMessageResult + { + public: + EchoMessageResult() noexcept {} + EchoMessageResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + EchoMessageResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class EchoMessageOperation : public ClientOperation + { + public: + EchoMessageOperation( + ClientConnection &connection, + const EchoMessageOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const EchoMessageRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GetAllCustomersOperationContext : public OperationModelContext + { + public: + GetAllCustomersOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetAllCustomersResult + { + public: + GetAllCustomersResult() noexcept {} + GetAllCustomersResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + GetAllCustomersResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetAllCustomersOperation : public ClientOperation + { + public: + GetAllCustomersOperation( + ClientConnection &connection, + const GetAllCustomersOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetAllCustomersRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class EchoTestRpcServiceModel : public ServiceModel + { + public: + EchoTestRpcServiceModel() noexcept; + Aws::Crt::ScopedResource AllocateOperationErrorFromPayload( + const Aws::Crt::String &errorModelName, + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + void AssignModelNameToErrorResponse(Aws::Crt::String, ErrorResponseFactory) noexcept; + + private: + friend class EchoTestRpcClient; + GetAllProductsOperationContext m_getAllProductsOperationContext; + CauseServiceErrorOperationContext m_causeServiceErrorOperationContext; + CauseStreamServiceToErrorOperationContext m_causeStreamServiceToErrorOperationContext; + EchoStreamMessagesOperationContext m_echoStreamMessagesOperationContext; + EchoMessageOperationContext m_echoMessageOperationContext; + GetAllCustomersOperationContext m_getAllCustomersOperationContext; + Aws::Crt::Map m_modelNameToErrorResponse; + }; +} // namespace Awstest diff --git a/eventstream_rpc/tests/include/awstest/Exports.h b/eventstream_rpc/tests/include/awstest/Exports.h new file mode 100644 index 000000000..f23d7fab2 --- /dev/null +++ b/eventstream_rpc/tests/include/awstest/Exports.h @@ -0,0 +1,20 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#if defined(AWS_ECHOTESTRPC_USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) +# ifdef AWS_ECHOTESTRPC_USE_IMPORT_EXPORT +# ifdef AWS_ECHOTESTRPC_EXPORTS +# define AWS_ECHOTESTRPC_API __declspec(dllexport) +# else +# define AWS_ECHOTESTRPC_API __declspec(dllimport) +# endif /* AWS_ECHOTESTRPC_EXPORTS */ +# else +# define AWS_ECHOTESTRPC_API +# endif /* AWS_ECHOTESTRPC_USE_IMPORT_EXPORT */ + +#else /* defined (AWS_ECHOTESTRPC_USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ +# define AWS_ECHOTESTRPC_API +#endif /* defined (AWS_ECHOTESTRPC__USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ diff --git a/greengrass_ipc/CMakeLists.txt b/greengrass_ipc/CMakeLists.txt new file mode 100644 index 000000000..679784d34 --- /dev/null +++ b/greengrass_ipc/CMakeLists.txt @@ -0,0 +1,120 @@ +cmake_minimum_required(VERSION 3.1) +project(GreengrassIpc-cpp CXX) + +set(RUNTIME_DIRECTORY bin) + +if (UNIX AND NOT APPLE) + include(GNUInstallDirs) +elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + + if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") + set(FIND_LIBRARY_USE_LIB64_PATHS true) + endif() +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") + +if (NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() + +file(GLOB AWS_GREENGRASSIPC_HEADERS + "include/aws/greengrass/*.h" +) + +file(GLOB AWS_GREENGRASSIPC_SRC + "source/*.cpp" +) + +file(GLOB AWS_GREENGRASSIPC_CPP_SRC + ${AWS_GREENGRASSIPC_SRC} +) + +if (WIN32) + if (MSVC) + source_group("Header Files\\aws\\greengrass\\" FILES ${AWS_GREENGRASSIPC_HEADERS}) + + source_group("Source Files" FILES ${AWS_GREENGRASSIPC_SRC}) + endif () +endif() + +add_library(GreengrassIpc-cpp ${AWS_GREENGRASSIPC_CPP_SRC}) +target_link_libraries(GreengrassIpc-cpp EventstreamRpc-cpp) + +set_target_properties(GreengrassIpc-cpp PROPERTIES LINKER_LANGUAGE CXX) + +set(CMAKE_C_FLAGS_DEBUGOPT "") + +#set warnings +if (MSVC) + target_compile_options(GreengrassIpc-cpp PRIVATE /W4 /WX) +else () + target_compile_options(GreengrassIpc-cpp PRIVATE -Wall -Wno-long-long -pedantic -Werror) +endif () + +if (CMAKE_BUILD_TYPE STREQUAL "" OR CMAKE_BUILD_TYPE MATCHES Debug) + target_compile_definitions(GreengrassIpc-cpp PRIVATE "-DDEBUG_BUILD") +endif () + +if (BUILD_SHARED_LIBS) + target_compile_definitions(GreengrassIpc-cpp PUBLIC "-DAWS_GREENGRASSIPC_USE_IMPORT_EXPORT") + target_compile_definitions(GreengrassIpc-cpp PRIVATE "-DAWS_GREENGRASSIPC_EXPORTS") + + install(TARGETS GreengrassIpc-cpp + EXPORT GreengrassIpc-cpp-targets + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + NAMELINK_SKIP + COMPONENT Runtime + RUNTIME + DESTINATION ${RUNTIME_DIRECTORY} + COMPONENT Runtime) + + install(TARGETS GreengrassIpc-cpp + EXPORT GreengrassIpc-cpp-targets + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + NAMELINK_ONLY + COMPONENT Development) +else() + install(TARGETS GreengrassIpc-cpp + EXPORT GreengrassIpc-cpp-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Development) +endif() + +target_include_directories(GreengrassIpc-cpp PUBLIC + $ + $) + +if (NOT IS_SUBDIRECTORY_INCLUDE) + aws_use_package(aws-crt-cpp) +endif() + + +target_link_libraries(GreengrassIpc-cpp ${DEP_AWS_LIBS}) + +install(FILES ${AWS_GREENGRASSIPC_HEADERS} DESTINATION "include/aws/greengrass/" COMPONENT Development) + +if (BUILD_SHARED_LIBS) + set(TARGET_DIR "shared") +else() + set(TARGET_DIR "static") +endif() + +install(EXPORT "GreengrassIpc-cpp-targets" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/GreengrassIpc-cpp/cmake/${TARGET_DIR}" + NAMESPACE AWS:: + COMPONENT Development) + +configure_file("cmake/greengrassipc-cpp-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/greengrassipc-cpp-config.cmake" + @ONLY) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/greengrassipc-cpp-config.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/GreengrassIpc-cpp/cmake/" + COMPONENT Development) diff --git a/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake b/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake new file mode 100644 index 000000000..8e68cfbfe --- /dev/null +++ b/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake @@ -0,0 +1,9 @@ +include(CMakeFindDependencyMacro) + +find_dependency(aws-crt-cpp) + +if (BUILD_SHARED_LIBS) + include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +else() + include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +endif() diff --git a/greengrass_ipc/include/aws/greengrass/Exports.h b/greengrass_ipc/include/aws/greengrass/Exports.h new file mode 100644 index 000000000..2ffa1af23 --- /dev/null +++ b/greengrass_ipc/include/aws/greengrass/Exports.h @@ -0,0 +1,20 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#if defined(AWS_GREENGRASSIPC_USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) +# ifdef AWS_GREENGRASSIPC_USE_IMPORT_EXPORT +# ifdef AWS_GREENGRASSIPC_EXPORTS +# define AWS_GREENGRASSIPC_API __declspec(dllexport) +# else +# define AWS_GREENGRASSIPC_API __declspec(dllimport) +# endif /* AWS_GREENGRASSIPC_EXPORTS */ +# else +# define AWS_GREENGRASSIPC_API +# endif /* AWS_GREENGRASSIPC_USE_IMPORT_EXPORT */ + +#else /* defined (AWS_GREENGRASSIPC_USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ +# define AWS_GREENGRASSIPC_API +#endif /* defined (AWS_GREENGRASSIPC__USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h new file mode 100644 index 000000000..36a9cab9d --- /dev/null +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h @@ -0,0 +1,73 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* This file is generated. */ + +#include + +using namespace Aws::Eventstreamrpc; + +namespace Aws +{ + namespace Greengrass + { + class DefaultConnectionConfig : public ConnectionConfig + { + public: + DefaultConnectionConfig() noexcept; + }; + + class GreengrassCoreIpcClient + { + public: + GreengrassCoreIpcClient( + Aws::Crt::Io::ClientBootstrap &clientBootstrap, + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + std::future Connect( + ConnectionLifecycleHandler &lifecycleHandler, + const ConnectionConfig &connectionConfig = DefaultConnectionConfig()) noexcept; + bool IsConnected() const noexcept { return m_connection.IsOpen(); } + void Close() noexcept; + SubscribeToIoTCoreOperation NewSubscribeToIoTCore(SubscribeToIoTCoreStreamHandler &) noexcept; + PublishToIoTCoreOperation NewPublishToIoTCore() noexcept; + SubscribeToConfigurationUpdateOperation NewSubscribeToConfigurationUpdate( + SubscribeToConfigurationUpdateStreamHandler &) noexcept; + DeleteThingShadowOperation NewDeleteThingShadow() noexcept; + DeferComponentUpdateOperation NewDeferComponentUpdate() noexcept; + SubscribeToValidateConfigurationUpdatesOperation NewSubscribeToValidateConfigurationUpdates( + SubscribeToValidateConfigurationUpdatesStreamHandler &) noexcept; + GetConfigurationOperation NewGetConfiguration() noexcept; + SubscribeToTopicOperation NewSubscribeToTopic(SubscribeToTopicStreamHandler &) noexcept; + GetComponentDetailsOperation NewGetComponentDetails() noexcept; + PublishToTopicOperation NewPublishToTopic() noexcept; + ListComponentsOperation NewListComponents() noexcept; + CreateDebugPasswordOperation NewCreateDebugPassword() noexcept; + GetThingShadowOperation NewGetThingShadow() noexcept; + SendConfigurationValidityReportOperation NewSendConfigurationValidityReport() noexcept; + UpdateThingShadowOperation NewUpdateThingShadow() noexcept; + UpdateConfigurationOperation NewUpdateConfiguration() noexcept; + ValidateAuthorizationTokenOperation NewValidateAuthorizationToken() noexcept; + RestartComponentOperation NewRestartComponent() noexcept; + GetLocalDeploymentStatusOperation NewGetLocalDeploymentStatus() noexcept; + GetSecretValueOperation NewGetSecretValue() noexcept; + UpdateStateOperation NewUpdateState() noexcept; + ListNamedShadowsForThingOperation NewListNamedShadowsForThing() noexcept; + SubscribeToComponentUpdatesOperation NewSubscribeToComponentUpdates( + SubscribeToComponentUpdatesStreamHandler &) noexcept; + ListLocalDeploymentsOperation NewListLocalDeployments() noexcept; + StopComponentOperation NewStopComponent() noexcept; + CreateLocalDeploymentOperation NewCreateLocalDeployment() noexcept; + ~GreengrassCoreIpcClient() noexcept; + + private: + GreengrassCoreIpcServiceModel m_greengrassCoreIpcServiceModel; + ClientConnection m_connection; + Aws::Crt::Io::ClientBootstrap &m_clientBootstrap; + Aws::Crt::Allocator *m_allocator; + MessageAmendment m_connectAmendment; + }; + } // namespace Greengrass +} // namespace Aws diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h new file mode 100644 index 000000000..f6f57a991 --- /dev/null +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h @@ -0,0 +1,3967 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +/* This file is generated. */ + +#include + +#include +#include + +using namespace Aws::Eventstreamrpc; + +namespace Aws +{ + namespace Greengrass + { + class GreengrassCoreIpcClient; + class GreengrassCoreIpcServiceModel; + class ValidateConfigurationUpdateEvent : public AbstractShapeBase + { + public: + ValidateConfigurationUpdateEvent() noexcept {} + ValidateConfigurationUpdateEvent(const ValidateConfigurationUpdateEvent &) = default; + void SetConfiguration(const Aws::Crt::JsonObject &configuration) noexcept + { + m_configuration = configuration; + } + Aws::Crt::Optional GetConfiguration() noexcept { return m_configuration; } + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ValidateConfigurationUpdateEvent &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ValidateConfigurationUpdateEvent *) noexcept; + /* This needs to be defined so that `ValidateConfigurationUpdateEvent` can be used as a key in maps. */ + bool operator<(const ValidateConfigurationUpdateEvent &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_configuration; + Aws::Crt::Optional m_deploymentId; + }; + + class MQTTMessage : public AbstractShapeBase + { + public: + MQTTMessage() noexcept {} + MQTTMessage(const MQTTMessage &) = default; + void SetTopicName(const Aws::Crt::String &topicName) noexcept { m_topicName = topicName; } + Aws::Crt::Optional GetTopicName() noexcept { return m_topicName; } + void SetPayload(const Aws::Crt::Vector &payload) noexcept { m_payload = payload; } + Aws::Crt::Optional> GetPayload() noexcept { return m_payload; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(MQTTMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(MQTTMessage *) noexcept; + /* This needs to be defined so that `MQTTMessage` can be used as a key in maps. */ + bool operator<(const MQTTMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_topicName; + Aws::Crt::Optional> m_payload; + }; + + class ConfigurationUpdateEvent : public AbstractShapeBase + { + public: + ConfigurationUpdateEvent() noexcept {} + ConfigurationUpdateEvent(const ConfigurationUpdateEvent &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SetKeyPath(const Aws::Crt::Vector &keyPath) noexcept { m_keyPath = keyPath; } + Aws::Crt::Optional> GetKeyPath() noexcept { return m_keyPath; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ConfigurationUpdateEvent &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ConfigurationUpdateEvent *) noexcept; + /* This needs to be defined so that `ConfigurationUpdateEvent` can be used as a key in maps. */ + bool operator<(const ConfigurationUpdateEvent &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + Aws::Crt::Optional> m_keyPath; + }; + + class PostComponentUpdateEvent : public AbstractShapeBase + { + public: + PostComponentUpdateEvent() noexcept {} + PostComponentUpdateEvent(const PostComponentUpdateEvent &) = default; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PostComponentUpdateEvent &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PostComponentUpdateEvent *) noexcept; + /* This needs to be defined so that `PostComponentUpdateEvent` can be used as a key in maps. */ + bool operator<(const PostComponentUpdateEvent &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deploymentId; + }; + + class PreComponentUpdateEvent : public AbstractShapeBase + { + public: + PreComponentUpdateEvent() noexcept {} + PreComponentUpdateEvent(const PreComponentUpdateEvent &) = default; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SetIsGgcRestarting(const bool &isGgcRestarting) noexcept { m_isGgcRestarting = isGgcRestarting; } + Aws::Crt::Optional GetIsGgcRestarting() noexcept { return m_isGgcRestarting; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PreComponentUpdateEvent &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PreComponentUpdateEvent *) noexcept; + /* This needs to be defined so that `PreComponentUpdateEvent` can be used as a key in maps. */ + bool operator<(const PreComponentUpdateEvent &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deploymentId; + Aws::Crt::Optional m_isGgcRestarting; + }; + + enum ConfigurationValidityStatus + { + CONFIGURATION_VALIDITY_STATUS_ACCEPTED, + CONFIGURATION_VALIDITY_STATUS_REJECTED + }; + + class BinaryMessage : public AbstractShapeBase + { + public: + BinaryMessage() noexcept {} + BinaryMessage(const BinaryMessage &) = default; + void SetMessage(const Aws::Crt::Vector &message) noexcept { m_message = message; } + Aws::Crt::Optional> GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(BinaryMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(BinaryMessage *) noexcept; + /* This needs to be defined so that `BinaryMessage` can be used as a key in maps. */ + bool operator<(const BinaryMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_message; + }; + + class JsonMessage : public AbstractShapeBase + { + public: + JsonMessage() noexcept {} + JsonMessage(const JsonMessage &) = default; + void SetMessage(const Aws::Crt::JsonObject &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(JsonMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(JsonMessage *) noexcept; + /* This needs to be defined so that `JsonMessage` can be used as a key in maps. */ + bool operator<(const JsonMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + enum DeploymentStatus + { + DEPLOYMENT_STATUS_QUEUED, + DEPLOYMENT_STATUS_IN_PROGRESS, + DEPLOYMENT_STATUS_SUCCEEDED, + DEPLOYMENT_STATUS_FAILED + }; + + enum LifecycleState + { + LIFECYCLE_STATE_RUNNING, + LIFECYCLE_STATE_ERRORED, + LIFECYCLE_STATE_NEW, + LIFECYCLE_STATE_FINISHED, + LIFECYCLE_STATE_INSTALLED, + LIFECYCLE_STATE_BROKEN, + LIFECYCLE_STATE_STARTING, + LIFECYCLE_STATE_STOPPING + }; + + class RunWithInfo : public AbstractShapeBase + { + public: + RunWithInfo() noexcept {} + RunWithInfo(const RunWithInfo &) = default; + void SetPosixUser(const Aws::Crt::String &posixUser) noexcept { m_posixUser = posixUser; } + Aws::Crt::Optional GetPosixUser() noexcept { return m_posixUser; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(RunWithInfo &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(RunWithInfo *) noexcept; + /* This needs to be defined so that `RunWithInfo` can be used as a key in maps. */ + bool operator<(const RunWithInfo &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_posixUser; + }; + + enum ReportedLifecycleState + { + REPORTED_LIFECYCLE_STATE_RUNNING, + REPORTED_LIFECYCLE_STATE_ERRORED + }; + + class ValidateConfigurationUpdateEvents : public AbstractShapeBase + { + public: + ValidateConfigurationUpdateEvents() noexcept {} + ValidateConfigurationUpdateEvents &operator=(const ValidateConfigurationUpdateEvents &) noexcept; + ValidateConfigurationUpdateEvents(const ValidateConfigurationUpdateEvents &objectToCopy) + { + *this = objectToCopy; + } + void SetValidateConfigurationUpdateEvent( + const ValidateConfigurationUpdateEvent &validateConfigurationUpdateEvent) noexcept + { + m_validateConfigurationUpdateEvent = validateConfigurationUpdateEvent; + m_chosenMember = TAG_VALIDATE_CONFIGURATION_UPDATE_EVENT; + } + Aws::Crt::Optional GetValidateConfigurationUpdateEvent() noexcept + { + if (m_chosenMember == TAG_VALIDATE_CONFIGURATION_UPDATE_EVENT) + { + return m_validateConfigurationUpdateEvent; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ValidateConfigurationUpdateEvents &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ValidateConfigurationUpdateEvents *) noexcept; + /* This needs to be defined so that `ValidateConfigurationUpdateEvents` can be used as a key in maps. */ + bool operator<(const ValidateConfigurationUpdateEvents &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_VALIDATE_CONFIGURATION_UPDATE_EVENT + } m_chosenMember; + Aws::Crt::Optional m_validateConfigurationUpdateEvent; + }; + + class SubscriptionResponseMessage : public AbstractShapeBase + { + public: + SubscriptionResponseMessage() noexcept {} + SubscriptionResponseMessage &operator=(const SubscriptionResponseMessage &) noexcept; + SubscriptionResponseMessage(const SubscriptionResponseMessage &objectToCopy) { *this = objectToCopy; } + void SetJsonMessage(const JsonMessage &jsonMessage) noexcept + { + m_jsonMessage = jsonMessage; + m_chosenMember = TAG_JSON_MESSAGE; + } + Aws::Crt::Optional GetJsonMessage() noexcept + { + if (m_chosenMember == TAG_JSON_MESSAGE) + { + return m_jsonMessage; + } + else + { + return Aws::Crt::Optional(); + } + } + void SetBinaryMessage(const BinaryMessage &binaryMessage) noexcept + { + m_binaryMessage = binaryMessage; + m_chosenMember = TAG_BINARY_MESSAGE; + } + Aws::Crt::Optional GetBinaryMessage() noexcept + { + if (m_chosenMember == TAG_BINARY_MESSAGE) + { + return m_binaryMessage; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscriptionResponseMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscriptionResponseMessage *) noexcept; + /* This needs to be defined so that `SubscriptionResponseMessage` can be used as a key in maps. */ + bool operator<(const SubscriptionResponseMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_JSON_MESSAGE, + TAG_BINARY_MESSAGE + } m_chosenMember; + Aws::Crt::Optional m_jsonMessage; + Aws::Crt::Optional m_binaryMessage; + }; + + class IoTCoreMessage : public AbstractShapeBase + { + public: + IoTCoreMessage() noexcept {} + IoTCoreMessage &operator=(const IoTCoreMessage &) noexcept; + IoTCoreMessage(const IoTCoreMessage &objectToCopy) { *this = objectToCopy; } + void SetMessage(const MQTTMessage &message) noexcept + { + m_message = message; + m_chosenMember = TAG_MESSAGE; + } + Aws::Crt::Optional GetMessage() noexcept + { + if (m_chosenMember == TAG_MESSAGE) + { + return m_message; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(IoTCoreMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(IoTCoreMessage *) noexcept; + /* This needs to be defined so that `IoTCoreMessage` can be used as a key in maps. */ + bool operator<(const IoTCoreMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_MESSAGE + } m_chosenMember; + Aws::Crt::Optional m_message; + }; + + class ConfigurationUpdateEvents : public AbstractShapeBase + { + public: + ConfigurationUpdateEvents() noexcept {} + ConfigurationUpdateEvents &operator=(const ConfigurationUpdateEvents &) noexcept; + ConfigurationUpdateEvents(const ConfigurationUpdateEvents &objectToCopy) { *this = objectToCopy; } + void SetConfigurationUpdateEvent(const ConfigurationUpdateEvent &configurationUpdateEvent) noexcept + { + m_configurationUpdateEvent = configurationUpdateEvent; + m_chosenMember = TAG_CONFIGURATION_UPDATE_EVENT; + } + Aws::Crt::Optional GetConfigurationUpdateEvent() noexcept + { + if (m_chosenMember == TAG_CONFIGURATION_UPDATE_EVENT) + { + return m_configurationUpdateEvent; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ConfigurationUpdateEvents &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ConfigurationUpdateEvents *) noexcept; + /* This needs to be defined so that `ConfigurationUpdateEvents` can be used as a key in maps. */ + bool operator<(const ConfigurationUpdateEvents &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_CONFIGURATION_UPDATE_EVENT + } m_chosenMember; + Aws::Crt::Optional m_configurationUpdateEvent; + }; + + class ComponentUpdatePolicyEvents : public AbstractShapeBase + { + public: + ComponentUpdatePolicyEvents() noexcept {} + ComponentUpdatePolicyEvents &operator=(const ComponentUpdatePolicyEvents &) noexcept; + ComponentUpdatePolicyEvents(const ComponentUpdatePolicyEvents &objectToCopy) { *this = objectToCopy; } + void SetPreUpdateEvent(const PreComponentUpdateEvent &preUpdateEvent) noexcept + { + m_preUpdateEvent = preUpdateEvent; + m_chosenMember = TAG_PRE_UPDATE_EVENT; + } + Aws::Crt::Optional GetPreUpdateEvent() noexcept + { + if (m_chosenMember == TAG_PRE_UPDATE_EVENT) + { + return m_preUpdateEvent; + } + else + { + return Aws::Crt::Optional(); + } + } + void SetPostUpdateEvent(const PostComponentUpdateEvent &postUpdateEvent) noexcept + { + m_postUpdateEvent = postUpdateEvent; + m_chosenMember = TAG_POST_UPDATE_EVENT; + } + Aws::Crt::Optional GetPostUpdateEvent() noexcept + { + if (m_chosenMember == TAG_POST_UPDATE_EVENT) + { + return m_postUpdateEvent; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ComponentUpdatePolicyEvents &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ComponentUpdatePolicyEvents *) noexcept; + /* This needs to be defined so that `ComponentUpdatePolicyEvents` can be used as a key in maps. */ + bool operator<(const ComponentUpdatePolicyEvents &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_PRE_UPDATE_EVENT, + TAG_POST_UPDATE_EVENT + } m_chosenMember; + Aws::Crt::Optional m_preUpdateEvent; + Aws::Crt::Optional m_postUpdateEvent; + }; + + class ConfigurationValidityReport : public AbstractShapeBase + { + public: + ConfigurationValidityReport() noexcept {} + ConfigurationValidityReport(const ConfigurationValidityReport &) = default; + void SetStatus(ConfigurationValidityStatus status) noexcept; + Aws::Crt::Optional GetStatus() noexcept; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ConfigurationValidityReport &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ConfigurationValidityReport *) noexcept; + /* This needs to be defined so that `ConfigurationValidityReport` can be used as a key in maps. */ + bool operator<(const ConfigurationValidityReport &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_status; + Aws::Crt::Optional m_deploymentId; + Aws::Crt::Optional m_message; + }; + + enum RequestStatus + { + REQUEST_STATUS_SUCCEEDED, + REQUEST_STATUS_FAILED + }; + + class PublishMessage : public AbstractShapeBase + { + public: + PublishMessage() noexcept {} + PublishMessage &operator=(const PublishMessage &) noexcept; + PublishMessage(const PublishMessage &objectToCopy) { *this = objectToCopy; } + void SetJsonMessage(const JsonMessage &jsonMessage) noexcept + { + m_jsonMessage = jsonMessage; + m_chosenMember = TAG_JSON_MESSAGE; + } + Aws::Crt::Optional GetJsonMessage() noexcept + { + if (m_chosenMember == TAG_JSON_MESSAGE) + { + return m_jsonMessage; + } + else + { + return Aws::Crt::Optional(); + } + } + void SetBinaryMessage(const BinaryMessage &binaryMessage) noexcept + { + m_binaryMessage = binaryMessage; + m_chosenMember = TAG_BINARY_MESSAGE; + } + Aws::Crt::Optional GetBinaryMessage() noexcept + { + if (m_chosenMember == TAG_BINARY_MESSAGE) + { + return m_binaryMessage; + } + else + { + return Aws::Crt::Optional(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PublishMessage &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PublishMessage *) noexcept; + /* This needs to be defined so that `PublishMessage` can be used as a key in maps. */ + bool operator<(const PublishMessage &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_JSON_MESSAGE, + TAG_BINARY_MESSAGE + } m_chosenMember; + Aws::Crt::Optional m_jsonMessage; + Aws::Crt::Optional m_binaryMessage; + }; + + enum QOS + { + QOS_AT_MOST_ONCE, + QOS_AT_LEAST_ONCE + }; + + class SecretValue : public AbstractShapeBase + { + public: + SecretValue() noexcept {} + SecretValue &operator=(const SecretValue &) noexcept; + SecretValue(const SecretValue &objectToCopy) { *this = objectToCopy; } + void SetSecretString(const Aws::Crt::String &secretString) noexcept + { + m_secretString = secretString; + m_chosenMember = TAG_SECRET_STRING; + } + Aws::Crt::Optional GetSecretString() noexcept + { + if (m_chosenMember == TAG_SECRET_STRING) + { + return m_secretString; + } + else + { + return Aws::Crt::Optional(); + } + } + void SetSecretBinary(const Aws::Crt::Vector &secretBinary) noexcept + { + m_secretBinary = secretBinary; + m_chosenMember = TAG_SECRET_BINARY; + } + Aws::Crt::Optional> GetSecretBinary() noexcept + { + if (m_chosenMember == TAG_SECRET_BINARY) + { + return m_secretBinary; + } + else + { + return Aws::Crt::Optional>(); + } + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SecretValue &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SecretValue *) noexcept; + /* This needs to be defined so that `SecretValue` can be used as a key in maps. */ + bool operator<(const SecretValue &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + enum ChosenMember + { + TAG_SECRET_STRING, + TAG_SECRET_BINARY + } m_chosenMember; + Aws::Crt::Optional m_secretString; + Aws::Crt::Optional> m_secretBinary; + }; + + class LocalDeployment : public AbstractShapeBase + { + public: + LocalDeployment() noexcept {} + LocalDeployment(const LocalDeployment &) = default; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SetStatus(DeploymentStatus status) noexcept; + Aws::Crt::Optional GetStatus() noexcept; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(LocalDeployment &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(LocalDeployment *) noexcept; + /* This needs to be defined so that `LocalDeployment` can be used as a key in maps. */ + bool operator<(const LocalDeployment &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deploymentId; + Aws::Crt::Optional m_status; + }; + + class ComponentDetails : public AbstractShapeBase + { + public: + ComponentDetails() noexcept {} + ComponentDetails(const ComponentDetails &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SetVersion(const Aws::Crt::String &version) noexcept { m_version = version; } + Aws::Crt::Optional GetVersion() noexcept { return m_version; } + void SetState(LifecycleState state) noexcept; + Aws::Crt::Optional GetState() noexcept; + void SetConfiguration(const Aws::Crt::JsonObject &configuration) noexcept + { + m_configuration = configuration; + } + Aws::Crt::Optional GetConfiguration() noexcept { return m_configuration; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ComponentDetails &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ComponentDetails *) noexcept; + /* This needs to be defined so that `ComponentDetails` can be used as a key in maps. */ + bool operator<(const ComponentDetails &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + Aws::Crt::Optional m_version; + Aws::Crt::Optional m_state; + Aws::Crt::Optional m_configuration; + }; + + class InvalidTokenError : public OperationError + { + public: + InvalidTokenError() noexcept {} + InvalidTokenError(const InvalidTokenError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(InvalidTokenError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(InvalidTokenError *) noexcept; + /* This needs to be defined so that `InvalidTokenError` can be used as a key in maps. */ + bool operator<(const InvalidTokenError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class ValidateAuthorizationTokenResponse : public AbstractShapeBase + { + public: + ValidateAuthorizationTokenResponse() noexcept {} + ValidateAuthorizationTokenResponse(const ValidateAuthorizationTokenResponse &) = default; + void SetIsValid(const bool &isValid) noexcept { m_isValid = isValid; } + Aws::Crt::Optional GetIsValid() noexcept { return m_isValid; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ValidateAuthorizationTokenResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ValidateAuthorizationTokenResponse *) noexcept; + /* This needs to be defined so that `ValidateAuthorizationTokenResponse` can be used as a key in maps. */ + bool operator<(const ValidateAuthorizationTokenResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_isValid; + }; + + class ValidateAuthorizationTokenRequest : public AbstractShapeBase + { + public: + ValidateAuthorizationTokenRequest() noexcept {} + ValidateAuthorizationTokenRequest(const ValidateAuthorizationTokenRequest &) = default; + void SetToken(const Aws::Crt::String &token) noexcept { m_token = token; } + Aws::Crt::Optional GetToken() noexcept { return m_token; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ValidateAuthorizationTokenRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ValidateAuthorizationTokenRequest *) noexcept; + /* This needs to be defined so that `ValidateAuthorizationTokenRequest` can be used as a key in maps. */ + bool operator<(const ValidateAuthorizationTokenRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_token; + }; + + class UpdateThingShadowResponse : public AbstractShapeBase + { + public: + UpdateThingShadowResponse() noexcept {} + UpdateThingShadowResponse(const UpdateThingShadowResponse &) = default; + void SetPayload(const Aws::Crt::Vector &payload) noexcept { m_payload = payload; } + Aws::Crt::Optional> GetPayload() noexcept { return m_payload; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UpdateThingShadowResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UpdateThingShadowResponse *) noexcept; + /* This needs to be defined so that `UpdateThingShadowResponse` can be used as a key in maps. */ + bool operator<(const UpdateThingShadowResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_payload; + }; + + class UpdateThingShadowRequest : public AbstractShapeBase + { + public: + UpdateThingShadowRequest() noexcept {} + UpdateThingShadowRequest(const UpdateThingShadowRequest &) = default; + void SetThingName(const Aws::Crt::String &thingName) noexcept { m_thingName = thingName; } + Aws::Crt::Optional GetThingName() noexcept { return m_thingName; } + void SetShadowName(const Aws::Crt::String &shadowName) noexcept { m_shadowName = shadowName; } + Aws::Crt::Optional GetShadowName() noexcept { return m_shadowName; } + void SetPayload(const Aws::Crt::Vector &payload) noexcept { m_payload = payload; } + Aws::Crt::Optional> GetPayload() noexcept { return m_payload; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UpdateThingShadowRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UpdateThingShadowRequest *) noexcept; + /* This needs to be defined so that `UpdateThingShadowRequest` can be used as a key in maps. */ + bool operator<(const UpdateThingShadowRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_thingName; + Aws::Crt::Optional m_shadowName; + Aws::Crt::Optional> m_payload; + }; + + class UpdateStateResponse : public AbstractShapeBase + { + public: + UpdateStateResponse() noexcept {} + UpdateStateResponse(const UpdateStateResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UpdateStateResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UpdateStateResponse *) noexcept; + /* This needs to be defined so that `UpdateStateResponse` can be used as a key in maps. */ + bool operator<(const UpdateStateResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class UpdateStateRequest : public AbstractShapeBase + { + public: + UpdateStateRequest() noexcept {} + UpdateStateRequest(const UpdateStateRequest &) = default; + void SetState(ReportedLifecycleState state) noexcept; + Aws::Crt::Optional GetState() noexcept; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UpdateStateRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UpdateStateRequest *) noexcept; + /* This needs to be defined so that `UpdateStateRequest` can be used as a key in maps. */ + bool operator<(const UpdateStateRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_state; + }; + + class FailedUpdateConditionCheckError : public OperationError + { + public: + FailedUpdateConditionCheckError() noexcept {} + FailedUpdateConditionCheckError(const FailedUpdateConditionCheckError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(FailedUpdateConditionCheckError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(FailedUpdateConditionCheckError *) noexcept; + /* This needs to be defined so that `FailedUpdateConditionCheckError` can be used as a key in maps. */ + bool operator<(const FailedUpdateConditionCheckError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class ConflictError : public OperationError + { + public: + ConflictError() noexcept {} + ConflictError(const ConflictError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ConflictError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ConflictError *) noexcept; + /* This needs to be defined so that `ConflictError` can be used as a key in maps. */ + bool operator<(const ConflictError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class UpdateConfigurationResponse : public AbstractShapeBase + { + public: + UpdateConfigurationResponse() noexcept {} + UpdateConfigurationResponse(const UpdateConfigurationResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UpdateConfigurationResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UpdateConfigurationResponse *) noexcept; + /* This needs to be defined so that `UpdateConfigurationResponse` can be used as a key in maps. */ + bool operator<(const UpdateConfigurationResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class UpdateConfigurationRequest : public AbstractShapeBase + { + public: + UpdateConfigurationRequest() noexcept {} + UpdateConfigurationRequest(const UpdateConfigurationRequest &) = default; + void SetKeyPath(const Aws::Crt::Vector &keyPath) noexcept { m_keyPath = keyPath; } + Aws::Crt::Optional> GetKeyPath() noexcept { return m_keyPath; } + void SetTimestamp(const Aws::Crt::DateTime ×tamp) noexcept { m_timestamp = timestamp; } + Aws::Crt::Optional GetTimestamp() noexcept { return m_timestamp; } + void SetValueToMerge(const Aws::Crt::JsonObject &valueToMerge) noexcept { m_valueToMerge = valueToMerge; } + Aws::Crt::Optional GetValueToMerge() noexcept { return m_valueToMerge; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UpdateConfigurationRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UpdateConfigurationRequest *) noexcept; + /* This needs to be defined so that `UpdateConfigurationRequest` can be used as a key in maps. */ + bool operator<(const UpdateConfigurationRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_keyPath; + Aws::Crt::Optional m_timestamp; + Aws::Crt::Optional m_valueToMerge; + }; + + class SubscribeToValidateConfigurationUpdatesResponse : public AbstractShapeBase + { + public: + SubscribeToValidateConfigurationUpdatesResponse() noexcept {} + SubscribeToValidateConfigurationUpdatesResponse(const SubscribeToValidateConfigurationUpdatesResponse &) = + default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView( + SubscribeToValidateConfigurationUpdatesResponse &, + const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToValidateConfigurationUpdatesResponse *) noexcept; + /* This needs to be defined so that `SubscribeToValidateConfigurationUpdatesResponse` can be used as a key + * in maps. */ + bool operator<(const SubscribeToValidateConfigurationUpdatesResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SubscribeToValidateConfigurationUpdatesRequest : public AbstractShapeBase + { + public: + SubscribeToValidateConfigurationUpdatesRequest() noexcept {} + SubscribeToValidateConfigurationUpdatesRequest(const SubscribeToValidateConfigurationUpdatesRequest &) = + default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView( + SubscribeToValidateConfigurationUpdatesRequest &, + const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToValidateConfigurationUpdatesRequest *) noexcept; + /* This needs to be defined so that `SubscribeToValidateConfigurationUpdatesRequest` can be used as a key in + * maps. */ + bool operator<(const SubscribeToValidateConfigurationUpdatesRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SubscribeToTopicResponse : public AbstractShapeBase + { + public: + SubscribeToTopicResponse() noexcept {} + SubscribeToTopicResponse(const SubscribeToTopicResponse &) = default; + void SetTopicName(const Aws::Crt::String &topicName) noexcept { m_topicName = topicName; } + Aws::Crt::Optional GetTopicName() noexcept { return m_topicName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscribeToTopicResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToTopicResponse *) noexcept; + /* This needs to be defined so that `SubscribeToTopicResponse` can be used as a key in maps. */ + bool operator<(const SubscribeToTopicResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_topicName; + }; + + class SubscribeToTopicRequest : public AbstractShapeBase + { + public: + SubscribeToTopicRequest() noexcept {} + SubscribeToTopicRequest(const SubscribeToTopicRequest &) = default; + void SetTopic(const Aws::Crt::String &topic) noexcept { m_topic = topic; } + Aws::Crt::Optional GetTopic() noexcept { return m_topic; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscribeToTopicRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToTopicRequest *) noexcept; + /* This needs to be defined so that `SubscribeToTopicRequest` can be used as a key in maps. */ + bool operator<(const SubscribeToTopicRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_topic; + }; + + class SubscribeToIoTCoreResponse : public AbstractShapeBase + { + public: + SubscribeToIoTCoreResponse() noexcept {} + SubscribeToIoTCoreResponse(const SubscribeToIoTCoreResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscribeToIoTCoreResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToIoTCoreResponse *) noexcept; + /* This needs to be defined so that `SubscribeToIoTCoreResponse` can be used as a key in maps. */ + bool operator<(const SubscribeToIoTCoreResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SubscribeToIoTCoreRequest : public AbstractShapeBase + { + public: + SubscribeToIoTCoreRequest() noexcept {} + SubscribeToIoTCoreRequest(const SubscribeToIoTCoreRequest &) = default; + void SetTopicName(const Aws::Crt::String &topicName) noexcept { m_topicName = topicName; } + Aws::Crt::Optional GetTopicName() noexcept { return m_topicName; } + void SetQos(QOS qos) noexcept; + Aws::Crt::Optional GetQos() noexcept; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscribeToIoTCoreRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToIoTCoreRequest *) noexcept; + /* This needs to be defined so that `SubscribeToIoTCoreRequest` can be used as a key in maps. */ + bool operator<(const SubscribeToIoTCoreRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_topicName; + Aws::Crt::Optional m_qos; + }; + + class SubscribeToConfigurationUpdateResponse : public AbstractShapeBase + { + public: + SubscribeToConfigurationUpdateResponse() noexcept {} + SubscribeToConfigurationUpdateResponse(const SubscribeToConfigurationUpdateResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView( + SubscribeToConfigurationUpdateResponse &, + const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToConfigurationUpdateResponse *) noexcept; + /* This needs to be defined so that `SubscribeToConfigurationUpdateResponse` can be used as a key in maps. + */ + bool operator<(const SubscribeToConfigurationUpdateResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SubscribeToConfigurationUpdateRequest : public AbstractShapeBase + { + public: + SubscribeToConfigurationUpdateRequest() noexcept {} + SubscribeToConfigurationUpdateRequest(const SubscribeToConfigurationUpdateRequest &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SetKeyPath(const Aws::Crt::Vector &keyPath) noexcept { m_keyPath = keyPath; } + Aws::Crt::Optional> GetKeyPath() noexcept { return m_keyPath; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView( + SubscribeToConfigurationUpdateRequest &, + const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToConfigurationUpdateRequest *) noexcept; + /* This needs to be defined so that `SubscribeToConfigurationUpdateRequest` can be used as a key in maps. */ + bool operator<(const SubscribeToConfigurationUpdateRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + Aws::Crt::Optional> m_keyPath; + }; + + class SubscribeToComponentUpdatesResponse : public AbstractShapeBase + { + public: + SubscribeToComponentUpdatesResponse() noexcept {} + SubscribeToComponentUpdatesResponse(const SubscribeToComponentUpdatesResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscribeToComponentUpdatesResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToComponentUpdatesResponse *) noexcept; + /* This needs to be defined so that `SubscribeToComponentUpdatesResponse` can be used as a key in maps. */ + bool operator<(const SubscribeToComponentUpdatesResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SubscribeToComponentUpdatesRequest : public AbstractShapeBase + { + public: + SubscribeToComponentUpdatesRequest() noexcept {} + SubscribeToComponentUpdatesRequest(const SubscribeToComponentUpdatesRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(SubscribeToComponentUpdatesRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SubscribeToComponentUpdatesRequest *) noexcept; + /* This needs to be defined so that `SubscribeToComponentUpdatesRequest` can be used as a key in maps. */ + bool operator<(const SubscribeToComponentUpdatesRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class StopComponentResponse : public AbstractShapeBase + { + public: + StopComponentResponse() noexcept {} + StopComponentResponse(const StopComponentResponse &) = default; + void SetStopStatus(RequestStatus stopStatus) noexcept; + Aws::Crt::Optional GetStopStatus() noexcept; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(StopComponentResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(StopComponentResponse *) noexcept; + /* This needs to be defined so that `StopComponentResponse` can be used as a key in maps. */ + bool operator<(const StopComponentResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_stopStatus; + Aws::Crt::Optional m_message; + }; + + class StopComponentRequest : public AbstractShapeBase + { + public: + StopComponentRequest() noexcept {} + StopComponentRequest(const StopComponentRequest &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(StopComponentRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(StopComponentRequest *) noexcept; + /* This needs to be defined so that `StopComponentRequest` can be used as a key in maps. */ + bool operator<(const StopComponentRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + }; + + class SendConfigurationValidityReportResponse : public AbstractShapeBase + { + public: + SendConfigurationValidityReportResponse() noexcept {} + SendConfigurationValidityReportResponse(const SendConfigurationValidityReportResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView( + SendConfigurationValidityReportResponse &, + const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SendConfigurationValidityReportResponse *) noexcept; + /* This needs to be defined so that `SendConfigurationValidityReportResponse` can be used as a key in maps. + */ + bool operator<(const SendConfigurationValidityReportResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SendConfigurationValidityReportRequest : public AbstractShapeBase + { + public: + SendConfigurationValidityReportRequest() noexcept {} + SendConfigurationValidityReportRequest(const SendConfigurationValidityReportRequest &) = default; + void SetConfigurationValidityReport(const ConfigurationValidityReport &configurationValidityReport) noexcept + { + m_configurationValidityReport = configurationValidityReport; + } + Aws::Crt::Optional GetConfigurationValidityReport() noexcept + { + return m_configurationValidityReport; + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView( + SendConfigurationValidityReportRequest &, + const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(SendConfigurationValidityReportRequest *) noexcept; + /* This needs to be defined so that `SendConfigurationValidityReportRequest` can be used as a key in maps. + */ + bool operator<(const SendConfigurationValidityReportRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_configurationValidityReport; + }; + + class ComponentNotFoundError : public OperationError + { + public: + ComponentNotFoundError() noexcept {} + ComponentNotFoundError(const ComponentNotFoundError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ComponentNotFoundError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ComponentNotFoundError *) noexcept; + /* This needs to be defined so that `ComponentNotFoundError` can be used as a key in maps. */ + bool operator<(const ComponentNotFoundError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class RestartComponentResponse : public AbstractShapeBase + { + public: + RestartComponentResponse() noexcept {} + RestartComponentResponse(const RestartComponentResponse &) = default; + void SetRestartStatus(RequestStatus restartStatus) noexcept; + Aws::Crt::Optional GetRestartStatus() noexcept; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(RestartComponentResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(RestartComponentResponse *) noexcept; + /* This needs to be defined so that `RestartComponentResponse` can be used as a key in maps. */ + bool operator<(const RestartComponentResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_restartStatus; + Aws::Crt::Optional m_message; + }; + + class RestartComponentRequest : public AbstractShapeBase + { + public: + RestartComponentRequest() noexcept {} + RestartComponentRequest(const RestartComponentRequest &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(RestartComponentRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(RestartComponentRequest *) noexcept; + /* This needs to be defined so that `RestartComponentRequest` can be used as a key in maps. */ + bool operator<(const RestartComponentRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + }; + + class PublishToTopicResponse : public AbstractShapeBase + { + public: + PublishToTopicResponse() noexcept {} + PublishToTopicResponse(const PublishToTopicResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PublishToTopicResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PublishToTopicResponse *) noexcept; + /* This needs to be defined so that `PublishToTopicResponse` can be used as a key in maps. */ + bool operator<(const PublishToTopicResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class PublishToTopicRequest : public AbstractShapeBase + { + public: + PublishToTopicRequest() noexcept {} + PublishToTopicRequest(const PublishToTopicRequest &) = default; + void SetTopic(const Aws::Crt::String &topic) noexcept { m_topic = topic; } + Aws::Crt::Optional GetTopic() noexcept { return m_topic; } + void SetPublishMessage(const PublishMessage &publishMessage) noexcept { m_publishMessage = publishMessage; } + Aws::Crt::Optional GetPublishMessage() noexcept { return m_publishMessage; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PublishToTopicRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PublishToTopicRequest *) noexcept; + /* This needs to be defined so that `PublishToTopicRequest` can be used as a key in maps. */ + bool operator<(const PublishToTopicRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_topic; + Aws::Crt::Optional m_publishMessage; + }; + + class PublishToIoTCoreResponse : public AbstractShapeBase + { + public: + PublishToIoTCoreResponse() noexcept {} + PublishToIoTCoreResponse(const PublishToIoTCoreResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PublishToIoTCoreResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PublishToIoTCoreResponse *) noexcept; + /* This needs to be defined so that `PublishToIoTCoreResponse` can be used as a key in maps. */ + bool operator<(const PublishToIoTCoreResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class PublishToIoTCoreRequest : public AbstractShapeBase + { + public: + PublishToIoTCoreRequest() noexcept {} + PublishToIoTCoreRequest(const PublishToIoTCoreRequest &) = default; + void SetTopicName(const Aws::Crt::String &topicName) noexcept { m_topicName = topicName; } + Aws::Crt::Optional GetTopicName() noexcept { return m_topicName; } + void SetQos(QOS qos) noexcept; + Aws::Crt::Optional GetQos() noexcept; + void SetPayload(const Aws::Crt::Vector &payload) noexcept { m_payload = payload; } + Aws::Crt::Optional> GetPayload() noexcept { return m_payload; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(PublishToIoTCoreRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(PublishToIoTCoreRequest *) noexcept; + /* This needs to be defined so that `PublishToIoTCoreRequest` can be used as a key in maps. */ + bool operator<(const PublishToIoTCoreRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_topicName; + Aws::Crt::Optional m_qos; + Aws::Crt::Optional> m_payload; + }; + + class ListNamedShadowsForThingResponse : public AbstractShapeBase + { + public: + ListNamedShadowsForThingResponse() noexcept {} + ListNamedShadowsForThingResponse(const ListNamedShadowsForThingResponse &) = default; + void SetResults(const Aws::Crt::Vector &results) noexcept { m_results = results; } + Aws::Crt::Optional> GetResults() noexcept { return m_results; } + void SetTimestamp(const Aws::Crt::DateTime ×tamp) noexcept { m_timestamp = timestamp; } + Aws::Crt::Optional GetTimestamp() noexcept { return m_timestamp; } + void SetNextToken(const Aws::Crt::String &nextToken) noexcept { m_nextToken = nextToken; } + Aws::Crt::Optional GetNextToken() noexcept { return m_nextToken; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ListNamedShadowsForThingResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ListNamedShadowsForThingResponse *) noexcept; + /* This needs to be defined so that `ListNamedShadowsForThingResponse` can be used as a key in maps. */ + bool operator<(const ListNamedShadowsForThingResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_results; + Aws::Crt::Optional m_timestamp; + Aws::Crt::Optional m_nextToken; + }; + + class ListNamedShadowsForThingRequest : public AbstractShapeBase + { + public: + ListNamedShadowsForThingRequest() noexcept {} + ListNamedShadowsForThingRequest(const ListNamedShadowsForThingRequest &) = default; + void SetThingName(const Aws::Crt::String &thingName) noexcept { m_thingName = thingName; } + Aws::Crt::Optional GetThingName() noexcept { return m_thingName; } + void SetNextToken(const Aws::Crt::String &nextToken) noexcept { m_nextToken = nextToken; } + Aws::Crt::Optional GetNextToken() noexcept { return m_nextToken; } + void SetPageSize(const int &pageSize) noexcept { m_pageSize = pageSize; } + Aws::Crt::Optional GetPageSize() noexcept { return m_pageSize; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ListNamedShadowsForThingRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ListNamedShadowsForThingRequest *) noexcept; + /* This needs to be defined so that `ListNamedShadowsForThingRequest` can be used as a key in maps. */ + bool operator<(const ListNamedShadowsForThingRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_thingName; + Aws::Crt::Optional m_nextToken; + Aws::Crt::Optional m_pageSize; + }; + + class ListLocalDeploymentsResponse : public AbstractShapeBase + { + public: + ListLocalDeploymentsResponse() noexcept {} + ListLocalDeploymentsResponse(const ListLocalDeploymentsResponse &) = default; + void SetLocalDeployments(const Aws::Crt::Vector &localDeployments) noexcept + { + m_localDeployments = localDeployments; + } + Aws::Crt::Optional> GetLocalDeployments() noexcept + { + return m_localDeployments; + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ListLocalDeploymentsResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ListLocalDeploymentsResponse *) noexcept; + /* This needs to be defined so that `ListLocalDeploymentsResponse` can be used as a key in maps. */ + bool operator<(const ListLocalDeploymentsResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_localDeployments; + }; + + class ListLocalDeploymentsRequest : public AbstractShapeBase + { + public: + ListLocalDeploymentsRequest() noexcept {} + ListLocalDeploymentsRequest(const ListLocalDeploymentsRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ListLocalDeploymentsRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ListLocalDeploymentsRequest *) noexcept; + /* This needs to be defined so that `ListLocalDeploymentsRequest` can be used as a key in maps. */ + bool operator<(const ListLocalDeploymentsRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class ListComponentsResponse : public AbstractShapeBase + { + public: + ListComponentsResponse() noexcept {} + ListComponentsResponse(const ListComponentsResponse &) = default; + void SetComponents(const Aws::Crt::Vector &components) noexcept + { + m_components = components; + } + Aws::Crt::Optional> GetComponents() noexcept { return m_components; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ListComponentsResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ListComponentsResponse *) noexcept; + /* This needs to be defined so that `ListComponentsResponse` can be used as a key in maps. */ + bool operator<(const ListComponentsResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_components; + }; + + class ListComponentsRequest : public AbstractShapeBase + { + public: + ListComponentsRequest() noexcept {} + ListComponentsRequest(const ListComponentsRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ListComponentsRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ListComponentsRequest *) noexcept; + /* This needs to be defined so that `ListComponentsRequest` can be used as a key in maps. */ + bool operator<(const ListComponentsRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class GetThingShadowResponse : public AbstractShapeBase + { + public: + GetThingShadowResponse() noexcept {} + GetThingShadowResponse(const GetThingShadowResponse &) = default; + void SetPayload(const Aws::Crt::Vector &payload) noexcept { m_payload = payload; } + Aws::Crt::Optional> GetPayload() noexcept { return m_payload; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetThingShadowResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetThingShadowResponse *) noexcept; + /* This needs to be defined so that `GetThingShadowResponse` can be used as a key in maps. */ + bool operator<(const GetThingShadowResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_payload; + }; + + class GetThingShadowRequest : public AbstractShapeBase + { + public: + GetThingShadowRequest() noexcept {} + GetThingShadowRequest(const GetThingShadowRequest &) = default; + void SetThingName(const Aws::Crt::String &thingName) noexcept { m_thingName = thingName; } + Aws::Crt::Optional GetThingName() noexcept { return m_thingName; } + void SetShadowName(const Aws::Crt::String &shadowName) noexcept { m_shadowName = shadowName; } + Aws::Crt::Optional GetShadowName() noexcept { return m_shadowName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetThingShadowRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetThingShadowRequest *) noexcept; + /* This needs to be defined so that `GetThingShadowRequest` can be used as a key in maps. */ + bool operator<(const GetThingShadowRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_thingName; + Aws::Crt::Optional m_shadowName; + }; + + class GetSecretValueResponse : public AbstractShapeBase + { + public: + GetSecretValueResponse() noexcept {} + GetSecretValueResponse(const GetSecretValueResponse &) = default; + void SetSecretId(const Aws::Crt::String &secretId) noexcept { m_secretId = secretId; } + Aws::Crt::Optional GetSecretId() noexcept { return m_secretId; } + void SetVersionId(const Aws::Crt::String &versionId) noexcept { m_versionId = versionId; } + Aws::Crt::Optional GetVersionId() noexcept { return m_versionId; } + void SetVersionStage(const Aws::Crt::Vector &versionStage) noexcept + { + m_versionStage = versionStage; + } + Aws::Crt::Optional> GetVersionStage() noexcept { return m_versionStage; } + void SetSecretValue(const SecretValue &secretValue) noexcept { m_secretValue = secretValue; } + Aws::Crt::Optional GetSecretValue() noexcept { return m_secretValue; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetSecretValueResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetSecretValueResponse *) noexcept; + /* This needs to be defined so that `GetSecretValueResponse` can be used as a key in maps. */ + bool operator<(const GetSecretValueResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_secretId; + Aws::Crt::Optional m_versionId; + Aws::Crt::Optional> m_versionStage; + Aws::Crt::Optional m_secretValue; + }; + + class GetSecretValueRequest : public AbstractShapeBase + { + public: + GetSecretValueRequest() noexcept {} + GetSecretValueRequest(const GetSecretValueRequest &) = default; + void SetSecretId(const Aws::Crt::String &secretId) noexcept { m_secretId = secretId; } + Aws::Crt::Optional GetSecretId() noexcept { return m_secretId; } + void SetVersionId(const Aws::Crt::String &versionId) noexcept { m_versionId = versionId; } + Aws::Crt::Optional GetVersionId() noexcept { return m_versionId; } + void SetVersionStage(const Aws::Crt::String &versionStage) noexcept { m_versionStage = versionStage; } + Aws::Crt::Optional GetVersionStage() noexcept { return m_versionStage; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetSecretValueRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetSecretValueRequest *) noexcept; + /* This needs to be defined so that `GetSecretValueRequest` can be used as a key in maps. */ + bool operator<(const GetSecretValueRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_secretId; + Aws::Crt::Optional m_versionId; + Aws::Crt::Optional m_versionStage; + }; + + class GetLocalDeploymentStatusResponse : public AbstractShapeBase + { + public: + GetLocalDeploymentStatusResponse() noexcept {} + GetLocalDeploymentStatusResponse(const GetLocalDeploymentStatusResponse &) = default; + void SetDeployment(const LocalDeployment &deployment) noexcept { m_deployment = deployment; } + Aws::Crt::Optional GetDeployment() noexcept { return m_deployment; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetLocalDeploymentStatusResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetLocalDeploymentStatusResponse *) noexcept; + /* This needs to be defined so that `GetLocalDeploymentStatusResponse` can be used as a key in maps. */ + bool operator<(const GetLocalDeploymentStatusResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deployment; + }; + + class GetLocalDeploymentStatusRequest : public AbstractShapeBase + { + public: + GetLocalDeploymentStatusRequest() noexcept {} + GetLocalDeploymentStatusRequest(const GetLocalDeploymentStatusRequest &) = default; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetLocalDeploymentStatusRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetLocalDeploymentStatusRequest *) noexcept; + /* This needs to be defined so that `GetLocalDeploymentStatusRequest` can be used as a key in maps. */ + bool operator<(const GetLocalDeploymentStatusRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deploymentId; + }; + + class GetConfigurationResponse : public AbstractShapeBase + { + public: + GetConfigurationResponse() noexcept {} + GetConfigurationResponse(const GetConfigurationResponse &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SetValue(const Aws::Crt::JsonObject &value) noexcept { m_value = value; } + Aws::Crt::Optional GetValue() noexcept { return m_value; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetConfigurationResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetConfigurationResponse *) noexcept; + /* This needs to be defined so that `GetConfigurationResponse` can be used as a key in maps. */ + bool operator<(const GetConfigurationResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + Aws::Crt::Optional m_value; + }; + + class GetConfigurationRequest : public AbstractShapeBase + { + public: + GetConfigurationRequest() noexcept {} + GetConfigurationRequest(const GetConfigurationRequest &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SetKeyPath(const Aws::Crt::Vector &keyPath) noexcept { m_keyPath = keyPath; } + Aws::Crt::Optional> GetKeyPath() noexcept { return m_keyPath; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetConfigurationRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetConfigurationRequest *) noexcept; + /* This needs to be defined so that `GetConfigurationRequest` can be used as a key in maps. */ + bool operator<(const GetConfigurationRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + Aws::Crt::Optional> m_keyPath; + }; + + class GetComponentDetailsResponse : public AbstractShapeBase + { + public: + GetComponentDetailsResponse() noexcept {} + GetComponentDetailsResponse(const GetComponentDetailsResponse &) = default; + void SetComponentDetails(const ComponentDetails &componentDetails) noexcept + { + m_componentDetails = componentDetails; + } + Aws::Crt::Optional GetComponentDetails() noexcept { return m_componentDetails; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetComponentDetailsResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetComponentDetailsResponse *) noexcept; + /* This needs to be defined so that `GetComponentDetailsResponse` can be used as a key in maps. */ + bool operator<(const GetComponentDetailsResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentDetails; + }; + + class GetComponentDetailsRequest : public AbstractShapeBase + { + public: + GetComponentDetailsRequest() noexcept {} + GetComponentDetailsRequest(const GetComponentDetailsRequest &) = default; + void SetComponentName(const Aws::Crt::String &componentName) noexcept { m_componentName = componentName; } + Aws::Crt::Optional GetComponentName() noexcept { return m_componentName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(GetComponentDetailsRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(GetComponentDetailsRequest *) noexcept; + /* This needs to be defined so that `GetComponentDetailsRequest` can be used as a key in maps. */ + bool operator<(const GetComponentDetailsRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_componentName; + }; + + class DeleteThingShadowResponse : public AbstractShapeBase + { + public: + DeleteThingShadowResponse() noexcept {} + DeleteThingShadowResponse(const DeleteThingShadowResponse &) = default; + void SetPayload(const Aws::Crt::Vector &payload) noexcept { m_payload = payload; } + Aws::Crt::Optional> GetPayload() noexcept { return m_payload; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(DeleteThingShadowResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(DeleteThingShadowResponse *) noexcept; + /* This needs to be defined so that `DeleteThingShadowResponse` can be used as a key in maps. */ + bool operator<(const DeleteThingShadowResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional> m_payload; + }; + + class DeleteThingShadowRequest : public AbstractShapeBase + { + public: + DeleteThingShadowRequest() noexcept {} + DeleteThingShadowRequest(const DeleteThingShadowRequest &) = default; + void SetThingName(const Aws::Crt::String &thingName) noexcept { m_thingName = thingName; } + Aws::Crt::Optional GetThingName() noexcept { return m_thingName; } + void SetShadowName(const Aws::Crt::String &shadowName) noexcept { m_shadowName = shadowName; } + Aws::Crt::Optional GetShadowName() noexcept { return m_shadowName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(DeleteThingShadowRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(DeleteThingShadowRequest *) noexcept; + /* This needs to be defined so that `DeleteThingShadowRequest` can be used as a key in maps. */ + bool operator<(const DeleteThingShadowRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_thingName; + Aws::Crt::Optional m_shadowName; + }; + + class ResourceNotFoundError : public OperationError + { + public: + ResourceNotFoundError() noexcept {} + ResourceNotFoundError(const ResourceNotFoundError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SetResourceType(const Aws::Crt::String &resourceType) noexcept { m_resourceType = resourceType; } + Aws::Crt::Optional GetResourceType() noexcept { return m_resourceType; } + void SetResourceName(const Aws::Crt::String &resourceName) noexcept { m_resourceName = resourceName; } + Aws::Crt::Optional GetResourceName() noexcept { return m_resourceName; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ResourceNotFoundError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ResourceNotFoundError *) noexcept; + /* This needs to be defined so that `ResourceNotFoundError` can be used as a key in maps. */ + bool operator<(const ResourceNotFoundError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + Aws::Crt::Optional m_resourceType; + Aws::Crt::Optional m_resourceName; + }; + + class DeferComponentUpdateResponse : public AbstractShapeBase + { + public: + DeferComponentUpdateResponse() noexcept {} + DeferComponentUpdateResponse(const DeferComponentUpdateResponse &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(DeferComponentUpdateResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(DeferComponentUpdateResponse *) noexcept; + /* This needs to be defined so that `DeferComponentUpdateResponse` can be used as a key in maps. */ + bool operator<(const DeferComponentUpdateResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class DeferComponentUpdateRequest : public AbstractShapeBase + { + public: + DeferComponentUpdateRequest() noexcept {} + DeferComponentUpdateRequest(const DeferComponentUpdateRequest &) = default; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept { return m_message; } + void SetRecheckAfterMs(const int64_t &recheckAfterMs) noexcept { m_recheckAfterMs = recheckAfterMs; } + Aws::Crt::Optional GetRecheckAfterMs() noexcept { return m_recheckAfterMs; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(DeferComponentUpdateRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(DeferComponentUpdateRequest *) noexcept; + /* This needs to be defined so that `DeferComponentUpdateRequest` can be used as a key in maps. */ + bool operator<(const DeferComponentUpdateRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deploymentId; + Aws::Crt::Optional m_message; + Aws::Crt::Optional m_recheckAfterMs; + }; + + class InvalidArgumentsError : public OperationError + { + public: + InvalidArgumentsError() noexcept {} + InvalidArgumentsError(const InvalidArgumentsError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(InvalidArgumentsError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(InvalidArgumentsError *) noexcept; + /* This needs to be defined so that `InvalidArgumentsError` can be used as a key in maps. */ + bool operator<(const InvalidArgumentsError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class InvalidArtifactsDirectoryPathError : public OperationError + { + public: + InvalidArtifactsDirectoryPathError() noexcept {} + InvalidArtifactsDirectoryPathError(const InvalidArtifactsDirectoryPathError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(InvalidArtifactsDirectoryPathError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(InvalidArtifactsDirectoryPathError *) noexcept; + /* This needs to be defined so that `InvalidArtifactsDirectoryPathError` can be used as a key in maps. */ + bool operator<(const InvalidArtifactsDirectoryPathError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class InvalidRecipeDirectoryPathError : public OperationError + { + public: + InvalidRecipeDirectoryPathError() noexcept {} + InvalidRecipeDirectoryPathError(const InvalidRecipeDirectoryPathError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(InvalidRecipeDirectoryPathError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(InvalidRecipeDirectoryPathError *) noexcept; + /* This needs to be defined so that `InvalidRecipeDirectoryPathError` can be used as a key in maps. */ + bool operator<(const InvalidRecipeDirectoryPathError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class CreateLocalDeploymentResponse : public AbstractShapeBase + { + public: + CreateLocalDeploymentResponse() noexcept {} + CreateLocalDeploymentResponse(const CreateLocalDeploymentResponse &) = default; + void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; } + Aws::Crt::Optional GetDeploymentId() noexcept { return m_deploymentId; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(CreateLocalDeploymentResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(CreateLocalDeploymentResponse *) noexcept; + /* This needs to be defined so that `CreateLocalDeploymentResponse` can be used as a key in maps. */ + bool operator<(const CreateLocalDeploymentResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_deploymentId; + }; + + class CreateLocalDeploymentRequest : public AbstractShapeBase + { + public: + CreateLocalDeploymentRequest() noexcept {} + CreateLocalDeploymentRequest(const CreateLocalDeploymentRequest &) = default; + void SetGroupName(const Aws::Crt::String &groupName) noexcept { m_groupName = groupName; } + Aws::Crt::Optional GetGroupName() noexcept { return m_groupName; } + void SetRootComponentVersionsToAdd( + const Aws::Crt::Map &rootComponentVersionsToAdd) noexcept + { + m_rootComponentVersionsToAdd = rootComponentVersionsToAdd; + } + Aws::Crt::Optional> + GetRootComponentVersionsToAdd() noexcept + { + return m_rootComponentVersionsToAdd; + } + void SetRootComponentsToRemove(const Aws::Crt::Vector &rootComponentsToRemove) noexcept + { + m_rootComponentsToRemove = rootComponentsToRemove; + } + Aws::Crt::Optional> GetRootComponentsToRemove() noexcept + { + return m_rootComponentsToRemove; + } + void SetComponentToConfiguration( + const Aws::Crt::Map &componentToConfiguration) noexcept + { + m_componentToConfiguration = componentToConfiguration; + } + Aws::Crt::Optional> + GetComponentToConfiguration() noexcept + { + return m_componentToConfiguration; + } + void SetComponentToRunWithInfo( + const Aws::Crt::Map &componentToRunWithInfo) noexcept + { + m_componentToRunWithInfo = componentToRunWithInfo; + } + Aws::Crt::Optional> GetComponentToRunWithInfo() noexcept + { + return m_componentToRunWithInfo; + } + void SetRecipeDirectoryPath(const Aws::Crt::String &recipeDirectoryPath) noexcept + { + m_recipeDirectoryPath = recipeDirectoryPath; + } + Aws::Crt::Optional GetRecipeDirectoryPath() noexcept { return m_recipeDirectoryPath; } + void SetArtifactsDirectoryPath(const Aws::Crt::String &artifactsDirectoryPath) noexcept + { + m_artifactsDirectoryPath = artifactsDirectoryPath; + } + Aws::Crt::Optional GetArtifactsDirectoryPath() noexcept + { + return m_artifactsDirectoryPath; + } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(CreateLocalDeploymentRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(CreateLocalDeploymentRequest *) noexcept; + /* This needs to be defined so that `CreateLocalDeploymentRequest` can be used as a key in maps. */ + bool operator<(const CreateLocalDeploymentRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_groupName; + Aws::Crt::Optional> m_rootComponentVersionsToAdd; + Aws::Crt::Optional> m_rootComponentsToRemove; + Aws::Crt::Optional> m_componentToConfiguration; + Aws::Crt::Optional> m_componentToRunWithInfo; + Aws::Crt::Optional m_recipeDirectoryPath; + Aws::Crt::Optional m_artifactsDirectoryPath; + }; + + class ServiceError : public OperationError + { + public: + ServiceError() noexcept {} + ServiceError(const ServiceError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(ServiceError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(ServiceError *) noexcept; + /* This needs to be defined so that `ServiceError` can be used as a key in maps. */ + bool operator<(const ServiceError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class UnauthorizedError : public OperationError + { + public: + UnauthorizedError() noexcept {} + UnauthorizedError(const UnauthorizedError &) = default; + void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; } + Aws::Crt::Optional GetMessage() noexcept override { return m_message; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(UnauthorizedError &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(UnauthorizedError *) noexcept; + /* This needs to be defined so that `UnauthorizedError` can be used as a key in maps. */ + bool operator<(const UnauthorizedError &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_message; + }; + + class CreateDebugPasswordResponse : public AbstractShapeBase + { + public: + CreateDebugPasswordResponse() noexcept {} + CreateDebugPasswordResponse(const CreateDebugPasswordResponse &) = default; + void SetPassword(const Aws::Crt::String &password) noexcept { m_password = password; } + Aws::Crt::Optional GetPassword() noexcept { return m_password; } + void SetUsername(const Aws::Crt::String &username) noexcept { m_username = username; } + Aws::Crt::Optional GetUsername() noexcept { return m_username; } + void SetPasswordExpiration(const Aws::Crt::DateTime &passwordExpiration) noexcept + { + m_passwordExpiration = passwordExpiration; + } + Aws::Crt::Optional GetPasswordExpiration() noexcept { return m_passwordExpiration; } + void SetCertificateSHA256Hash(const Aws::Crt::String &certificateSHA256Hash) noexcept + { + m_certificateSHA256Hash = certificateSHA256Hash; + } + Aws::Crt::Optional GetCertificateSHA256Hash() noexcept { return m_certificateSHA256Hash; } + void SetCertificateSHA1Hash(const Aws::Crt::String &certificateSHA1Hash) noexcept + { + m_certificateSHA1Hash = certificateSHA1Hash; + } + Aws::Crt::Optional GetCertificateSHA1Hash() noexcept { return m_certificateSHA1Hash; } + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(CreateDebugPasswordResponse &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(CreateDebugPasswordResponse *) noexcept; + /* This needs to be defined so that `CreateDebugPasswordResponse` can be used as a key in maps. */ + bool operator<(const CreateDebugPasswordResponse &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + Aws::Crt::Optional m_password; + Aws::Crt::Optional m_username; + Aws::Crt::Optional m_passwordExpiration; + Aws::Crt::Optional m_certificateSHA256Hash; + Aws::Crt::Optional m_certificateSHA1Hash; + }; + + class CreateDebugPasswordRequest : public AbstractShapeBase + { + public: + CreateDebugPasswordRequest() noexcept {} + CreateDebugPasswordRequest(const CreateDebugPasswordRequest &) = default; + void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override; + static void s_loadFromJsonView(CreateDebugPasswordRequest &, const Aws::Crt::JsonView &) noexcept; + static Aws::Crt::ScopedResource s_allocateFromPayload( + Aws::Crt::StringView, + Aws::Crt::Allocator *) noexcept; + static void s_customDeleter(CreateDebugPasswordRequest *) noexcept; + /* This needs to be defined so that `CreateDebugPasswordRequest` can be used as a key in maps. */ + bool operator<(const CreateDebugPasswordRequest &) const noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + + private: + }; + + class SubscribeToIoTCoreStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(IoTCoreMessage *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + virtual bool OnStreamError(UnauthorizedError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class SubscribeToIoTCoreOperationContext : public OperationModelContext + { + public: + SubscribeToIoTCoreOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class SubscribeToIoTCoreResult + { + public: + SubscribeToIoTCoreResult() noexcept {} + SubscribeToIoTCoreResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + SubscribeToIoTCoreResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class SubscribeToIoTCoreOperation : public ClientOperation + { + public: + SubscribeToIoTCoreOperation( + ClientConnection &connection, + SubscribeToIoTCoreStreamHandler *streamHandler, + const SubscribeToIoTCoreOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const SubscribeToIoTCoreRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class PublishToIoTCoreOperationContext : public OperationModelContext + { + public: + PublishToIoTCoreOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class PublishToIoTCoreResult + { + public: + PublishToIoTCoreResult() noexcept {} + PublishToIoTCoreResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + PublishToIoTCoreResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class PublishToIoTCoreOperation : public ClientOperation + { + public: + PublishToIoTCoreOperation( + ClientConnection &connection, + const PublishToIoTCoreOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const PublishToIoTCoreRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class SubscribeToConfigurationUpdateStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(ConfigurationUpdateEvents *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ResourceNotFoundError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class SubscribeToConfigurationUpdateOperationContext : public OperationModelContext + { + public: + SubscribeToConfigurationUpdateOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class SubscribeToConfigurationUpdateResult + { + public: + SubscribeToConfigurationUpdateResult() noexcept {} + SubscribeToConfigurationUpdateResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + SubscribeToConfigurationUpdateResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class SubscribeToConfigurationUpdateOperation : public ClientOperation + { + public: + SubscribeToConfigurationUpdateOperation( + ClientConnection &connection, + SubscribeToConfigurationUpdateStreamHandler *streamHandler, + const SubscribeToConfigurationUpdateOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const SubscribeToConfigurationUpdateRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class DeleteThingShadowOperationContext : public OperationModelContext + { + public: + DeleteThingShadowOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class DeleteThingShadowResult + { + public: + DeleteThingShadowResult() noexcept {} + DeleteThingShadowResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + DeleteThingShadowResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class DeleteThingShadowOperation : public ClientOperation + { + public: + DeleteThingShadowOperation( + ClientConnection &connection, + const DeleteThingShadowOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const DeleteThingShadowRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class DeferComponentUpdateOperationContext : public OperationModelContext + { + public: + DeferComponentUpdateOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class DeferComponentUpdateResult + { + public: + DeferComponentUpdateResult() noexcept {} + DeferComponentUpdateResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) + { + } + DeferComponentUpdateResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class DeferComponentUpdateOperation : public ClientOperation + { + public: + DeferComponentUpdateOperation( + ClientConnection &connection, + const DeferComponentUpdateOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const DeferComponentUpdateRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class SubscribeToValidateConfigurationUpdatesStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(ValidateConfigurationUpdateEvents *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class SubscribeToValidateConfigurationUpdatesOperationContext : public OperationModelContext + { + public: + SubscribeToValidateConfigurationUpdatesOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class SubscribeToValidateConfigurationUpdatesResult + { + public: + SubscribeToValidateConfigurationUpdatesResult() noexcept {} + SubscribeToValidateConfigurationUpdatesResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + SubscribeToValidateConfigurationUpdatesResponse *GetOperationResponse() const noexcept + { + return static_cast( + m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class SubscribeToValidateConfigurationUpdatesOperation : public ClientOperation + { + public: + SubscribeToValidateConfigurationUpdatesOperation( + ClientConnection &connection, + SubscribeToValidateConfigurationUpdatesStreamHandler *streamHandler, + const SubscribeToValidateConfigurationUpdatesOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const SubscribeToValidateConfigurationUpdatesRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GetConfigurationOperationContext : public OperationModelContext + { + public: + GetConfigurationOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetConfigurationResult + { + public: + GetConfigurationResult() noexcept {} + GetConfigurationResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + GetConfigurationResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetConfigurationOperation : public ClientOperation + { + public: + GetConfigurationOperation( + ClientConnection &connection, + const GetConfigurationOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetConfigurationRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class SubscribeToTopicStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(SubscriptionResponseMessage *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + virtual bool OnStreamError(InvalidArgumentsError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + virtual bool OnStreamError(UnauthorizedError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class SubscribeToTopicOperationContext : public OperationModelContext + { + public: + SubscribeToTopicOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class SubscribeToTopicResult + { + public: + SubscribeToTopicResult() noexcept {} + SubscribeToTopicResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + SubscribeToTopicResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class SubscribeToTopicOperation : public ClientOperation + { + public: + SubscribeToTopicOperation( + ClientConnection &connection, + SubscribeToTopicStreamHandler *streamHandler, + const SubscribeToTopicOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const SubscribeToTopicRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GetComponentDetailsOperationContext : public OperationModelContext + { + public: + GetComponentDetailsOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetComponentDetailsResult + { + public: + GetComponentDetailsResult() noexcept {} + GetComponentDetailsResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + GetComponentDetailsResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetComponentDetailsOperation : public ClientOperation + { + public: + GetComponentDetailsOperation( + ClientConnection &connection, + const GetComponentDetailsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetComponentDetailsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class PublishToTopicOperationContext : public OperationModelContext + { + public: + PublishToTopicOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class PublishToTopicResult + { + public: + PublishToTopicResult() noexcept {} + PublishToTopicResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + PublishToTopicResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class PublishToTopicOperation : public ClientOperation + { + public: + PublishToTopicOperation( + ClientConnection &connection, + const PublishToTopicOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const PublishToTopicRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class ListComponentsOperationContext : public OperationModelContext + { + public: + ListComponentsOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class ListComponentsResult + { + public: + ListComponentsResult() noexcept {} + ListComponentsResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + ListComponentsResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class ListComponentsOperation : public ClientOperation + { + public: + ListComponentsOperation( + ClientConnection &connection, + const ListComponentsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const ListComponentsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class CreateDebugPasswordOperationContext : public OperationModelContext + { + public: + CreateDebugPasswordOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class CreateDebugPasswordResult + { + public: + CreateDebugPasswordResult() noexcept {} + CreateDebugPasswordResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + CreateDebugPasswordResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class CreateDebugPasswordOperation : public ClientOperation + { + public: + CreateDebugPasswordOperation( + ClientConnection &connection, + const CreateDebugPasswordOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const CreateDebugPasswordRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GetThingShadowOperationContext : public OperationModelContext + { + public: + GetThingShadowOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetThingShadowResult + { + public: + GetThingShadowResult() noexcept {} + GetThingShadowResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + GetThingShadowResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetThingShadowOperation : public ClientOperation + { + public: + GetThingShadowOperation( + ClientConnection &connection, + const GetThingShadowOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetThingShadowRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class SendConfigurationValidityReportOperationContext : public OperationModelContext + { + public: + SendConfigurationValidityReportOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class SendConfigurationValidityReportResult + { + public: + SendConfigurationValidityReportResult() noexcept {} + SendConfigurationValidityReportResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + SendConfigurationValidityReportResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class SendConfigurationValidityReportOperation : public ClientOperation + { + public: + SendConfigurationValidityReportOperation( + ClientConnection &connection, + const SendConfigurationValidityReportOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const SendConfigurationValidityReportRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class UpdateThingShadowOperationContext : public OperationModelContext + { + public: + UpdateThingShadowOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class UpdateThingShadowResult + { + public: + UpdateThingShadowResult() noexcept {} + UpdateThingShadowResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + UpdateThingShadowResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class UpdateThingShadowOperation : public ClientOperation + { + public: + UpdateThingShadowOperation( + ClientConnection &connection, + const UpdateThingShadowOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const UpdateThingShadowRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class UpdateConfigurationOperationContext : public OperationModelContext + { + public: + UpdateConfigurationOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class UpdateConfigurationResult + { + public: + UpdateConfigurationResult() noexcept {} + UpdateConfigurationResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + UpdateConfigurationResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class UpdateConfigurationOperation : public ClientOperation + { + public: + UpdateConfigurationOperation( + ClientConnection &connection, + const UpdateConfigurationOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const UpdateConfigurationRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class ValidateAuthorizationTokenOperationContext : public OperationModelContext + { + public: + ValidateAuthorizationTokenOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class ValidateAuthorizationTokenResult + { + public: + ValidateAuthorizationTokenResult() noexcept {} + ValidateAuthorizationTokenResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + ValidateAuthorizationTokenResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class ValidateAuthorizationTokenOperation : public ClientOperation + { + public: + ValidateAuthorizationTokenOperation( + ClientConnection &connection, + const ValidateAuthorizationTokenOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const ValidateAuthorizationTokenRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class RestartComponentOperationContext : public OperationModelContext + { + public: + RestartComponentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class RestartComponentResult + { + public: + RestartComponentResult() noexcept {} + RestartComponentResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + RestartComponentResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class RestartComponentOperation : public ClientOperation + { + public: + RestartComponentOperation( + ClientConnection &connection, + const RestartComponentOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const RestartComponentRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GetLocalDeploymentStatusOperationContext : public OperationModelContext + { + public: + GetLocalDeploymentStatusOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetLocalDeploymentStatusResult + { + public: + GetLocalDeploymentStatusResult() noexcept {} + GetLocalDeploymentStatusResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + GetLocalDeploymentStatusResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetLocalDeploymentStatusOperation : public ClientOperation + { + public: + GetLocalDeploymentStatusOperation( + ClientConnection &connection, + const GetLocalDeploymentStatusOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetLocalDeploymentStatusRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GetSecretValueOperationContext : public OperationModelContext + { + public: + GetSecretValueOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class GetSecretValueResult + { + public: + GetSecretValueResult() noexcept {} + GetSecretValueResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + GetSecretValueResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class GetSecretValueOperation : public ClientOperation + { + public: + GetSecretValueOperation( + ClientConnection &connection, + const GetSecretValueOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const GetSecretValueRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class UpdateStateOperationContext : public OperationModelContext + { + public: + UpdateStateOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class UpdateStateResult + { + public: + UpdateStateResult() noexcept {} + UpdateStateResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + UpdateStateResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class UpdateStateOperation : public ClientOperation + { + public: + UpdateStateOperation( + ClientConnection &connection, + const UpdateStateOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const UpdateStateRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class ListNamedShadowsForThingOperationContext : public OperationModelContext + { + public: + ListNamedShadowsForThingOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class ListNamedShadowsForThingResult + { + public: + ListNamedShadowsForThingResult() noexcept {} + ListNamedShadowsForThingResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + ListNamedShadowsForThingResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class ListNamedShadowsForThingOperation : public ClientOperation + { + public: + ListNamedShadowsForThingOperation( + ClientConnection &connection, + const ListNamedShadowsForThingOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const ListNamedShadowsForThingRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class SubscribeToComponentUpdatesStreamHandler : public StreamResponseHandler + { + public: + virtual void OnStreamEvent(ComponentUpdatePolicyEvents *response) { (void)response; } + virtual bool OnStreamError(RpcError rpcError) + { + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + virtual bool OnStreamError(ResourceNotFoundError *operationError, RpcError rpcError) + { + (void)operationError; + (void)rpcError; + return true; + } + + private: + /** + * Invoked when a message is received on this continuation. + */ + void OnStreamEvent(Aws::Crt::ScopedResource response) override; + /** + * Invoked when a message is received on this continuation but results in an error. + * + * This callback can return true so that the stream is closed afterwards. + */ + bool OnStreamError(Aws::Crt::ScopedResource error, RpcError rpcError) override; + }; + class SubscribeToComponentUpdatesOperationContext : public OperationModelContext + { + public: + SubscribeToComponentUpdatesOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class SubscribeToComponentUpdatesResult + { + public: + SubscribeToComponentUpdatesResult() noexcept {} + SubscribeToComponentUpdatesResult(TaggedResult &&taggedResult) noexcept + : m_taggedResult(std::move(taggedResult)) + { + } + SubscribeToComponentUpdatesResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class SubscribeToComponentUpdatesOperation : public ClientOperation + { + public: + SubscribeToComponentUpdatesOperation( + ClientConnection &connection, + SubscribeToComponentUpdatesStreamHandler *streamHandler, + const SubscribeToComponentUpdatesOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const SubscribeToComponentUpdatesRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class ListLocalDeploymentsOperationContext : public OperationModelContext + { + public: + ListLocalDeploymentsOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class ListLocalDeploymentsResult + { + public: + ListLocalDeploymentsResult() noexcept {} + ListLocalDeploymentsResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) + { + } + ListLocalDeploymentsResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class ListLocalDeploymentsOperation : public ClientOperation + { + public: + ListLocalDeploymentsOperation( + ClientConnection &connection, + const ListLocalDeploymentsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const ListLocalDeploymentsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class StopComponentOperationContext : public OperationModelContext + { + public: + StopComponentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class StopComponentResult + { + public: + StopComponentResult() noexcept {} + StopComponentResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) {} + StopComponentResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class StopComponentOperation : public ClientOperation + { + public: + StopComponentOperation( + ClientConnection &connection, + const StopComponentOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const StopComponentRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class CreateLocalDeploymentOperationContext : public OperationModelContext + { + public: + CreateLocalDeploymentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; + Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::String GetRequestModelName() const noexcept override; + Aws::Crt::String GetInitialResponseModelName() const noexcept override; + Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; + Aws::Crt::String GetOperationName() const noexcept override; + }; + + class CreateLocalDeploymentResult + { + public: + CreateLocalDeploymentResult() noexcept {} + CreateLocalDeploymentResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult)) + { + } + CreateLocalDeploymentResponse *GetOperationResponse() const noexcept + { + return static_cast(m_taggedResult.GetOperationResponse()); + } + /** + * @return true if the response is associated with an expected response; + * false if the response is associated with an error. + */ + operator bool() const noexcept { return m_taggedResult == true; } + OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); } + RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); } + ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); } + + private: + TaggedResult m_taggedResult; + }; + + class CreateLocalDeploymentOperation : public ClientOperation + { + public: + CreateLocalDeploymentOperation( + ClientConnection &connection, + const CreateLocalDeploymentOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept; + std::future Activate( + const CreateLocalDeploymentRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept; + std::future GetResult() noexcept; + + protected: + Aws::Crt::String GetModelName() const noexcept override; + }; + + class GreengrassCoreIpcServiceModel : public ServiceModel + { + public: + GreengrassCoreIpcServiceModel() noexcept; + Aws::Crt::ScopedResource AllocateOperationErrorFromPayload( + const Aws::Crt::String &errorModelName, + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept override; + void AssignModelNameToErrorResponse(Aws::Crt::String, ErrorResponseFactory) noexcept; + + private: + friend class GreengrassCoreIpcClient; + SubscribeToIoTCoreOperationContext m_subscribeToIoTCoreOperationContext; + PublishToIoTCoreOperationContext m_publishToIoTCoreOperationContext; + SubscribeToConfigurationUpdateOperationContext m_subscribeToConfigurationUpdateOperationContext; + DeleteThingShadowOperationContext m_deleteThingShadowOperationContext; + DeferComponentUpdateOperationContext m_deferComponentUpdateOperationContext; + SubscribeToValidateConfigurationUpdatesOperationContext + m_subscribeToValidateConfigurationUpdatesOperationContext; + GetConfigurationOperationContext m_getConfigurationOperationContext; + SubscribeToTopicOperationContext m_subscribeToTopicOperationContext; + GetComponentDetailsOperationContext m_getComponentDetailsOperationContext; + PublishToTopicOperationContext m_publishToTopicOperationContext; + ListComponentsOperationContext m_listComponentsOperationContext; + CreateDebugPasswordOperationContext m_createDebugPasswordOperationContext; + GetThingShadowOperationContext m_getThingShadowOperationContext; + SendConfigurationValidityReportOperationContext m_sendConfigurationValidityReportOperationContext; + UpdateThingShadowOperationContext m_updateThingShadowOperationContext; + UpdateConfigurationOperationContext m_updateConfigurationOperationContext; + ValidateAuthorizationTokenOperationContext m_validateAuthorizationTokenOperationContext; + RestartComponentOperationContext m_restartComponentOperationContext; + GetLocalDeploymentStatusOperationContext m_getLocalDeploymentStatusOperationContext; + GetSecretValueOperationContext m_getSecretValueOperationContext; + UpdateStateOperationContext m_updateStateOperationContext; + ListNamedShadowsForThingOperationContext m_listNamedShadowsForThingOperationContext; + SubscribeToComponentUpdatesOperationContext m_subscribeToComponentUpdatesOperationContext; + ListLocalDeploymentsOperationContext m_listLocalDeploymentsOperationContext; + StopComponentOperationContext m_stopComponentOperationContext; + CreateLocalDeploymentOperationContext m_createLocalDeploymentOperationContext; + Aws::Crt::Map m_modelNameToErrorResponse; + }; + } // namespace Greengrass +} // namespace Aws diff --git a/greengrass_ipc/source/DefaultConnectionConfig.cpp b/greengrass_ipc/source/DefaultConnectionConfig.cpp new file mode 100644 index 000000000..b34e0a4ca --- /dev/null +++ b/greengrass_ipc/source/DefaultConnectionConfig.cpp @@ -0,0 +1,37 @@ +#include + +#include + +#if defined(_MSC_VER) +# pragma warning(disable : 4996) +#endif + +namespace Aws +{ + namespace Greengrass + { + DefaultConnectionConfig::DefaultConnectionConfig() noexcept + { + const char *ipcSocketCStr = std::getenv("AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT"); + if (ipcSocketCStr != nullptr) + { + m_hostName = Crt::String(ipcSocketCStr); + } + + const char *authTokenCStr = std::getenv("SVCUID"); + if (authTokenCStr != nullptr) + { + /* Encode authToken as JSON. */ + Crt::StringStream authTokenPayloadSS; + authTokenPayloadSS << "{\"authToken\":\"" << Crt::String(authTokenCStr) << "\"}"; + m_connectAmendment = MessageAmendment(Crt::ByteBufFromCString(authTokenPayloadSS.str().c_str())); + } + + m_port = static_cast(0); + Crt::Io::SocketOptions socketOptions; + socketOptions.SetSocketDomain(Crt::Io::SocketDomain::Local); + socketOptions.SetSocketType(Crt::Io::SocketType::Stream); + m_socketOptions = std::move(socketOptions); + } + } // namespace Greengrass +} // namespace Aws diff --git a/greengrass_ipc/source/GreengrassCoreIpcClient.cpp b/greengrass_ipc/source/GreengrassCoreIpcClient.cpp new file mode 100644 index 000000000..a8ad37227 --- /dev/null +++ b/greengrass_ipc/source/GreengrassCoreIpcClient.cpp @@ -0,0 +1,207 @@ +#include +#include + +namespace Aws +{ + namespace Greengrass + { + GreengrassCoreIpcClient::GreengrassCoreIpcClient( + Aws::Crt::Io::ClientBootstrap &clientBootstrap, + Aws::Crt::Allocator *allocator) noexcept + : m_connection(allocator), m_clientBootstrap(clientBootstrap), m_allocator(allocator) + { + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#InvalidTokenError"), InvalidTokenError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#FailedUpdateConditionCheckError"), + FailedUpdateConditionCheckError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#ConflictError"), ConflictError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#ComponentNotFoundError"), + ComponentNotFoundError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#ResourceNotFoundError"), ResourceNotFoundError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#InvalidArgumentsError"), InvalidArgumentsError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#InvalidArtifactsDirectoryPathError"), + InvalidArtifactsDirectoryPathError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#InvalidRecipeDirectoryPathError"), + InvalidRecipeDirectoryPathError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#ServiceError"), ServiceError::s_allocateFromPayload); + m_greengrassCoreIpcServiceModel.AssignModelNameToErrorResponse( + Aws::Crt::String("aws.greengrass#UnauthorizedError"), UnauthorizedError::s_allocateFromPayload); + } + + std::future GreengrassCoreIpcClient::Connect( + ConnectionLifecycleHandler &lifecycleHandler, + const ConnectionConfig &connectionConfig) noexcept + { + return m_connection.Connect(connectionConfig, &lifecycleHandler, m_clientBootstrap); + } + + void GreengrassCoreIpcClient::Close() noexcept { m_connection.Close(); } + + GreengrassCoreIpcClient::~GreengrassCoreIpcClient() noexcept { Close(); } + + SubscribeToIoTCoreOperation GreengrassCoreIpcClient::NewSubscribeToIoTCore( + SubscribeToIoTCoreStreamHandler &streamHandler) noexcept + { + return SubscribeToIoTCoreOperation( + m_connection, + &streamHandler, + m_greengrassCoreIpcServiceModel.m_subscribeToIoTCoreOperationContext, + m_allocator); + } + PublishToIoTCoreOperation GreengrassCoreIpcClient::NewPublishToIoTCore() noexcept + { + return PublishToIoTCoreOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_publishToIoTCoreOperationContext, m_allocator); + } + SubscribeToConfigurationUpdateOperation GreengrassCoreIpcClient::NewSubscribeToConfigurationUpdate( + SubscribeToConfigurationUpdateStreamHandler &streamHandler) noexcept + { + return SubscribeToConfigurationUpdateOperation( + m_connection, + &streamHandler, + m_greengrassCoreIpcServiceModel.m_subscribeToConfigurationUpdateOperationContext, + m_allocator); + } + DeleteThingShadowOperation GreengrassCoreIpcClient::NewDeleteThingShadow() noexcept + { + return DeleteThingShadowOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_deleteThingShadowOperationContext, m_allocator); + } + DeferComponentUpdateOperation GreengrassCoreIpcClient::NewDeferComponentUpdate() noexcept + { + return DeferComponentUpdateOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_deferComponentUpdateOperationContext, m_allocator); + } + SubscribeToValidateConfigurationUpdatesOperation GreengrassCoreIpcClient:: + NewSubscribeToValidateConfigurationUpdates( + SubscribeToValidateConfigurationUpdatesStreamHandler &streamHandler) noexcept + { + return SubscribeToValidateConfigurationUpdatesOperation( + m_connection, + &streamHandler, + m_greengrassCoreIpcServiceModel.m_subscribeToValidateConfigurationUpdatesOperationContext, + m_allocator); + } + GetConfigurationOperation GreengrassCoreIpcClient::NewGetConfiguration() noexcept + { + return GetConfigurationOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_getConfigurationOperationContext, m_allocator); + } + SubscribeToTopicOperation GreengrassCoreIpcClient::NewSubscribeToTopic( + SubscribeToTopicStreamHandler &streamHandler) noexcept + { + return SubscribeToTopicOperation( + m_connection, + &streamHandler, + m_greengrassCoreIpcServiceModel.m_subscribeToTopicOperationContext, + m_allocator); + } + GetComponentDetailsOperation GreengrassCoreIpcClient::NewGetComponentDetails() noexcept + { + return GetComponentDetailsOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_getComponentDetailsOperationContext, m_allocator); + } + PublishToTopicOperation GreengrassCoreIpcClient::NewPublishToTopic() noexcept + { + return PublishToTopicOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_publishToTopicOperationContext, m_allocator); + } + ListComponentsOperation GreengrassCoreIpcClient::NewListComponents() noexcept + { + return ListComponentsOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_listComponentsOperationContext, m_allocator); + } + CreateDebugPasswordOperation GreengrassCoreIpcClient::NewCreateDebugPassword() noexcept + { + return CreateDebugPasswordOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_createDebugPasswordOperationContext, m_allocator); + } + GetThingShadowOperation GreengrassCoreIpcClient::NewGetThingShadow() noexcept + { + return GetThingShadowOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_getThingShadowOperationContext, m_allocator); + } + SendConfigurationValidityReportOperation GreengrassCoreIpcClient::NewSendConfigurationValidityReport() noexcept + { + return SendConfigurationValidityReportOperation( + m_connection, + m_greengrassCoreIpcServiceModel.m_sendConfigurationValidityReportOperationContext, + m_allocator); + } + UpdateThingShadowOperation GreengrassCoreIpcClient::NewUpdateThingShadow() noexcept + { + return UpdateThingShadowOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_updateThingShadowOperationContext, m_allocator); + } + UpdateConfigurationOperation GreengrassCoreIpcClient::NewUpdateConfiguration() noexcept + { + return UpdateConfigurationOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_updateConfigurationOperationContext, m_allocator); + } + ValidateAuthorizationTokenOperation GreengrassCoreIpcClient::NewValidateAuthorizationToken() noexcept + { + return ValidateAuthorizationTokenOperation( + m_connection, + m_greengrassCoreIpcServiceModel.m_validateAuthorizationTokenOperationContext, + m_allocator); + } + RestartComponentOperation GreengrassCoreIpcClient::NewRestartComponent() noexcept + { + return RestartComponentOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_restartComponentOperationContext, m_allocator); + } + GetLocalDeploymentStatusOperation GreengrassCoreIpcClient::NewGetLocalDeploymentStatus() noexcept + { + return GetLocalDeploymentStatusOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_getLocalDeploymentStatusOperationContext, m_allocator); + } + GetSecretValueOperation GreengrassCoreIpcClient::NewGetSecretValue() noexcept + { + return GetSecretValueOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_getSecretValueOperationContext, m_allocator); + } + UpdateStateOperation GreengrassCoreIpcClient::NewUpdateState() noexcept + { + return UpdateStateOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_updateStateOperationContext, m_allocator); + } + ListNamedShadowsForThingOperation GreengrassCoreIpcClient::NewListNamedShadowsForThing() noexcept + { + return ListNamedShadowsForThingOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_listNamedShadowsForThingOperationContext, m_allocator); + } + SubscribeToComponentUpdatesOperation GreengrassCoreIpcClient::NewSubscribeToComponentUpdates( + SubscribeToComponentUpdatesStreamHandler &streamHandler) noexcept + { + return SubscribeToComponentUpdatesOperation( + m_connection, + &streamHandler, + m_greengrassCoreIpcServiceModel.m_subscribeToComponentUpdatesOperationContext, + m_allocator); + } + ListLocalDeploymentsOperation GreengrassCoreIpcClient::NewListLocalDeployments() noexcept + { + return ListLocalDeploymentsOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_listLocalDeploymentsOperationContext, m_allocator); + } + StopComponentOperation GreengrassCoreIpcClient::NewStopComponent() noexcept + { + return StopComponentOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_stopComponentOperationContext, m_allocator); + } + CreateLocalDeploymentOperation GreengrassCoreIpcClient::NewCreateLocalDeployment() noexcept + { + return CreateLocalDeploymentOperation( + m_connection, m_greengrassCoreIpcServiceModel.m_createLocalDeploymentOperationContext, m_allocator); + } + + } // namespace Greengrass +} // namespace Aws diff --git a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp new file mode 100644 index 000000000..3407baba6 --- /dev/null +++ b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp @@ -0,0 +1,6626 @@ +#include +#include + +namespace Aws +{ + namespace Greengrass + { + void ValidateConfigurationUpdateEvent::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_configuration.has_value()) + { + payloadObject.WithObject("configuration", m_configuration.value()); + } + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + } + + void ValidateConfigurationUpdateEvent::s_loadFromJsonView( + ValidateConfigurationUpdateEvent &validateConfigurationUpdateEvent, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("configuration")) + { + validateConfigurationUpdateEvent.m_configuration = + Aws::Crt::Optional(jsonView.GetJsonObject("configuration").Materialize()); + } + if (jsonView.ValueExists("deploymentId")) + { + validateConfigurationUpdateEvent.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + } + + Aws::Crt::String ValidateConfigurationUpdateEvent::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvent"); + } + + Aws::Crt::ScopedResource ValidateConfigurationUpdateEvent::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + ValidateConfigurationUpdateEvent::s_customDeleter); + shape->m_allocator = allocator; + ValidateConfigurationUpdateEvent::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ValidateConfigurationUpdateEvent::s_customDeleter(ValidateConfigurationUpdateEvent *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void MQTTMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_topicName.has_value()) + { + payloadObject.WithString("topicName", m_topicName.value()); + } + if (m_payload.has_value()) + { + if (m_payload.value().size() > 0) + { + payloadObject.WithString("payload", Aws::Crt::Base64Encode(m_payload.value())); + } + } + } + + void MQTTMessage::s_loadFromJsonView(MQTTMessage &mQTTMessage, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("topicName")) + { + mQTTMessage.m_topicName = Aws::Crt::Optional(jsonView.GetString("topicName")); + } + if (jsonView.ValueExists("payload")) + { + if (jsonView.GetString("payload").size() > 0) + { + mQTTMessage.m_payload = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("payload"))); + } + } + } + + Aws::Crt::String MQTTMessage::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#MQTTMessage"); + } + + Aws::Crt::ScopedResource MQTTMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), MQTTMessage::s_customDeleter); + shape->m_allocator = allocator; + MQTTMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void MQTTMessage::s_customDeleter(MQTTMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ConfigurationUpdateEvent::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + if (m_keyPath.has_value()) + { + Aws::Crt::JsonObject keyPath; + Aws::Crt::Vector keyPathJsonArray; + for (const auto &keyPathItem : m_keyPath.value()) + { + Aws::Crt::JsonObject keyPathJsonArrayItem; + keyPathJsonArrayItem.AsString(keyPathItem); + keyPathJsonArray.emplace_back(std::move(keyPathJsonArrayItem)); + } + keyPath.AsArray(std::move(keyPathJsonArray)); + payloadObject.WithObject("keyPath", std::move(keyPath)); + } + } + + void ConfigurationUpdateEvent::s_loadFromJsonView( + ConfigurationUpdateEvent &configurationUpdateEvent, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + configurationUpdateEvent.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + if (jsonView.ValueExists("keyPath")) + { + configurationUpdateEvent.m_keyPath = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &keyPathJsonView : jsonView.GetArray("keyPath")) + { + Aws::Crt::Optional keyPathItem; + keyPathItem = Aws::Crt::Optional(keyPathJsonView.AsString()); + configurationUpdateEvent.m_keyPath.value().push_back(keyPathItem.value()); + } + } + } + + Aws::Crt::String ConfigurationUpdateEvent::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvent"); + } + + Aws::Crt::ScopedResource ConfigurationUpdateEvent::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ConfigurationUpdateEvent::s_customDeleter); + shape->m_allocator = allocator; + ConfigurationUpdateEvent::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ConfigurationUpdateEvent::s_customDeleter(ConfigurationUpdateEvent *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PostComponentUpdateEvent::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + } + + void PostComponentUpdateEvent::s_loadFromJsonView( + PostComponentUpdateEvent &postComponentUpdateEvent, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deploymentId")) + { + postComponentUpdateEvent.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + } + + Aws::Crt::String PostComponentUpdateEvent::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PostComponentUpdateEvent"); + } + + Aws::Crt::ScopedResource PostComponentUpdateEvent::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PostComponentUpdateEvent::s_customDeleter); + shape->m_allocator = allocator; + PostComponentUpdateEvent::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PostComponentUpdateEvent::s_customDeleter(PostComponentUpdateEvent *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PreComponentUpdateEvent::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + if (m_isGgcRestarting.has_value()) + { + payloadObject.WithBool("isGgcRestarting", m_isGgcRestarting.value()); + } + } + + void PreComponentUpdateEvent::s_loadFromJsonView( + PreComponentUpdateEvent &preComponentUpdateEvent, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deploymentId")) + { + preComponentUpdateEvent.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + if (jsonView.ValueExists("isGgcRestarting")) + { + preComponentUpdateEvent.m_isGgcRestarting = + Aws::Crt::Optional(jsonView.GetBool("isGgcRestarting")); + } + } + + Aws::Crt::String PreComponentUpdateEvent::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PreComponentUpdateEvent"); + } + + Aws::Crt::ScopedResource PreComponentUpdateEvent::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PreComponentUpdateEvent::s_customDeleter); + shape->m_allocator = allocator; + PreComponentUpdateEvent::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PreComponentUpdateEvent::s_customDeleter(PreComponentUpdateEvent *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void BinaryMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + if (m_message.value().size() > 0) + { + payloadObject.WithString("message", Aws::Crt::Base64Encode(m_message.value())); + } + } + } + + void BinaryMessage::s_loadFromJsonView( + BinaryMessage &binaryMessage, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + if (jsonView.GetString("message").size() > 0) + { + binaryMessage.m_message = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("message"))); + } + } + } + + Aws::Crt::String BinaryMessage::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#BinaryMessage"); + } + + Aws::Crt::ScopedResource BinaryMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), BinaryMessage::s_customDeleter); + shape->m_allocator = allocator; + BinaryMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void BinaryMessage::s_customDeleter(BinaryMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void JsonMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithObject("message", m_message.value()); + } + } + + void JsonMessage::s_loadFromJsonView(JsonMessage &jsonMessage, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + jsonMessage.m_message = + Aws::Crt::Optional(jsonView.GetJsonObject("message").Materialize()); + } + } + + Aws::Crt::String JsonMessage::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#JsonMessage"); + } + + Aws::Crt::ScopedResource JsonMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), JsonMessage::s_customDeleter); + shape->m_allocator = allocator; + JsonMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void JsonMessage::s_customDeleter(JsonMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void RunWithInfo::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_posixUser.has_value()) + { + payloadObject.WithString("posixUser", m_posixUser.value()); + } + } + + void RunWithInfo::s_loadFromJsonView(RunWithInfo &runWithInfo, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("posixUser")) + { + runWithInfo.m_posixUser = Aws::Crt::Optional(jsonView.GetString("posixUser")); + } + } + + Aws::Crt::String RunWithInfo::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#RunWithInfo"); + } + + Aws::Crt::ScopedResource RunWithInfo::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), RunWithInfo::s_customDeleter); + shape->m_allocator = allocator; + RunWithInfo::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void RunWithInfo::s_customDeleter(RunWithInfo *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ValidateConfigurationUpdateEvents::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + if (m_chosenMember == TAG_VALIDATE_CONFIGURATION_UPDATE_EVENT && + m_validateConfigurationUpdateEvent.has_value()) + { + Aws::Crt::JsonObject validateConfigurationUpdateEventValue; + m_validateConfigurationUpdateEvent.value().SerializeToJsonObject(validateConfigurationUpdateEventValue); + payloadObject.WithObject( + "validateConfigurationUpdateEvent", std::move(validateConfigurationUpdateEventValue)); + } + } + + void ValidateConfigurationUpdateEvents::s_loadFromJsonView( + ValidateConfigurationUpdateEvents &validateConfigurationUpdateEvents, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("validateConfigurationUpdateEvent")) + { + validateConfigurationUpdateEvents.m_validateConfigurationUpdateEvent = + ValidateConfigurationUpdateEvent(); + ValidateConfigurationUpdateEvent::s_loadFromJsonView( + validateConfigurationUpdateEvents.m_validateConfigurationUpdateEvent.value(), + jsonView.GetJsonObject("validateConfigurationUpdateEvent")); + validateConfigurationUpdateEvents.m_chosenMember = TAG_VALIDATE_CONFIGURATION_UPDATE_EVENT; + } + } + + ValidateConfigurationUpdateEvents &ValidateConfigurationUpdateEvents::operator=( + const ValidateConfigurationUpdateEvents &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_VALIDATE_CONFIGURATION_UPDATE_EVENT) + { + m_validateConfigurationUpdateEvent = objectToCopy.m_validateConfigurationUpdateEvent; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String ValidateConfigurationUpdateEvents::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvents"); + } + + Aws::Crt::ScopedResource ValidateConfigurationUpdateEvents::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + ValidateConfigurationUpdateEvents::s_customDeleter); + shape->m_allocator = allocator; + ValidateConfigurationUpdateEvents::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ValidateConfigurationUpdateEvents::s_customDeleter(ValidateConfigurationUpdateEvents *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscriptionResponseMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_JSON_MESSAGE && m_jsonMessage.has_value()) + { + Aws::Crt::JsonObject jsonMessageValue; + m_jsonMessage.value().SerializeToJsonObject(jsonMessageValue); + payloadObject.WithObject("jsonMessage", std::move(jsonMessageValue)); + } + else if (m_chosenMember == TAG_BINARY_MESSAGE && m_binaryMessage.has_value()) + { + Aws::Crt::JsonObject binaryMessageValue; + m_binaryMessage.value().SerializeToJsonObject(binaryMessageValue); + payloadObject.WithObject("binaryMessage", std::move(binaryMessageValue)); + } + } + + void SubscriptionResponseMessage::s_loadFromJsonView( + SubscriptionResponseMessage &subscriptionResponseMessage, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("jsonMessage")) + { + subscriptionResponseMessage.m_jsonMessage = JsonMessage(); + JsonMessage::s_loadFromJsonView( + subscriptionResponseMessage.m_jsonMessage.value(), jsonView.GetJsonObject("jsonMessage")); + subscriptionResponseMessage.m_chosenMember = TAG_JSON_MESSAGE; + } + else if (jsonView.ValueExists("binaryMessage")) + { + subscriptionResponseMessage.m_binaryMessage = BinaryMessage(); + BinaryMessage::s_loadFromJsonView( + subscriptionResponseMessage.m_binaryMessage.value(), jsonView.GetJsonObject("binaryMessage")); + subscriptionResponseMessage.m_chosenMember = TAG_BINARY_MESSAGE; + } + } + + SubscriptionResponseMessage &SubscriptionResponseMessage::operator=( + const SubscriptionResponseMessage &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_JSON_MESSAGE) + { + m_jsonMessage = objectToCopy.m_jsonMessage; + m_chosenMember = objectToCopy.m_chosenMember; + } + else if (objectToCopy.m_chosenMember == TAG_BINARY_MESSAGE) + { + m_binaryMessage = objectToCopy.m_binaryMessage; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String SubscriptionResponseMessage::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscriptionResponseMessage"); + } + + Aws::Crt::ScopedResource SubscriptionResponseMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), SubscriptionResponseMessage::s_customDeleter); + shape->m_allocator = allocator; + SubscriptionResponseMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscriptionResponseMessage::s_customDeleter(SubscriptionResponseMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void IoTCoreMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_MESSAGE && m_message.has_value()) + { + Aws::Crt::JsonObject mQTTMessageValue; + m_message.value().SerializeToJsonObject(mQTTMessageValue); + payloadObject.WithObject("message", std::move(mQTTMessageValue)); + } + } + + void IoTCoreMessage::s_loadFromJsonView( + IoTCoreMessage &ioTCoreMessage, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + ioTCoreMessage.m_message = MQTTMessage(); + MQTTMessage::s_loadFromJsonView(ioTCoreMessage.m_message.value(), jsonView.GetJsonObject("message")); + ioTCoreMessage.m_chosenMember = TAG_MESSAGE; + } + } + + IoTCoreMessage &IoTCoreMessage::operator=(const IoTCoreMessage &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_MESSAGE) + { + m_message = objectToCopy.m_message; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#IoTCoreMessage"); + } + + Aws::Crt::ScopedResource IoTCoreMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), IoTCoreMessage::s_customDeleter); + shape->m_allocator = allocator; + IoTCoreMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void IoTCoreMessage::s_customDeleter(IoTCoreMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ConfigurationUpdateEvents::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_CONFIGURATION_UPDATE_EVENT && m_configurationUpdateEvent.has_value()) + { + Aws::Crt::JsonObject configurationUpdateEventValue; + m_configurationUpdateEvent.value().SerializeToJsonObject(configurationUpdateEventValue); + payloadObject.WithObject("configurationUpdateEvent", std::move(configurationUpdateEventValue)); + } + } + + void ConfigurationUpdateEvents::s_loadFromJsonView( + ConfigurationUpdateEvents &configurationUpdateEvents, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("configurationUpdateEvent")) + { + configurationUpdateEvents.m_configurationUpdateEvent = ConfigurationUpdateEvent(); + ConfigurationUpdateEvent::s_loadFromJsonView( + configurationUpdateEvents.m_configurationUpdateEvent.value(), + jsonView.GetJsonObject("configurationUpdateEvent")); + configurationUpdateEvents.m_chosenMember = TAG_CONFIGURATION_UPDATE_EVENT; + } + } + + ConfigurationUpdateEvents &ConfigurationUpdateEvents::operator=( + const ConfigurationUpdateEvents &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_CONFIGURATION_UPDATE_EVENT) + { + m_configurationUpdateEvent = objectToCopy.m_configurationUpdateEvent; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String ConfigurationUpdateEvents::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvents"); + } + + Aws::Crt::ScopedResource ConfigurationUpdateEvents::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ConfigurationUpdateEvents::s_customDeleter); + shape->m_allocator = allocator; + ConfigurationUpdateEvents::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ConfigurationUpdateEvents::s_customDeleter(ConfigurationUpdateEvents *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ComponentUpdatePolicyEvents::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_PRE_UPDATE_EVENT && m_preUpdateEvent.has_value()) + { + Aws::Crt::JsonObject preComponentUpdateEventValue; + m_preUpdateEvent.value().SerializeToJsonObject(preComponentUpdateEventValue); + payloadObject.WithObject("preUpdateEvent", std::move(preComponentUpdateEventValue)); + } + else if (m_chosenMember == TAG_POST_UPDATE_EVENT && m_postUpdateEvent.has_value()) + { + Aws::Crt::JsonObject postComponentUpdateEventValue; + m_postUpdateEvent.value().SerializeToJsonObject(postComponentUpdateEventValue); + payloadObject.WithObject("postUpdateEvent", std::move(postComponentUpdateEventValue)); + } + } + + void ComponentUpdatePolicyEvents::s_loadFromJsonView( + ComponentUpdatePolicyEvents &componentUpdatePolicyEvents, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("preUpdateEvent")) + { + componentUpdatePolicyEvents.m_preUpdateEvent = PreComponentUpdateEvent(); + PreComponentUpdateEvent::s_loadFromJsonView( + componentUpdatePolicyEvents.m_preUpdateEvent.value(), jsonView.GetJsonObject("preUpdateEvent")); + componentUpdatePolicyEvents.m_chosenMember = TAG_PRE_UPDATE_EVENT; + } + else if (jsonView.ValueExists("postUpdateEvent")) + { + componentUpdatePolicyEvents.m_postUpdateEvent = PostComponentUpdateEvent(); + PostComponentUpdateEvent::s_loadFromJsonView( + componentUpdatePolicyEvents.m_postUpdateEvent.value(), jsonView.GetJsonObject("postUpdateEvent")); + componentUpdatePolicyEvents.m_chosenMember = TAG_POST_UPDATE_EVENT; + } + } + + ComponentUpdatePolicyEvents &ComponentUpdatePolicyEvents::operator=( + const ComponentUpdatePolicyEvents &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_PRE_UPDATE_EVENT) + { + m_preUpdateEvent = objectToCopy.m_preUpdateEvent; + m_chosenMember = objectToCopy.m_chosenMember; + } + else if (objectToCopy.m_chosenMember == TAG_POST_UPDATE_EVENT) + { + m_postUpdateEvent = objectToCopy.m_postUpdateEvent; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String ComponentUpdatePolicyEvents::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ComponentUpdatePolicyEvents"); + } + + Aws::Crt::ScopedResource ComponentUpdatePolicyEvents::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ComponentUpdatePolicyEvents::s_customDeleter); + shape->m_allocator = allocator; + ComponentUpdatePolicyEvents::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ComponentUpdatePolicyEvents::s_customDeleter(ComponentUpdatePolicyEvents *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ConfigurationValidityReport::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_status.has_value()) + { + payloadObject.WithString("status", m_status.value()); + } + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void ConfigurationValidityReport::s_loadFromJsonView( + ConfigurationValidityReport &configurationValidityReport, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("status")) + { + configurationValidityReport.m_status = + Aws::Crt::Optional(jsonView.GetString("status")); + } + if (jsonView.ValueExists("deploymentId")) + { + configurationValidityReport.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + if (jsonView.ValueExists("message")) + { + configurationValidityReport.m_message = + Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + void ConfigurationValidityReport::SetStatus(ConfigurationValidityStatus status) noexcept + { + switch (status) + { + case CONFIGURATION_VALIDITY_STATUS_ACCEPTED: + m_status = Aws::Crt::String("ACCEPTED"); + break; + case CONFIGURATION_VALIDITY_STATUS_REJECTED: + m_status = Aws::Crt::String("REJECTED"); + break; + default: + break; + } + } + + Aws::Crt::Optional ConfigurationValidityReport::GetStatus() noexcept + { + if (!m_status.has_value()) + return Aws::Crt::Optional(); + if (m_status.value() == Aws::Crt::String("ACCEPTED")) + { + return Aws::Crt::Optional(CONFIGURATION_VALIDITY_STATUS_ACCEPTED); + } + if (m_status.value() == Aws::Crt::String("REJECTED")) + { + return Aws::Crt::Optional(CONFIGURATION_VALIDITY_STATUS_REJECTED); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String ConfigurationValidityReport::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ConfigurationValidityReport"); + } + + Aws::Crt::ScopedResource ConfigurationValidityReport::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ConfigurationValidityReport::s_customDeleter); + shape->m_allocator = allocator; + ConfigurationValidityReport::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ConfigurationValidityReport::s_customDeleter(ConfigurationValidityReport *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PublishMessage::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_JSON_MESSAGE && m_jsonMessage.has_value()) + { + Aws::Crt::JsonObject jsonMessageValue; + m_jsonMessage.value().SerializeToJsonObject(jsonMessageValue); + payloadObject.WithObject("jsonMessage", std::move(jsonMessageValue)); + } + else if (m_chosenMember == TAG_BINARY_MESSAGE && m_binaryMessage.has_value()) + { + Aws::Crt::JsonObject binaryMessageValue; + m_binaryMessage.value().SerializeToJsonObject(binaryMessageValue); + payloadObject.WithObject("binaryMessage", std::move(binaryMessageValue)); + } + } + + void PublishMessage::s_loadFromJsonView( + PublishMessage &publishMessage, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("jsonMessage")) + { + publishMessage.m_jsonMessage = JsonMessage(); + JsonMessage::s_loadFromJsonView( + publishMessage.m_jsonMessage.value(), jsonView.GetJsonObject("jsonMessage")); + publishMessage.m_chosenMember = TAG_JSON_MESSAGE; + } + else if (jsonView.ValueExists("binaryMessage")) + { + publishMessage.m_binaryMessage = BinaryMessage(); + BinaryMessage::s_loadFromJsonView( + publishMessage.m_binaryMessage.value(), jsonView.GetJsonObject("binaryMessage")); + publishMessage.m_chosenMember = TAG_BINARY_MESSAGE; + } + } + + PublishMessage &PublishMessage::operator=(const PublishMessage &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_JSON_MESSAGE) + { + m_jsonMessage = objectToCopy.m_jsonMessage; + m_chosenMember = objectToCopy.m_chosenMember; + } + else if (objectToCopy.m_chosenMember == TAG_BINARY_MESSAGE) + { + m_binaryMessage = objectToCopy.m_binaryMessage; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String PublishMessage::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishMessage"); + } + + Aws::Crt::ScopedResource PublishMessage::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PublishMessage::s_customDeleter); + shape->m_allocator = allocator; + PublishMessage::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PublishMessage::s_customDeleter(PublishMessage *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SecretValue::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_chosenMember == TAG_SECRET_STRING && m_secretString.has_value()) + { + payloadObject.WithString("secretString", m_secretString.value()); + } + else if (m_chosenMember == TAG_SECRET_BINARY && m_secretBinary.has_value()) + { + if (m_secretBinary.value().size() > 0) + { + payloadObject.WithString("secretBinary", Aws::Crt::Base64Encode(m_secretBinary.value())); + } + } + } + + void SecretValue::s_loadFromJsonView(SecretValue &secretValue, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("secretString")) + { + secretValue.m_secretString = Aws::Crt::Optional(jsonView.GetString("secretString")); + secretValue.m_chosenMember = TAG_SECRET_STRING; + } + else if (jsonView.ValueExists("secretBinary")) + { + if (jsonView.GetString("secretBinary").size() > 0) + { + secretValue.m_secretBinary = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("secretBinary"))); + } + secretValue.m_chosenMember = TAG_SECRET_BINARY; + } + } + + SecretValue &SecretValue::operator=(const SecretValue &objectToCopy) noexcept + { + if (objectToCopy.m_chosenMember == TAG_SECRET_STRING) + { + m_secretString = objectToCopy.m_secretString; + m_chosenMember = objectToCopy.m_chosenMember; + } + else if (objectToCopy.m_chosenMember == TAG_SECRET_BINARY) + { + m_secretBinary = objectToCopy.m_secretBinary; + m_chosenMember = objectToCopy.m_chosenMember; + } + return *this; + } + + Aws::Crt::String SecretValue::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SecretValue"); + } + + Aws::Crt::ScopedResource SecretValue::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), SecretValue::s_customDeleter); + shape->m_allocator = allocator; + SecretValue::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SecretValue::s_customDeleter(SecretValue *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void LocalDeployment::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + if (m_status.has_value()) + { + payloadObject.WithString("status", m_status.value()); + } + } + + void LocalDeployment::s_loadFromJsonView( + LocalDeployment &localDeployment, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deploymentId")) + { + localDeployment.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + if (jsonView.ValueExists("status")) + { + localDeployment.m_status = Aws::Crt::Optional(jsonView.GetString("status")); + } + } + + void LocalDeployment::SetStatus(DeploymentStatus status) noexcept + { + switch (status) + { + case DEPLOYMENT_STATUS_QUEUED: + m_status = Aws::Crt::String("QUEUED"); + break; + case DEPLOYMENT_STATUS_IN_PROGRESS: + m_status = Aws::Crt::String("IN_PROGRESS"); + break; + case DEPLOYMENT_STATUS_SUCCEEDED: + m_status = Aws::Crt::String("SUCCEEDED"); + break; + case DEPLOYMENT_STATUS_FAILED: + m_status = Aws::Crt::String("FAILED"); + break; + default: + break; + } + } + + Aws::Crt::Optional LocalDeployment::GetStatus() noexcept + { + if (!m_status.has_value()) + return Aws::Crt::Optional(); + if (m_status.value() == Aws::Crt::String("QUEUED")) + { + return Aws::Crt::Optional(DEPLOYMENT_STATUS_QUEUED); + } + if (m_status.value() == Aws::Crt::String("IN_PROGRESS")) + { + return Aws::Crt::Optional(DEPLOYMENT_STATUS_IN_PROGRESS); + } + if (m_status.value() == Aws::Crt::String("SUCCEEDED")) + { + return Aws::Crt::Optional(DEPLOYMENT_STATUS_SUCCEEDED); + } + if (m_status.value() == Aws::Crt::String("FAILED")) + { + return Aws::Crt::Optional(DEPLOYMENT_STATUS_FAILED); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String LocalDeployment::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#LocalDeployment"); + } + + Aws::Crt::ScopedResource LocalDeployment::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), LocalDeployment::s_customDeleter); + shape->m_allocator = allocator; + LocalDeployment::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void LocalDeployment::s_customDeleter(LocalDeployment *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ComponentDetails::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + if (m_version.has_value()) + { + payloadObject.WithString("version", m_version.value()); + } + if (m_state.has_value()) + { + payloadObject.WithString("state", m_state.value()); + } + if (m_configuration.has_value()) + { + payloadObject.WithObject("configuration", m_configuration.value()); + } + } + + void ComponentDetails::s_loadFromJsonView( + ComponentDetails &componentDetails, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + componentDetails.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + if (jsonView.ValueExists("version")) + { + componentDetails.m_version = Aws::Crt::Optional(jsonView.GetString("version")); + } + if (jsonView.ValueExists("state")) + { + componentDetails.m_state = Aws::Crt::Optional(jsonView.GetString("state")); + } + if (jsonView.ValueExists("configuration")) + { + componentDetails.m_configuration = + Aws::Crt::Optional(jsonView.GetJsonObject("configuration").Materialize()); + } + } + + void ComponentDetails::SetState(LifecycleState state) noexcept + { + switch (state) + { + case LIFECYCLE_STATE_RUNNING: + m_state = Aws::Crt::String("RUNNING"); + break; + case LIFECYCLE_STATE_ERRORED: + m_state = Aws::Crt::String("ERRORED"); + break; + case LIFECYCLE_STATE_NEW: + m_state = Aws::Crt::String("NEW"); + break; + case LIFECYCLE_STATE_FINISHED: + m_state = Aws::Crt::String("FINISHED"); + break; + case LIFECYCLE_STATE_INSTALLED: + m_state = Aws::Crt::String("INSTALLED"); + break; + case LIFECYCLE_STATE_BROKEN: + m_state = Aws::Crt::String("BROKEN"); + break; + case LIFECYCLE_STATE_STARTING: + m_state = Aws::Crt::String("STARTING"); + break; + case LIFECYCLE_STATE_STOPPING: + m_state = Aws::Crt::String("STOPPING"); + break; + default: + break; + } + } + + Aws::Crt::Optional ComponentDetails::GetState() noexcept + { + if (!m_state.has_value()) + return Aws::Crt::Optional(); + if (m_state.value() == Aws::Crt::String("RUNNING")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_RUNNING); + } + if (m_state.value() == Aws::Crt::String("ERRORED")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_ERRORED); + } + if (m_state.value() == Aws::Crt::String("NEW")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_NEW); + } + if (m_state.value() == Aws::Crt::String("FINISHED")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_FINISHED); + } + if (m_state.value() == Aws::Crt::String("INSTALLED")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_INSTALLED); + } + if (m_state.value() == Aws::Crt::String("BROKEN")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_BROKEN); + } + if (m_state.value() == Aws::Crt::String("STARTING")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_STARTING); + } + if (m_state.value() == Aws::Crt::String("STOPPING")) + { + return Aws::Crt::Optional(LIFECYCLE_STATE_STOPPING); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String ComponentDetails::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ComponentDetails"); + } + + Aws::Crt::ScopedResource ComponentDetails::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ComponentDetails::s_customDeleter); + shape->m_allocator = allocator; + ComponentDetails::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ComponentDetails::s_customDeleter(ComponentDetails *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void InvalidTokenError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void InvalidTokenError::s_loadFromJsonView( + InvalidTokenError &invalidTokenError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + invalidTokenError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String InvalidTokenError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#InvalidTokenError"); + } + + Aws::Crt::ScopedResource InvalidTokenError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), InvalidTokenError::s_customDeleter); + shape->m_allocator = allocator; + InvalidTokenError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void InvalidTokenError::s_customDeleter(InvalidTokenError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void ValidateAuthorizationTokenResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + if (m_isValid.has_value()) + { + payloadObject.WithBool("isValid", m_isValid.value()); + } + } + + void ValidateAuthorizationTokenResponse::s_loadFromJsonView( + ValidateAuthorizationTokenResponse &validateAuthorizationTokenResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("isValid")) + { + validateAuthorizationTokenResponse.m_isValid = Aws::Crt::Optional(jsonView.GetBool("isValid")); + } + } + + Aws::Crt::String ValidateAuthorizationTokenResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenResponse"); + } + + Aws::Crt::ScopedResource ValidateAuthorizationTokenResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + ValidateAuthorizationTokenResponse::s_customDeleter); + shape->m_allocator = allocator; + ValidateAuthorizationTokenResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ValidateAuthorizationTokenResponse::s_customDeleter(ValidateAuthorizationTokenResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ValidateAuthorizationTokenRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + if (m_token.has_value()) + { + payloadObject.WithString("token", m_token.value()); + } + } + + void ValidateAuthorizationTokenRequest::s_loadFromJsonView( + ValidateAuthorizationTokenRequest &validateAuthorizationTokenRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("token")) + { + validateAuthorizationTokenRequest.m_token = + Aws::Crt::Optional(jsonView.GetString("token")); + } + } + + Aws::Crt::String ValidateAuthorizationTokenRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenRequest"); + } + + Aws::Crt::ScopedResource ValidateAuthorizationTokenRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + ValidateAuthorizationTokenRequest::s_customDeleter); + shape->m_allocator = allocator; + ValidateAuthorizationTokenRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ValidateAuthorizationTokenRequest::s_customDeleter(ValidateAuthorizationTokenRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void UpdateThingShadowResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_payload.has_value()) + { + if (m_payload.value().size() > 0) + { + payloadObject.WithString("payload", Aws::Crt::Base64Encode(m_payload.value())); + } + } + } + + void UpdateThingShadowResponse::s_loadFromJsonView( + UpdateThingShadowResponse &updateThingShadowResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("payload")) + { + if (jsonView.GetString("payload").size() > 0) + { + updateThingShadowResponse.m_payload = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("payload"))); + } + } + } + + Aws::Crt::String UpdateThingShadowResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateThingShadowResponse"); + } + + Aws::Crt::ScopedResource UpdateThingShadowResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UpdateThingShadowResponse::s_customDeleter); + shape->m_allocator = allocator; + UpdateThingShadowResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void UpdateThingShadowResponse::s_customDeleter(UpdateThingShadowResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void UpdateThingShadowRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_thingName.has_value()) + { + payloadObject.WithString("thingName", m_thingName.value()); + } + if (m_shadowName.has_value()) + { + payloadObject.WithString("shadowName", m_shadowName.value()); + } + if (m_payload.has_value()) + { + if (m_payload.value().size() > 0) + { + payloadObject.WithString("payload", Aws::Crt::Base64Encode(m_payload.value())); + } + } + } + + void UpdateThingShadowRequest::s_loadFromJsonView( + UpdateThingShadowRequest &updateThingShadowRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("thingName")) + { + updateThingShadowRequest.m_thingName = + Aws::Crt::Optional(jsonView.GetString("thingName")); + } + if (jsonView.ValueExists("shadowName")) + { + updateThingShadowRequest.m_shadowName = + Aws::Crt::Optional(jsonView.GetString("shadowName")); + } + if (jsonView.ValueExists("payload")) + { + if (jsonView.GetString("payload").size() > 0) + { + updateThingShadowRequest.m_payload = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("payload"))); + } + } + } + + Aws::Crt::String UpdateThingShadowRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateThingShadowRequest"); + } + + Aws::Crt::ScopedResource UpdateThingShadowRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UpdateThingShadowRequest::s_customDeleter); + shape->m_allocator = allocator; + UpdateThingShadowRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void UpdateThingShadowRequest::s_customDeleter(UpdateThingShadowRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void UpdateStateResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void UpdateStateResponse::s_loadFromJsonView( + UpdateStateResponse &updateStateResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)updateStateResponse; + (void)jsonView; + } + + Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateStateResponse"); + } + + Aws::Crt::ScopedResource UpdateStateResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UpdateStateResponse::s_customDeleter); + shape->m_allocator = allocator; + UpdateStateResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void UpdateStateResponse::s_customDeleter(UpdateStateResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void UpdateStateRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_state.has_value()) + { + payloadObject.WithString("state", m_state.value()); + } + } + + void UpdateStateRequest::s_loadFromJsonView( + UpdateStateRequest &updateStateRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("state")) + { + updateStateRequest.m_state = Aws::Crt::Optional(jsonView.GetString("state")); + } + } + + void UpdateStateRequest::SetState(ReportedLifecycleState state) noexcept + { + switch (state) + { + case REPORTED_LIFECYCLE_STATE_RUNNING: + m_state = Aws::Crt::String("RUNNING"); + break; + case REPORTED_LIFECYCLE_STATE_ERRORED: + m_state = Aws::Crt::String("ERRORED"); + break; + default: + break; + } + } + + Aws::Crt::Optional UpdateStateRequest::GetState() noexcept + { + if (!m_state.has_value()) + return Aws::Crt::Optional(); + if (m_state.value() == Aws::Crt::String("RUNNING")) + { + return Aws::Crt::Optional(REPORTED_LIFECYCLE_STATE_RUNNING); + } + if (m_state.value() == Aws::Crt::String("ERRORED")) + { + return Aws::Crt::Optional(REPORTED_LIFECYCLE_STATE_ERRORED); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateStateRequest"); + } + + Aws::Crt::ScopedResource UpdateStateRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UpdateStateRequest::s_customDeleter); + shape->m_allocator = allocator; + UpdateStateRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void UpdateStateRequest::s_customDeleter(UpdateStateRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void FailedUpdateConditionCheckError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void FailedUpdateConditionCheckError::s_loadFromJsonView( + FailedUpdateConditionCheckError &failedUpdateConditionCheckError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + failedUpdateConditionCheckError.m_message = + Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String FailedUpdateConditionCheckError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#FailedUpdateConditionCheckError"); + } + + Aws::Crt::ScopedResource FailedUpdateConditionCheckError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + FailedUpdateConditionCheckError::s_customDeleter); + shape->m_allocator = allocator; + FailedUpdateConditionCheckError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void FailedUpdateConditionCheckError::s_customDeleter(FailedUpdateConditionCheckError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void ConflictError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void ConflictError::s_loadFromJsonView( + ConflictError &conflictError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + conflictError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String ConflictError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ConflictError"); + } + + Aws::Crt::ScopedResource ConflictError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ConflictError::s_customDeleter); + shape->m_allocator = allocator; + ConflictError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void ConflictError::s_customDeleter(ConflictError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void UpdateConfigurationResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void UpdateConfigurationResponse::s_loadFromJsonView( + UpdateConfigurationResponse &updateConfigurationResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)updateConfigurationResponse; + (void)jsonView; + } + + Aws::Crt::String UpdateConfigurationResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateConfigurationResponse"); + } + + Aws::Crt::ScopedResource UpdateConfigurationResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UpdateConfigurationResponse::s_customDeleter); + shape->m_allocator = allocator; + UpdateConfigurationResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void UpdateConfigurationResponse::s_customDeleter(UpdateConfigurationResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void UpdateConfigurationRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_keyPath.has_value()) + { + Aws::Crt::JsonObject keyPath; + Aws::Crt::Vector keyPathJsonArray; + for (const auto &keyPathItem : m_keyPath.value()) + { + Aws::Crt::JsonObject keyPathJsonArrayItem; + keyPathJsonArrayItem.AsString(keyPathItem); + keyPathJsonArray.emplace_back(std::move(keyPathJsonArrayItem)); + } + keyPath.AsArray(std::move(keyPathJsonArray)); + payloadObject.WithObject("keyPath", std::move(keyPath)); + } + if (m_timestamp.has_value()) + { + payloadObject.WithDouble("timestamp", m_timestamp.value().SecondsWithMSPrecision()); + } + if (m_valueToMerge.has_value()) + { + payloadObject.WithObject("valueToMerge", m_valueToMerge.value()); + } + } + + void UpdateConfigurationRequest::s_loadFromJsonView( + UpdateConfigurationRequest &updateConfigurationRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("keyPath")) + { + updateConfigurationRequest.m_keyPath = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &keyPathJsonView : jsonView.GetArray("keyPath")) + { + Aws::Crt::Optional keyPathItem; + keyPathItem = Aws::Crt::Optional(keyPathJsonView.AsString()); + updateConfigurationRequest.m_keyPath.value().push_back(keyPathItem.value()); + } + } + if (jsonView.ValueExists("timestamp")) + { + updateConfigurationRequest.m_timestamp = + Aws::Crt::Optional(Aws::Crt::DateTime(jsonView.GetDouble("timestamp"))); + } + if (jsonView.ValueExists("valueToMerge")) + { + updateConfigurationRequest.m_valueToMerge = + Aws::Crt::Optional(jsonView.GetJsonObject("valueToMerge").Materialize()); + } + } + + Aws::Crt::String UpdateConfigurationRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateConfigurationRequest"); + } + + Aws::Crt::ScopedResource UpdateConfigurationRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UpdateConfigurationRequest::s_customDeleter); + shape->m_allocator = allocator; + UpdateConfigurationRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void UpdateConfigurationRequest::s_customDeleter(UpdateConfigurationRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToValidateConfigurationUpdatesResponse::SerializeToJsonObject( + Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void SubscribeToValidateConfigurationUpdatesResponse::s_loadFromJsonView( + SubscribeToValidateConfigurationUpdatesResponse &subscribeToValidateConfigurationUpdatesResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)subscribeToValidateConfigurationUpdatesResponse; + (void)jsonView; + } + + Aws::Crt::String SubscribeToValidateConfigurationUpdatesResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesResponse"); + } + + Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesResponse:: + s_allocateFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SubscribeToValidateConfigurationUpdatesResponse::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToValidateConfigurationUpdatesResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToValidateConfigurationUpdatesResponse::s_customDeleter( + SubscribeToValidateConfigurationUpdatesResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToValidateConfigurationUpdatesRequest::SerializeToJsonObject( + Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void SubscribeToValidateConfigurationUpdatesRequest::s_loadFromJsonView( + SubscribeToValidateConfigurationUpdatesRequest &subscribeToValidateConfigurationUpdatesRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)subscribeToValidateConfigurationUpdatesRequest; + (void)jsonView; + } + + Aws::Crt::String SubscribeToValidateConfigurationUpdatesRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesRequest"); + } + + Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesRequest:: + s_allocateFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SubscribeToValidateConfigurationUpdatesRequest::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToValidateConfigurationUpdatesRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToValidateConfigurationUpdatesRequest::s_customDeleter( + SubscribeToValidateConfigurationUpdatesRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToTopicResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_topicName.has_value()) + { + payloadObject.WithString("topicName", m_topicName.value()); + } + } + + void SubscribeToTopicResponse::s_loadFromJsonView( + SubscribeToTopicResponse &subscribeToTopicResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("topicName")) + { + subscribeToTopicResponse.m_topicName = + Aws::Crt::Optional(jsonView.GetString("topicName")); + } + } + + Aws::Crt::String SubscribeToTopicResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToTopicResponse"); + } + + Aws::Crt::ScopedResource SubscribeToTopicResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), SubscribeToTopicResponse::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToTopicResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToTopicResponse::s_customDeleter(SubscribeToTopicResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToTopicRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_topic.has_value()) + { + payloadObject.WithString("topic", m_topic.value()); + } + } + + void SubscribeToTopicRequest::s_loadFromJsonView( + SubscribeToTopicRequest &subscribeToTopicRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("topic")) + { + subscribeToTopicRequest.m_topic = Aws::Crt::Optional(jsonView.GetString("topic")); + } + } + + Aws::Crt::String SubscribeToTopicRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToTopicRequest"); + } + + Aws::Crt::ScopedResource SubscribeToTopicRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), SubscribeToTopicRequest::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToTopicRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToTopicRequest::s_customDeleter(SubscribeToTopicRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToIoTCoreResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void SubscribeToIoTCoreResponse::s_loadFromJsonView( + SubscribeToIoTCoreResponse &subscribeToIoTCoreResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)subscribeToIoTCoreResponse; + (void)jsonView; + } + + Aws::Crt::String SubscribeToIoTCoreResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreResponse"); + } + + Aws::Crt::ScopedResource SubscribeToIoTCoreResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), SubscribeToIoTCoreResponse::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToIoTCoreResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToIoTCoreResponse::s_customDeleter(SubscribeToIoTCoreResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToIoTCoreRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_topicName.has_value()) + { + payloadObject.WithString("topicName", m_topicName.value()); + } + if (m_qos.has_value()) + { + payloadObject.WithString("qos", m_qos.value()); + } + } + + void SubscribeToIoTCoreRequest::s_loadFromJsonView( + SubscribeToIoTCoreRequest &subscribeToIoTCoreRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("topicName")) + { + subscribeToIoTCoreRequest.m_topicName = + Aws::Crt::Optional(jsonView.GetString("topicName")); + } + if (jsonView.ValueExists("qos")) + { + subscribeToIoTCoreRequest.m_qos = Aws::Crt::Optional(jsonView.GetString("qos")); + } + } + + void SubscribeToIoTCoreRequest::SetQos(QOS qos) noexcept + { + switch (qos) + { + case QOS_AT_MOST_ONCE: + m_qos = Aws::Crt::String("0"); + break; + case QOS_AT_LEAST_ONCE: + m_qos = Aws::Crt::String("1"); + break; + default: + break; + } + } + + Aws::Crt::Optional SubscribeToIoTCoreRequest::GetQos() noexcept + { + if (!m_qos.has_value()) + return Aws::Crt::Optional(); + if (m_qos.value() == Aws::Crt::String("0")) + { + return Aws::Crt::Optional(QOS_AT_MOST_ONCE); + } + if (m_qos.value() == Aws::Crt::String("1")) + { + return Aws::Crt::Optional(QOS_AT_LEAST_ONCE); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String SubscribeToIoTCoreRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreRequest"); + } + + Aws::Crt::ScopedResource SubscribeToIoTCoreRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), SubscribeToIoTCoreRequest::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToIoTCoreRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToIoTCoreRequest::s_customDeleter(SubscribeToIoTCoreRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToConfigurationUpdateResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + (void)payloadObject; + } + + void SubscribeToConfigurationUpdateResponse::s_loadFromJsonView( + SubscribeToConfigurationUpdateResponse &subscribeToConfigurationUpdateResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)subscribeToConfigurationUpdateResponse; + (void)jsonView; + } + + Aws::Crt::String SubscribeToConfigurationUpdateResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateResponse"); + } + + Aws::Crt::ScopedResource SubscribeToConfigurationUpdateResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SubscribeToConfigurationUpdateResponse::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToConfigurationUpdateResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToConfigurationUpdateResponse::s_customDeleter( + SubscribeToConfigurationUpdateResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToConfigurationUpdateRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + if (m_keyPath.has_value()) + { + Aws::Crt::JsonObject keyPath; + Aws::Crt::Vector keyPathJsonArray; + for (const auto &keyPathItem : m_keyPath.value()) + { + Aws::Crt::JsonObject keyPathJsonArrayItem; + keyPathJsonArrayItem.AsString(keyPathItem); + keyPathJsonArray.emplace_back(std::move(keyPathJsonArrayItem)); + } + keyPath.AsArray(std::move(keyPathJsonArray)); + payloadObject.WithObject("keyPath", std::move(keyPath)); + } + } + + void SubscribeToConfigurationUpdateRequest::s_loadFromJsonView( + SubscribeToConfigurationUpdateRequest &subscribeToConfigurationUpdateRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + subscribeToConfigurationUpdateRequest.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + if (jsonView.ValueExists("keyPath")) + { + subscribeToConfigurationUpdateRequest.m_keyPath = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &keyPathJsonView : jsonView.GetArray("keyPath")) + { + Aws::Crt::Optional keyPathItem; + keyPathItem = Aws::Crt::Optional(keyPathJsonView.AsString()); + subscribeToConfigurationUpdateRequest.m_keyPath.value().push_back(keyPathItem.value()); + } + } + } + + Aws::Crt::String SubscribeToConfigurationUpdateRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateRequest"); + } + + Aws::Crt::ScopedResource SubscribeToConfigurationUpdateRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SubscribeToConfigurationUpdateRequest::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToConfigurationUpdateRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToConfigurationUpdateRequest::s_customDeleter( + SubscribeToConfigurationUpdateRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToComponentUpdatesResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + (void)payloadObject; + } + + void SubscribeToComponentUpdatesResponse::s_loadFromJsonView( + SubscribeToComponentUpdatesResponse &subscribeToComponentUpdatesResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)subscribeToComponentUpdatesResponse; + (void)jsonView; + } + + Aws::Crt::String SubscribeToComponentUpdatesResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesResponse"); + } + + Aws::Crt::ScopedResource SubscribeToComponentUpdatesResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SubscribeToComponentUpdatesResponse::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToComponentUpdatesResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToComponentUpdatesResponse::s_customDeleter(SubscribeToComponentUpdatesResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToComponentUpdatesRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + (void)payloadObject; + } + + void SubscribeToComponentUpdatesRequest::s_loadFromJsonView( + SubscribeToComponentUpdatesRequest &subscribeToComponentUpdatesRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)subscribeToComponentUpdatesRequest; + (void)jsonView; + } + + Aws::Crt::String SubscribeToComponentUpdatesRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesRequest"); + } + + Aws::Crt::ScopedResource SubscribeToComponentUpdatesRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SubscribeToComponentUpdatesRequest::s_customDeleter); + shape->m_allocator = allocator; + SubscribeToComponentUpdatesRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SubscribeToComponentUpdatesRequest::s_customDeleter(SubscribeToComponentUpdatesRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void StopComponentResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_stopStatus.has_value()) + { + payloadObject.WithString("stopStatus", m_stopStatus.value()); + } + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void StopComponentResponse::s_loadFromJsonView( + StopComponentResponse &stopComponentResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("stopStatus")) + { + stopComponentResponse.m_stopStatus = + Aws::Crt::Optional(jsonView.GetString("stopStatus")); + } + if (jsonView.ValueExists("message")) + { + stopComponentResponse.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + void StopComponentResponse::SetStopStatus(RequestStatus stopStatus) noexcept + { + switch (stopStatus) + { + case REQUEST_STATUS_SUCCEEDED: + m_stopStatus = Aws::Crt::String("SUCCEEDED"); + break; + case REQUEST_STATUS_FAILED: + m_stopStatus = Aws::Crt::String("FAILED"); + break; + default: + break; + } + } + + Aws::Crt::Optional StopComponentResponse::GetStopStatus() noexcept + { + if (!m_stopStatus.has_value()) + return Aws::Crt::Optional(); + if (m_stopStatus.value() == Aws::Crt::String("SUCCEEDED")) + { + return Aws::Crt::Optional(REQUEST_STATUS_SUCCEEDED); + } + if (m_stopStatus.value() == Aws::Crt::String("FAILED")) + { + return Aws::Crt::Optional(REQUEST_STATUS_FAILED); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String StopComponentResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#StopComponentResponse"); + } + + Aws::Crt::ScopedResource StopComponentResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), StopComponentResponse::s_customDeleter); + shape->m_allocator = allocator; + StopComponentResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void StopComponentResponse::s_customDeleter(StopComponentResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void StopComponentRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + } + + void StopComponentRequest::s_loadFromJsonView( + StopComponentRequest &stopComponentRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + stopComponentRequest.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + } + + Aws::Crt::String StopComponentRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#StopComponentRequest"); + } + + Aws::Crt::ScopedResource StopComponentRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), StopComponentRequest::s_customDeleter); + shape->m_allocator = allocator; + StopComponentRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void StopComponentRequest::s_customDeleter(StopComponentRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SendConfigurationValidityReportResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + (void)payloadObject; + } + + void SendConfigurationValidityReportResponse::s_loadFromJsonView( + SendConfigurationValidityReportResponse &sendConfigurationValidityReportResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)sendConfigurationValidityReportResponse; + (void)jsonView; + } + + Aws::Crt::String SendConfigurationValidityReportResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportResponse"); + } + + Aws::Crt::ScopedResource SendConfigurationValidityReportResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SendConfigurationValidityReportResponse::s_customDeleter); + shape->m_allocator = allocator; + SendConfigurationValidityReportResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SendConfigurationValidityReportResponse::s_customDeleter( + SendConfigurationValidityReportResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SendConfigurationValidityReportRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + if (m_configurationValidityReport.has_value()) + { + Aws::Crt::JsonObject configurationValidityReportValue; + m_configurationValidityReport.value().SerializeToJsonObject(configurationValidityReportValue); + payloadObject.WithObject("configurationValidityReport", std::move(configurationValidityReportValue)); + } + } + + void SendConfigurationValidityReportRequest::s_loadFromJsonView( + SendConfigurationValidityReportRequest &sendConfigurationValidityReportRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("configurationValidityReport")) + { + sendConfigurationValidityReportRequest.m_configurationValidityReport = ConfigurationValidityReport(); + ConfigurationValidityReport::s_loadFromJsonView( + sendConfigurationValidityReportRequest.m_configurationValidityReport.value(), + jsonView.GetJsonObject("configurationValidityReport")); + } + } + + Aws::Crt::String SendConfigurationValidityReportRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportRequest"); + } + + Aws::Crt::ScopedResource SendConfigurationValidityReportRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + SendConfigurationValidityReportRequest::s_customDeleter); + shape->m_allocator = allocator; + SendConfigurationValidityReportRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void SendConfigurationValidityReportRequest::s_customDeleter( + SendConfigurationValidityReportRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ComponentNotFoundError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void ComponentNotFoundError::s_loadFromJsonView( + ComponentNotFoundError &componentNotFoundError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + componentNotFoundError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String ComponentNotFoundError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ComponentNotFoundError"); + } + + Aws::Crt::ScopedResource ComponentNotFoundError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ComponentNotFoundError::s_customDeleter); + shape->m_allocator = allocator; + ComponentNotFoundError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void ComponentNotFoundError::s_customDeleter(ComponentNotFoundError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void RestartComponentResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_restartStatus.has_value()) + { + payloadObject.WithString("restartStatus", m_restartStatus.value()); + } + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void RestartComponentResponse::s_loadFromJsonView( + RestartComponentResponse &restartComponentResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("restartStatus")) + { + restartComponentResponse.m_restartStatus = + Aws::Crt::Optional(jsonView.GetString("restartStatus")); + } + if (jsonView.ValueExists("message")) + { + restartComponentResponse.m_message = + Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + void RestartComponentResponse::SetRestartStatus(RequestStatus restartStatus) noexcept + { + switch (restartStatus) + { + case REQUEST_STATUS_SUCCEEDED: + m_restartStatus = Aws::Crt::String("SUCCEEDED"); + break; + case REQUEST_STATUS_FAILED: + m_restartStatus = Aws::Crt::String("FAILED"); + break; + default: + break; + } + } + + Aws::Crt::Optional RestartComponentResponse::GetRestartStatus() noexcept + { + if (!m_restartStatus.has_value()) + return Aws::Crt::Optional(); + if (m_restartStatus.value() == Aws::Crt::String("SUCCEEDED")) + { + return Aws::Crt::Optional(REQUEST_STATUS_SUCCEEDED); + } + if (m_restartStatus.value() == Aws::Crt::String("FAILED")) + { + return Aws::Crt::Optional(REQUEST_STATUS_FAILED); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String RestartComponentResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#RestartComponentResponse"); + } + + Aws::Crt::ScopedResource RestartComponentResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), RestartComponentResponse::s_customDeleter); + shape->m_allocator = allocator; + RestartComponentResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void RestartComponentResponse::s_customDeleter(RestartComponentResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void RestartComponentRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + } + + void RestartComponentRequest::s_loadFromJsonView( + RestartComponentRequest &restartComponentRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + restartComponentRequest.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + } + + Aws::Crt::String RestartComponentRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#RestartComponentRequest"); + } + + Aws::Crt::ScopedResource RestartComponentRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), RestartComponentRequest::s_customDeleter); + shape->m_allocator = allocator; + RestartComponentRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void RestartComponentRequest::s_customDeleter(RestartComponentRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PublishToTopicResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void PublishToTopicResponse::s_loadFromJsonView( + PublishToTopicResponse &publishToTopicResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)publishToTopicResponse; + (void)jsonView; + } + + Aws::Crt::String PublishToTopicResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToTopicResponse"); + } + + Aws::Crt::ScopedResource PublishToTopicResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PublishToTopicResponse::s_customDeleter); + shape->m_allocator = allocator; + PublishToTopicResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PublishToTopicResponse::s_customDeleter(PublishToTopicResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PublishToTopicRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_topic.has_value()) + { + payloadObject.WithString("topic", m_topic.value()); + } + if (m_publishMessage.has_value()) + { + Aws::Crt::JsonObject publishMessageValue; + m_publishMessage.value().SerializeToJsonObject(publishMessageValue); + payloadObject.WithObject("publishMessage", std::move(publishMessageValue)); + } + } + + void PublishToTopicRequest::s_loadFromJsonView( + PublishToTopicRequest &publishToTopicRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("topic")) + { + publishToTopicRequest.m_topic = Aws::Crt::Optional(jsonView.GetString("topic")); + } + if (jsonView.ValueExists("publishMessage")) + { + publishToTopicRequest.m_publishMessage = PublishMessage(); + PublishMessage::s_loadFromJsonView( + publishToTopicRequest.m_publishMessage.value(), jsonView.GetJsonObject("publishMessage")); + } + } + + Aws::Crt::String PublishToTopicRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToTopicRequest"); + } + + Aws::Crt::ScopedResource PublishToTopicRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PublishToTopicRequest::s_customDeleter); + shape->m_allocator = allocator; + PublishToTopicRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PublishToTopicRequest::s_customDeleter(PublishToTopicRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PublishToIoTCoreResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void PublishToIoTCoreResponse::s_loadFromJsonView( + PublishToIoTCoreResponse &publishToIoTCoreResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)publishToIoTCoreResponse; + (void)jsonView; + } + + Aws::Crt::String PublishToIoTCoreResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToIoTCoreResponse"); + } + + Aws::Crt::ScopedResource PublishToIoTCoreResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PublishToIoTCoreResponse::s_customDeleter); + shape->m_allocator = allocator; + PublishToIoTCoreResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PublishToIoTCoreResponse::s_customDeleter(PublishToIoTCoreResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void PublishToIoTCoreRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_topicName.has_value()) + { + payloadObject.WithString("topicName", m_topicName.value()); + } + if (m_qos.has_value()) + { + payloadObject.WithString("qos", m_qos.value()); + } + if (m_payload.has_value()) + { + if (m_payload.value().size() > 0) + { + payloadObject.WithString("payload", Aws::Crt::Base64Encode(m_payload.value())); + } + } + } + + void PublishToIoTCoreRequest::s_loadFromJsonView( + PublishToIoTCoreRequest &publishToIoTCoreRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("topicName")) + { + publishToIoTCoreRequest.m_topicName = + Aws::Crt::Optional(jsonView.GetString("topicName")); + } + if (jsonView.ValueExists("qos")) + { + publishToIoTCoreRequest.m_qos = Aws::Crt::Optional(jsonView.GetString("qos")); + } + if (jsonView.ValueExists("payload")) + { + if (jsonView.GetString("payload").size() > 0) + { + publishToIoTCoreRequest.m_payload = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("payload"))); + } + } + } + + void PublishToIoTCoreRequest::SetQos(QOS qos) noexcept + { + switch (qos) + { + case QOS_AT_MOST_ONCE: + m_qos = Aws::Crt::String("0"); + break; + case QOS_AT_LEAST_ONCE: + m_qos = Aws::Crt::String("1"); + break; + default: + break; + } + } + + Aws::Crt::Optional PublishToIoTCoreRequest::GetQos() noexcept + { + if (!m_qos.has_value()) + return Aws::Crt::Optional(); + if (m_qos.value() == Aws::Crt::String("0")) + { + return Aws::Crt::Optional(QOS_AT_MOST_ONCE); + } + if (m_qos.value() == Aws::Crt::String("1")) + { + return Aws::Crt::Optional(QOS_AT_LEAST_ONCE); + } + + return Aws::Crt::Optional(); + } + + Aws::Crt::String PublishToIoTCoreRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToIoTCoreRequest"); + } + + Aws::Crt::ScopedResource PublishToIoTCoreRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), PublishToIoTCoreRequest::s_customDeleter); + shape->m_allocator = allocator; + PublishToIoTCoreRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void PublishToIoTCoreRequest::s_customDeleter(PublishToIoTCoreRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ListNamedShadowsForThingResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_results.has_value()) + { + Aws::Crt::JsonObject namedShadowList; + Aws::Crt::Vector namedShadowListJsonArray; + for (const auto &namedShadowListItem : m_results.value()) + { + Aws::Crt::JsonObject namedShadowListJsonArrayItem; + namedShadowListJsonArrayItem.AsString(namedShadowListItem); + namedShadowListJsonArray.emplace_back(std::move(namedShadowListJsonArrayItem)); + } + namedShadowList.AsArray(std::move(namedShadowListJsonArray)); + payloadObject.WithObject("results", std::move(namedShadowList)); + } + if (m_timestamp.has_value()) + { + payloadObject.WithDouble("timestamp", m_timestamp.value().SecondsWithMSPrecision()); + } + if (m_nextToken.has_value()) + { + payloadObject.WithString("nextToken", m_nextToken.value()); + } + } + + void ListNamedShadowsForThingResponse::s_loadFromJsonView( + ListNamedShadowsForThingResponse &listNamedShadowsForThingResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("results")) + { + listNamedShadowsForThingResponse.m_results = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &namedShadowListJsonView : jsonView.GetArray("results")) + { + Aws::Crt::Optional namedShadowListItem; + namedShadowListItem = Aws::Crt::Optional(namedShadowListJsonView.AsString()); + listNamedShadowsForThingResponse.m_results.value().push_back(namedShadowListItem.value()); + } + } + if (jsonView.ValueExists("timestamp")) + { + listNamedShadowsForThingResponse.m_timestamp = + Aws::Crt::Optional(Aws::Crt::DateTime(jsonView.GetDouble("timestamp"))); + } + if (jsonView.ValueExists("nextToken")) + { + listNamedShadowsForThingResponse.m_nextToken = + Aws::Crt::Optional(jsonView.GetString("nextToken")); + } + } + + Aws::Crt::String ListNamedShadowsForThingResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingResponse"); + } + + Aws::Crt::ScopedResource ListNamedShadowsForThingResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + ListNamedShadowsForThingResponse::s_customDeleter); + shape->m_allocator = allocator; + ListNamedShadowsForThingResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ListNamedShadowsForThingResponse::s_customDeleter(ListNamedShadowsForThingResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ListNamedShadowsForThingRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_thingName.has_value()) + { + payloadObject.WithString("thingName", m_thingName.value()); + } + if (m_nextToken.has_value()) + { + payloadObject.WithString("nextToken", m_nextToken.value()); + } + if (m_pageSize.has_value()) + { + payloadObject.WithInteger("pageSize", m_pageSize.value()); + } + } + + void ListNamedShadowsForThingRequest::s_loadFromJsonView( + ListNamedShadowsForThingRequest &listNamedShadowsForThingRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("thingName")) + { + listNamedShadowsForThingRequest.m_thingName = + Aws::Crt::Optional(jsonView.GetString("thingName")); + } + if (jsonView.ValueExists("nextToken")) + { + listNamedShadowsForThingRequest.m_nextToken = + Aws::Crt::Optional(jsonView.GetString("nextToken")); + } + if (jsonView.ValueExists("pageSize")) + { + listNamedShadowsForThingRequest.m_pageSize = Aws::Crt::Optional(jsonView.GetInteger("pageSize")); + } + } + + Aws::Crt::String ListNamedShadowsForThingRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingRequest"); + } + + Aws::Crt::ScopedResource ListNamedShadowsForThingRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + ListNamedShadowsForThingRequest::s_customDeleter); + shape->m_allocator = allocator; + ListNamedShadowsForThingRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ListNamedShadowsForThingRequest::s_customDeleter(ListNamedShadowsForThingRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ListLocalDeploymentsResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_localDeployments.has_value()) + { + Aws::Crt::JsonObject listOfLocalDeployments; + Aws::Crt::Vector listOfLocalDeploymentsJsonArray; + for (const auto &listOfLocalDeploymentsItem : m_localDeployments.value()) + { + Aws::Crt::JsonObject listOfLocalDeploymentsJsonArrayItem; + listOfLocalDeploymentsItem.SerializeToJsonObject(listOfLocalDeploymentsJsonArrayItem); + listOfLocalDeploymentsJsonArray.emplace_back(std::move(listOfLocalDeploymentsJsonArrayItem)); + } + listOfLocalDeployments.AsArray(std::move(listOfLocalDeploymentsJsonArray)); + payloadObject.WithObject("localDeployments", std::move(listOfLocalDeployments)); + } + } + + void ListLocalDeploymentsResponse::s_loadFromJsonView( + ListLocalDeploymentsResponse &listLocalDeploymentsResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("localDeployments")) + { + listLocalDeploymentsResponse.m_localDeployments = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &listOfLocalDeploymentsJsonView : jsonView.GetArray("localDeployments")) + { + Aws::Crt::Optional listOfLocalDeploymentsItem; + listOfLocalDeploymentsItem = LocalDeployment(); + LocalDeployment::s_loadFromJsonView( + listOfLocalDeploymentsItem.value(), listOfLocalDeploymentsJsonView); + listLocalDeploymentsResponse.m_localDeployments.value().push_back( + listOfLocalDeploymentsItem.value()); + } + } + } + + Aws::Crt::String ListLocalDeploymentsResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsResponse"); + } + + Aws::Crt::ScopedResource ListLocalDeploymentsResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ListLocalDeploymentsResponse::s_customDeleter); + shape->m_allocator = allocator; + ListLocalDeploymentsResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ListLocalDeploymentsResponse::s_customDeleter(ListLocalDeploymentsResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ListLocalDeploymentsRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void ListLocalDeploymentsRequest::s_loadFromJsonView( + ListLocalDeploymentsRequest &listLocalDeploymentsRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)listLocalDeploymentsRequest; + (void)jsonView; + } + + Aws::Crt::String ListLocalDeploymentsRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsRequest"); + } + + Aws::Crt::ScopedResource ListLocalDeploymentsRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ListLocalDeploymentsRequest::s_customDeleter); + shape->m_allocator = allocator; + ListLocalDeploymentsRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ListLocalDeploymentsRequest::s_customDeleter(ListLocalDeploymentsRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ListComponentsResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_components.has_value()) + { + Aws::Crt::JsonObject listOfComponents; + Aws::Crt::Vector listOfComponentsJsonArray; + for (const auto &listOfComponentsItem : m_components.value()) + { + Aws::Crt::JsonObject listOfComponentsJsonArrayItem; + listOfComponentsItem.SerializeToJsonObject(listOfComponentsJsonArrayItem); + listOfComponentsJsonArray.emplace_back(std::move(listOfComponentsJsonArrayItem)); + } + listOfComponents.AsArray(std::move(listOfComponentsJsonArray)); + payloadObject.WithObject("components", std::move(listOfComponents)); + } + } + + void ListComponentsResponse::s_loadFromJsonView( + ListComponentsResponse &listComponentsResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("components")) + { + listComponentsResponse.m_components = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &listOfComponentsJsonView : jsonView.GetArray("components")) + { + Aws::Crt::Optional listOfComponentsItem; + listOfComponentsItem = ComponentDetails(); + ComponentDetails::s_loadFromJsonView(listOfComponentsItem.value(), listOfComponentsJsonView); + listComponentsResponse.m_components.value().push_back(listOfComponentsItem.value()); + } + } + } + + Aws::Crt::String ListComponentsResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListComponentsResponse"); + } + + Aws::Crt::ScopedResource ListComponentsResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ListComponentsResponse::s_customDeleter); + shape->m_allocator = allocator; + ListComponentsResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ListComponentsResponse::s_customDeleter(ListComponentsResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ListComponentsRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void ListComponentsRequest::s_loadFromJsonView( + ListComponentsRequest &listComponentsRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)listComponentsRequest; + (void)jsonView; + } + + Aws::Crt::String ListComponentsRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListComponentsRequest"); + } + + Aws::Crt::ScopedResource ListComponentsRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ListComponentsRequest::s_customDeleter); + shape->m_allocator = allocator; + ListComponentsRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void ListComponentsRequest::s_customDeleter(ListComponentsRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetThingShadowResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_payload.has_value()) + { + if (m_payload.value().size() > 0) + { + payloadObject.WithString("payload", Aws::Crt::Base64Encode(m_payload.value())); + } + } + } + + void GetThingShadowResponse::s_loadFromJsonView( + GetThingShadowResponse &getThingShadowResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("payload")) + { + if (jsonView.GetString("payload").size() > 0) + { + getThingShadowResponse.m_payload = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("payload"))); + } + } + } + + Aws::Crt::String GetThingShadowResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetThingShadowResponse"); + } + + Aws::Crt::ScopedResource GetThingShadowResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetThingShadowResponse::s_customDeleter); + shape->m_allocator = allocator; + GetThingShadowResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetThingShadowResponse::s_customDeleter(GetThingShadowResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetThingShadowRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_thingName.has_value()) + { + payloadObject.WithString("thingName", m_thingName.value()); + } + if (m_shadowName.has_value()) + { + payloadObject.WithString("shadowName", m_shadowName.value()); + } + } + + void GetThingShadowRequest::s_loadFromJsonView( + GetThingShadowRequest &getThingShadowRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("thingName")) + { + getThingShadowRequest.m_thingName = + Aws::Crt::Optional(jsonView.GetString("thingName")); + } + if (jsonView.ValueExists("shadowName")) + { + getThingShadowRequest.m_shadowName = + Aws::Crt::Optional(jsonView.GetString("shadowName")); + } + } + + Aws::Crt::String GetThingShadowRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetThingShadowRequest"); + } + + Aws::Crt::ScopedResource GetThingShadowRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetThingShadowRequest::s_customDeleter); + shape->m_allocator = allocator; + GetThingShadowRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetThingShadowRequest::s_customDeleter(GetThingShadowRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetSecretValueResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_secretId.has_value()) + { + payloadObject.WithString("secretId", m_secretId.value()); + } + if (m_versionId.has_value()) + { + payloadObject.WithString("versionId", m_versionId.value()); + } + if (m_versionStage.has_value()) + { + Aws::Crt::JsonObject secretVersionList; + Aws::Crt::Vector secretVersionListJsonArray; + for (const auto &secretVersionListItem : m_versionStage.value()) + { + Aws::Crt::JsonObject secretVersionListJsonArrayItem; + secretVersionListJsonArrayItem.AsString(secretVersionListItem); + secretVersionListJsonArray.emplace_back(std::move(secretVersionListJsonArrayItem)); + } + secretVersionList.AsArray(std::move(secretVersionListJsonArray)); + payloadObject.WithObject("versionStage", std::move(secretVersionList)); + } + if (m_secretValue.has_value()) + { + Aws::Crt::JsonObject secretValueValue; + m_secretValue.value().SerializeToJsonObject(secretValueValue); + payloadObject.WithObject("secretValue", std::move(secretValueValue)); + } + } + + void GetSecretValueResponse::s_loadFromJsonView( + GetSecretValueResponse &getSecretValueResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("secretId")) + { + getSecretValueResponse.m_secretId = + Aws::Crt::Optional(jsonView.GetString("secretId")); + } + if (jsonView.ValueExists("versionId")) + { + getSecretValueResponse.m_versionId = + Aws::Crt::Optional(jsonView.GetString("versionId")); + } + if (jsonView.ValueExists("versionStage")) + { + getSecretValueResponse.m_versionStage = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &secretVersionListJsonView : jsonView.GetArray("versionStage")) + { + Aws::Crt::Optional secretVersionListItem; + secretVersionListItem = Aws::Crt::Optional(secretVersionListJsonView.AsString()); + getSecretValueResponse.m_versionStage.value().push_back(secretVersionListItem.value()); + } + } + if (jsonView.ValueExists("secretValue")) + { + getSecretValueResponse.m_secretValue = SecretValue(); + SecretValue::s_loadFromJsonView( + getSecretValueResponse.m_secretValue.value(), jsonView.GetJsonObject("secretValue")); + } + } + + Aws::Crt::String GetSecretValueResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetSecretValueResponse"); + } + + Aws::Crt::ScopedResource GetSecretValueResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetSecretValueResponse::s_customDeleter); + shape->m_allocator = allocator; + GetSecretValueResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetSecretValueResponse::s_customDeleter(GetSecretValueResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetSecretValueRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_secretId.has_value()) + { + payloadObject.WithString("secretId", m_secretId.value()); + } + if (m_versionId.has_value()) + { + payloadObject.WithString("versionId", m_versionId.value()); + } + if (m_versionStage.has_value()) + { + payloadObject.WithString("versionStage", m_versionStage.value()); + } + } + + void GetSecretValueRequest::s_loadFromJsonView( + GetSecretValueRequest &getSecretValueRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("secretId")) + { + getSecretValueRequest.m_secretId = Aws::Crt::Optional(jsonView.GetString("secretId")); + } + if (jsonView.ValueExists("versionId")) + { + getSecretValueRequest.m_versionId = + Aws::Crt::Optional(jsonView.GetString("versionId")); + } + if (jsonView.ValueExists("versionStage")) + { + getSecretValueRequest.m_versionStage = + Aws::Crt::Optional(jsonView.GetString("versionStage")); + } + } + + Aws::Crt::String GetSecretValueRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetSecretValueRequest"); + } + + Aws::Crt::ScopedResource GetSecretValueRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetSecretValueRequest::s_customDeleter); + shape->m_allocator = allocator; + GetSecretValueRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetSecretValueRequest::s_customDeleter(GetSecretValueRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetLocalDeploymentStatusResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deployment.has_value()) + { + Aws::Crt::JsonObject localDeploymentValue; + m_deployment.value().SerializeToJsonObject(localDeploymentValue); + payloadObject.WithObject("deployment", std::move(localDeploymentValue)); + } + } + + void GetLocalDeploymentStatusResponse::s_loadFromJsonView( + GetLocalDeploymentStatusResponse &getLocalDeploymentStatusResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deployment")) + { + getLocalDeploymentStatusResponse.m_deployment = LocalDeployment(); + LocalDeployment::s_loadFromJsonView( + getLocalDeploymentStatusResponse.m_deployment.value(), jsonView.GetJsonObject("deployment")); + } + } + + Aws::Crt::String GetLocalDeploymentStatusResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusResponse"); + } + + Aws::Crt::ScopedResource GetLocalDeploymentStatusResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + GetLocalDeploymentStatusResponse::s_customDeleter); + shape->m_allocator = allocator; + GetLocalDeploymentStatusResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetLocalDeploymentStatusResponse::s_customDeleter(GetLocalDeploymentStatusResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetLocalDeploymentStatusRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + } + + void GetLocalDeploymentStatusRequest::s_loadFromJsonView( + GetLocalDeploymentStatusRequest &getLocalDeploymentStatusRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deploymentId")) + { + getLocalDeploymentStatusRequest.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + } + + Aws::Crt::String GetLocalDeploymentStatusRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusRequest"); + } + + Aws::Crt::ScopedResource GetLocalDeploymentStatusRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + GetLocalDeploymentStatusRequest::s_customDeleter); + shape->m_allocator = allocator; + GetLocalDeploymentStatusRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetLocalDeploymentStatusRequest::s_customDeleter(GetLocalDeploymentStatusRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetConfigurationResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + if (m_value.has_value()) + { + payloadObject.WithObject("value", m_value.value()); + } + } + + void GetConfigurationResponse::s_loadFromJsonView( + GetConfigurationResponse &getConfigurationResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + getConfigurationResponse.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + if (jsonView.ValueExists("value")) + { + getConfigurationResponse.m_value = + Aws::Crt::Optional(jsonView.GetJsonObject("value").Materialize()); + } + } + + Aws::Crt::String GetConfigurationResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetConfigurationResponse"); + } + + Aws::Crt::ScopedResource GetConfigurationResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetConfigurationResponse::s_customDeleter); + shape->m_allocator = allocator; + GetConfigurationResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetConfigurationResponse::s_customDeleter(GetConfigurationResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetConfigurationRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + if (m_keyPath.has_value()) + { + Aws::Crt::JsonObject keyPath; + Aws::Crt::Vector keyPathJsonArray; + for (const auto &keyPathItem : m_keyPath.value()) + { + Aws::Crt::JsonObject keyPathJsonArrayItem; + keyPathJsonArrayItem.AsString(keyPathItem); + keyPathJsonArray.emplace_back(std::move(keyPathJsonArrayItem)); + } + keyPath.AsArray(std::move(keyPathJsonArray)); + payloadObject.WithObject("keyPath", std::move(keyPath)); + } + } + + void GetConfigurationRequest::s_loadFromJsonView( + GetConfigurationRequest &getConfigurationRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + getConfigurationRequest.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + if (jsonView.ValueExists("keyPath")) + { + getConfigurationRequest.m_keyPath = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &keyPathJsonView : jsonView.GetArray("keyPath")) + { + Aws::Crt::Optional keyPathItem; + keyPathItem = Aws::Crt::Optional(keyPathJsonView.AsString()); + getConfigurationRequest.m_keyPath.value().push_back(keyPathItem.value()); + } + } + } + + Aws::Crt::String GetConfigurationRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetConfigurationRequest"); + } + + Aws::Crt::ScopedResource GetConfigurationRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetConfigurationRequest::s_customDeleter); + shape->m_allocator = allocator; + GetConfigurationRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetConfigurationRequest::s_customDeleter(GetConfigurationRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetComponentDetailsResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentDetails.has_value()) + { + Aws::Crt::JsonObject componentDetailsValue; + m_componentDetails.value().SerializeToJsonObject(componentDetailsValue); + payloadObject.WithObject("componentDetails", std::move(componentDetailsValue)); + } + } + + void GetComponentDetailsResponse::s_loadFromJsonView( + GetComponentDetailsResponse &getComponentDetailsResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentDetails")) + { + getComponentDetailsResponse.m_componentDetails = ComponentDetails(); + ComponentDetails::s_loadFromJsonView( + getComponentDetailsResponse.m_componentDetails.value(), jsonView.GetJsonObject("componentDetails")); + } + } + + Aws::Crt::String GetComponentDetailsResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetComponentDetailsResponse"); + } + + Aws::Crt::ScopedResource GetComponentDetailsResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetComponentDetailsResponse::s_customDeleter); + shape->m_allocator = allocator; + GetComponentDetailsResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetComponentDetailsResponse::s_customDeleter(GetComponentDetailsResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void GetComponentDetailsRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_componentName.has_value()) + { + payloadObject.WithString("componentName", m_componentName.value()); + } + } + + void GetComponentDetailsRequest::s_loadFromJsonView( + GetComponentDetailsRequest &getComponentDetailsRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("componentName")) + { + getComponentDetailsRequest.m_componentName = + Aws::Crt::Optional(jsonView.GetString("componentName")); + } + } + + Aws::Crt::String GetComponentDetailsRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetComponentDetailsRequest"); + } + + Aws::Crt::ScopedResource GetComponentDetailsRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), GetComponentDetailsRequest::s_customDeleter); + shape->m_allocator = allocator; + GetComponentDetailsRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void GetComponentDetailsRequest::s_customDeleter(GetComponentDetailsRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void DeleteThingShadowResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_payload.has_value()) + { + if (m_payload.value().size() > 0) + { + payloadObject.WithString("payload", Aws::Crt::Base64Encode(m_payload.value())); + } + } + } + + void DeleteThingShadowResponse::s_loadFromJsonView( + DeleteThingShadowResponse &deleteThingShadowResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("payload")) + { + if (jsonView.GetString("payload").size() > 0) + { + deleteThingShadowResponse.m_payload = Aws::Crt::Optional>( + Aws::Crt::Base64Decode(jsonView.GetString("payload"))); + } + } + } + + Aws::Crt::String DeleteThingShadowResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeleteThingShadowResponse"); + } + + Aws::Crt::ScopedResource DeleteThingShadowResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), DeleteThingShadowResponse::s_customDeleter); + shape->m_allocator = allocator; + DeleteThingShadowResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void DeleteThingShadowResponse::s_customDeleter(DeleteThingShadowResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void DeleteThingShadowRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_thingName.has_value()) + { + payloadObject.WithString("thingName", m_thingName.value()); + } + if (m_shadowName.has_value()) + { + payloadObject.WithString("shadowName", m_shadowName.value()); + } + } + + void DeleteThingShadowRequest::s_loadFromJsonView( + DeleteThingShadowRequest &deleteThingShadowRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("thingName")) + { + deleteThingShadowRequest.m_thingName = + Aws::Crt::Optional(jsonView.GetString("thingName")); + } + if (jsonView.ValueExists("shadowName")) + { + deleteThingShadowRequest.m_shadowName = + Aws::Crt::Optional(jsonView.GetString("shadowName")); + } + } + + Aws::Crt::String DeleteThingShadowRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeleteThingShadowRequest"); + } + + Aws::Crt::ScopedResource DeleteThingShadowRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), DeleteThingShadowRequest::s_customDeleter); + shape->m_allocator = allocator; + DeleteThingShadowRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void DeleteThingShadowRequest::s_customDeleter(DeleteThingShadowRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ResourceNotFoundError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + if (m_resourceType.has_value()) + { + payloadObject.WithString("resourceType", m_resourceType.value()); + } + if (m_resourceName.has_value()) + { + payloadObject.WithString("resourceName", m_resourceName.value()); + } + } + + void ResourceNotFoundError::s_loadFromJsonView( + ResourceNotFoundError &resourceNotFoundError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + resourceNotFoundError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + if (jsonView.ValueExists("resourceType")) + { + resourceNotFoundError.m_resourceType = + Aws::Crt::Optional(jsonView.GetString("resourceType")); + } + if (jsonView.ValueExists("resourceName")) + { + resourceNotFoundError.m_resourceName = + Aws::Crt::Optional(jsonView.GetString("resourceName")); + } + } + + Aws::Crt::String ResourceNotFoundError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ResourceNotFoundError"); + } + + Aws::Crt::ScopedResource ResourceNotFoundError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ResourceNotFoundError::s_customDeleter); + shape->m_allocator = allocator; + ResourceNotFoundError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void ResourceNotFoundError::s_customDeleter(ResourceNotFoundError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void DeferComponentUpdateResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void DeferComponentUpdateResponse::s_loadFromJsonView( + DeferComponentUpdateResponse &deferComponentUpdateResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)deferComponentUpdateResponse; + (void)jsonView; + } + + Aws::Crt::String DeferComponentUpdateResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeferComponentUpdateResponse"); + } + + Aws::Crt::ScopedResource DeferComponentUpdateResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), DeferComponentUpdateResponse::s_customDeleter); + shape->m_allocator = allocator; + DeferComponentUpdateResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void DeferComponentUpdateResponse::s_customDeleter(DeferComponentUpdateResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void DeferComponentUpdateRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + if (m_recheckAfterMs.has_value()) + { + payloadObject.WithInt64("recheckAfterMs", m_recheckAfterMs.value()); + } + } + + void DeferComponentUpdateRequest::s_loadFromJsonView( + DeferComponentUpdateRequest &deferComponentUpdateRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deploymentId")) + { + deferComponentUpdateRequest.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + if (jsonView.ValueExists("message")) + { + deferComponentUpdateRequest.m_message = + Aws::Crt::Optional(jsonView.GetString("message")); + } + if (jsonView.ValueExists("recheckAfterMs")) + { + deferComponentUpdateRequest.m_recheckAfterMs = + Aws::Crt::Optional(jsonView.GetInt64("recheckAfterMs")); + } + } + + Aws::Crt::String DeferComponentUpdateRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeferComponentUpdateRequest"); + } + + Aws::Crt::ScopedResource DeferComponentUpdateRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), DeferComponentUpdateRequest::s_customDeleter); + shape->m_allocator = allocator; + DeferComponentUpdateRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void DeferComponentUpdateRequest::s_customDeleter(DeferComponentUpdateRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void InvalidArgumentsError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void InvalidArgumentsError::s_loadFromJsonView( + InvalidArgumentsError &invalidArgumentsError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + invalidArgumentsError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String InvalidArgumentsError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#InvalidArgumentsError"); + } + + Aws::Crt::ScopedResource InvalidArgumentsError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), InvalidArgumentsError::s_customDeleter); + shape->m_allocator = allocator; + InvalidArgumentsError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void InvalidArgumentsError::s_customDeleter(InvalidArgumentsError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void InvalidArtifactsDirectoryPathError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const + noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void InvalidArtifactsDirectoryPathError::s_loadFromJsonView( + InvalidArtifactsDirectoryPathError &invalidArtifactsDirectoryPathError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + invalidArtifactsDirectoryPathError.m_message = + Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String InvalidArtifactsDirectoryPathError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#InvalidArtifactsDirectoryPathError"); + } + + Aws::Crt::ScopedResource InvalidArtifactsDirectoryPathError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + InvalidArtifactsDirectoryPathError::s_customDeleter); + shape->m_allocator = allocator; + InvalidArtifactsDirectoryPathError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void InvalidArtifactsDirectoryPathError::s_customDeleter(InvalidArtifactsDirectoryPathError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void InvalidRecipeDirectoryPathError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void InvalidRecipeDirectoryPathError::s_loadFromJsonView( + InvalidRecipeDirectoryPathError &invalidRecipeDirectoryPathError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + invalidRecipeDirectoryPathError.m_message = + Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String InvalidRecipeDirectoryPathError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#InvalidRecipeDirectoryPathError"); + } + + Aws::Crt::ScopedResource InvalidRecipeDirectoryPathError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + InvalidRecipeDirectoryPathError::s_customDeleter); + shape->m_allocator = allocator; + InvalidRecipeDirectoryPathError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void InvalidRecipeDirectoryPathError::s_customDeleter(InvalidRecipeDirectoryPathError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void CreateLocalDeploymentResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_deploymentId.has_value()) + { + payloadObject.WithString("deploymentId", m_deploymentId.value()); + } + } + + void CreateLocalDeploymentResponse::s_loadFromJsonView( + CreateLocalDeploymentResponse &createLocalDeploymentResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("deploymentId")) + { + createLocalDeploymentResponse.m_deploymentId = + Aws::Crt::Optional(jsonView.GetString("deploymentId")); + } + } + + Aws::Crt::String CreateLocalDeploymentResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentResponse"); + } + + Aws::Crt::ScopedResource CreateLocalDeploymentResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), + CreateLocalDeploymentResponse::s_customDeleter); + shape->m_allocator = allocator; + CreateLocalDeploymentResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void CreateLocalDeploymentResponse::s_customDeleter(CreateLocalDeploymentResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void CreateLocalDeploymentRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_groupName.has_value()) + { + payloadObject.WithString("groupName", m_groupName.value()); + } + if (m_rootComponentVersionsToAdd.has_value()) + { + Aws::Crt::JsonObject componentToVersionMapValue; + for (const auto &componentToVersionMapItem : m_rootComponentVersionsToAdd.value()) + { + Aws::Crt::JsonObject componentToVersionMapJsonObject; + componentToVersionMapJsonObject.AsString(componentToVersionMapItem.second); + componentToVersionMapValue.WithObject( + componentToVersionMapItem.first, std::move(componentToVersionMapJsonObject)); + } + payloadObject.WithObject("rootComponentVersionsToAdd", std::move(componentToVersionMapValue)); + } + if (m_rootComponentsToRemove.has_value()) + { + Aws::Crt::JsonObject componentList; + Aws::Crt::Vector componentListJsonArray; + for (const auto &componentListItem : m_rootComponentsToRemove.value()) + { + Aws::Crt::JsonObject componentListJsonArrayItem; + componentListJsonArrayItem.AsString(componentListItem); + componentListJsonArray.emplace_back(std::move(componentListJsonArrayItem)); + } + componentList.AsArray(std::move(componentListJsonArray)); + payloadObject.WithObject("rootComponentsToRemove", std::move(componentList)); + } + if (m_componentToConfiguration.has_value()) + { + Aws::Crt::JsonObject componentToConfigurationValue; + for (const auto &componentToConfigurationItem : m_componentToConfiguration.value()) + { + Aws::Crt::JsonObject componentToConfigurationJsonObject; + componentToConfigurationJsonObject.AsObject(componentToConfigurationItem.second); + componentToConfigurationValue.WithObject( + componentToConfigurationItem.first, std::move(componentToConfigurationJsonObject)); + } + payloadObject.WithObject("componentToConfiguration", std::move(componentToConfigurationValue)); + } + if (m_componentToRunWithInfo.has_value()) + { + Aws::Crt::JsonObject componentToRunWithInfoValue; + for (const auto &componentToRunWithInfoItem : m_componentToRunWithInfo.value()) + { + Aws::Crt::JsonObject componentToRunWithInfoJsonObject; + componentToRunWithInfoItem.second.SerializeToJsonObject(componentToRunWithInfoJsonObject); + componentToRunWithInfoValue.WithObject( + componentToRunWithInfoItem.first, std::move(componentToRunWithInfoJsonObject)); + } + payloadObject.WithObject("componentToRunWithInfo", std::move(componentToRunWithInfoValue)); + } + if (m_recipeDirectoryPath.has_value()) + { + payloadObject.WithString("recipeDirectoryPath", m_recipeDirectoryPath.value()); + } + if (m_artifactsDirectoryPath.has_value()) + { + payloadObject.WithString("artifactsDirectoryPath", m_artifactsDirectoryPath.value()); + } + } + + void CreateLocalDeploymentRequest::s_loadFromJsonView( + CreateLocalDeploymentRequest &createLocalDeploymentRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("groupName")) + { + createLocalDeploymentRequest.m_groupName = + Aws::Crt::Optional(jsonView.GetString("groupName")); + } + if (jsonView.ValueExists("rootComponentVersionsToAdd")) + { + createLocalDeploymentRequest.m_rootComponentVersionsToAdd = + Aws::Crt::Map(); + for (const auto &componentToVersionMapPair : + jsonView.GetJsonObject("rootComponentVersionsToAdd").GetAllObjects()) + { + Aws::Crt::Optional componentToVersionMapValue; + componentToVersionMapValue = + Aws::Crt::Optional(componentToVersionMapPair.second.AsString()); + createLocalDeploymentRequest.m_rootComponentVersionsToAdd.value()[componentToVersionMapPair.first] = + componentToVersionMapValue.value(); + } + } + if (jsonView.ValueExists("rootComponentsToRemove")) + { + createLocalDeploymentRequest.m_rootComponentsToRemove = Aws::Crt::Vector(); + for (const Aws::Crt::JsonView &componentListJsonView : jsonView.GetArray("rootComponentsToRemove")) + { + Aws::Crt::Optional componentListItem; + componentListItem = Aws::Crt::Optional(componentListJsonView.AsString()); + createLocalDeploymentRequest.m_rootComponentsToRemove.value().push_back(componentListItem.value()); + } + } + if (jsonView.ValueExists("componentToConfiguration")) + { + createLocalDeploymentRequest.m_componentToConfiguration = + Aws::Crt::Map(); + for (const auto &componentToConfigurationPair : + jsonView.GetJsonObject("componentToConfiguration").GetAllObjects()) + { + Aws::Crt::Optional componentToConfigurationValue; + componentToConfigurationValue = Aws::Crt::Optional( + componentToConfigurationPair.second.AsObject().Materialize()); + createLocalDeploymentRequest.m_componentToConfiguration + .value()[componentToConfigurationPair.first] = componentToConfigurationValue.value(); + } + } + if (jsonView.ValueExists("componentToRunWithInfo")) + { + createLocalDeploymentRequest.m_componentToRunWithInfo = Aws::Crt::Map(); + for (const auto &componentToRunWithInfoPair : + jsonView.GetJsonObject("componentToRunWithInfo").GetAllObjects()) + { + Aws::Crt::Optional componentToRunWithInfoValue; + componentToRunWithInfoValue = RunWithInfo(); + RunWithInfo::s_loadFromJsonView( + componentToRunWithInfoValue.value(), componentToRunWithInfoPair.second); + createLocalDeploymentRequest.m_componentToRunWithInfo.value()[componentToRunWithInfoPair.first] = + componentToRunWithInfoValue.value(); + } + } + if (jsonView.ValueExists("recipeDirectoryPath")) + { + createLocalDeploymentRequest.m_recipeDirectoryPath = + Aws::Crt::Optional(jsonView.GetString("recipeDirectoryPath")); + } + if (jsonView.ValueExists("artifactsDirectoryPath")) + { + createLocalDeploymentRequest.m_artifactsDirectoryPath = + Aws::Crt::Optional(jsonView.GetString("artifactsDirectoryPath")); + } + } + + Aws::Crt::String CreateLocalDeploymentRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentRequest"); + } + + Aws::Crt::ScopedResource CreateLocalDeploymentRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), CreateLocalDeploymentRequest::s_customDeleter); + shape->m_allocator = allocator; + CreateLocalDeploymentRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void CreateLocalDeploymentRequest::s_customDeleter(CreateLocalDeploymentRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void ServiceError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void ServiceError::s_loadFromJsonView(ServiceError &serviceError, const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + serviceError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String ServiceError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ServiceError"); + } + + Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), ServiceError::s_customDeleter); + shape->m_allocator = allocator; + ServiceError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void ServiceError::s_customDeleter(ServiceError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void UnauthorizedError::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_message.has_value()) + { + payloadObject.WithString("message", m_message.value()); + } + } + + void UnauthorizedError::s_loadFromJsonView( + UnauthorizedError &unauthorizedError, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("message")) + { + unauthorizedError.m_message = Aws::Crt::Optional(jsonView.GetString("message")); + } + } + + Aws::Crt::String UnauthorizedError::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UnauthorizedError"); + } + + Aws::Crt::ScopedResource UnauthorizedError::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), UnauthorizedError::s_customDeleter); + shape->m_allocator = allocator; + UnauthorizedError::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, OperationError::s_customDeleter); + } + + void UnauthorizedError::s_customDeleter(UnauthorizedError *shape) noexcept + { + OperationError::s_customDeleter(static_cast(shape)); + } + + void CreateDebugPasswordResponse::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + if (m_password.has_value()) + { + payloadObject.WithString("password", m_password.value()); + } + if (m_username.has_value()) + { + payloadObject.WithString("username", m_username.value()); + } + if (m_passwordExpiration.has_value()) + { + payloadObject.WithDouble("passwordExpiration", m_passwordExpiration.value().SecondsWithMSPrecision()); + } + if (m_certificateSHA256Hash.has_value()) + { + payloadObject.WithString("certificateSHA256Hash", m_certificateSHA256Hash.value()); + } + if (m_certificateSHA1Hash.has_value()) + { + payloadObject.WithString("certificateSHA1Hash", m_certificateSHA1Hash.value()); + } + } + + void CreateDebugPasswordResponse::s_loadFromJsonView( + CreateDebugPasswordResponse &createDebugPasswordResponse, + const Aws::Crt::JsonView &jsonView) noexcept + { + if (jsonView.ValueExists("password")) + { + createDebugPasswordResponse.m_password = + Aws::Crt::Optional(jsonView.GetString("password")); + } + if (jsonView.ValueExists("username")) + { + createDebugPasswordResponse.m_username = + Aws::Crt::Optional(jsonView.GetString("username")); + } + if (jsonView.ValueExists("passwordExpiration")) + { + createDebugPasswordResponse.m_passwordExpiration = Aws::Crt::Optional( + Aws::Crt::DateTime(jsonView.GetDouble("passwordExpiration"))); + } + if (jsonView.ValueExists("certificateSHA256Hash")) + { + createDebugPasswordResponse.m_certificateSHA256Hash = + Aws::Crt::Optional(jsonView.GetString("certificateSHA256Hash")); + } + if (jsonView.ValueExists("certificateSHA1Hash")) + { + createDebugPasswordResponse.m_certificateSHA1Hash = + Aws::Crt::Optional(jsonView.GetString("certificateSHA1Hash")); + } + } + + Aws::Crt::String CreateDebugPasswordResponse::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateDebugPasswordResponse"); + } + + Aws::Crt::ScopedResource CreateDebugPasswordResponse::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), CreateDebugPasswordResponse::s_customDeleter); + shape->m_allocator = allocator; + CreateDebugPasswordResponse::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void CreateDebugPasswordResponse::s_customDeleter(CreateDebugPasswordResponse *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void CreateDebugPasswordRequest::SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept + { + (void)payloadObject; + } + + void CreateDebugPasswordRequest::s_loadFromJsonView( + CreateDebugPasswordRequest &createDebugPasswordRequest, + const Aws::Crt::JsonView &jsonView) noexcept + { + (void)createDebugPasswordRequest; + (void)jsonView; + } + + Aws::Crt::String CreateDebugPasswordRequest::GetModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateDebugPasswordRequest"); + } + + Aws::Crt::ScopedResource CreateDebugPasswordRequest::s_allocateFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) noexcept + { + Aws::Crt::String payload = {stringView.begin(), stringView.end()}; + Aws::Crt::JsonObject jsonObject(payload); + Aws::Crt::JsonView jsonView(jsonObject); + + Aws::Crt::ScopedResource shape( + Aws::Crt::New(allocator), CreateDebugPasswordRequest::s_customDeleter); + shape->m_allocator = allocator; + CreateDebugPasswordRequest::s_loadFromJsonView(*shape, jsonView); + auto operationResponse = static_cast(shape.release()); + return Aws::Crt::ScopedResource(operationResponse, AbstractShapeBase::s_customDeleter); + } + + void CreateDebugPasswordRequest::s_customDeleter(CreateDebugPasswordRequest *shape) noexcept + { + AbstractShapeBase::s_customDeleter(static_cast(shape)); + } + + void SubscribeToIoTCoreStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool SubscribeToIoTCoreStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#UnauthorizedError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + return true; + } + + SubscribeToIoTCoreOperationContext::SubscribeToIoTCoreOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource SubscribeToIoTCoreOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SubscribeToIoTCoreResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource SubscribeToIoTCoreOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return IoTCoreMessage::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String SubscribeToIoTCoreOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreRequest"); + } + + Aws::Crt::String SubscribeToIoTCoreOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreResponse"); + } + + Aws::Crt::Optional SubscribeToIoTCoreOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::String("aws.greengrass#IoTCoreMessage"); + } + + Aws::Crt::String SubscribeToIoTCoreOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToIoTCore"); + } + + std::future SubscribeToIoTCoreOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return SubscribeToIoTCoreResult(GetOperationResult().get()); }); + } + + SubscribeToIoTCoreOperation::SubscribeToIoTCoreOperation( + ClientConnection &connection, + SubscribeToIoTCoreStreamHandler *streamHandler, + const SubscribeToIoTCoreOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future SubscribeToIoTCoreOperation::Activate( + const SubscribeToIoTCoreRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String SubscribeToIoTCoreOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + PublishToIoTCoreOperationContext::PublishToIoTCoreOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource PublishToIoTCoreOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return PublishToIoTCoreResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource PublishToIoTCoreOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String PublishToIoTCoreOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToIoTCoreRequest"); + } + + Aws::Crt::String PublishToIoTCoreOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToIoTCoreResponse"); + } + + Aws::Crt::Optional PublishToIoTCoreOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String PublishToIoTCoreOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToIoTCore"); + } + + std::future PublishToIoTCoreOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return PublishToIoTCoreResult(GetOperationResult().get()); }); + } + + PublishToIoTCoreOperation::PublishToIoTCoreOperation( + ClientConnection &connection, + const PublishToIoTCoreOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future PublishToIoTCoreOperation::Activate( + const PublishToIoTCoreRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String PublishToIoTCoreOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + void SubscribeToConfigurationUpdateStreamHandler::OnStreamEvent( + Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool SubscribeToConfigurationUpdateStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ResourceNotFoundError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + return true; + } + + SubscribeToConfigurationUpdateOperationContext::SubscribeToConfigurationUpdateOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource SubscribeToConfigurationUpdateOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SubscribeToConfigurationUpdateResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource SubscribeToConfigurationUpdateOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return ConfigurationUpdateEvents::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String SubscribeToConfigurationUpdateOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateRequest"); + } + + Aws::Crt::String SubscribeToConfigurationUpdateOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateResponse"); + } + + Aws::Crt::Optional SubscribeToConfigurationUpdateOperationContext:: + GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvents"); + } + + Aws::Crt::String SubscribeToConfigurationUpdateOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdate"); + } + + std::future SubscribeToConfigurationUpdateOperation::GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { + return SubscribeToConfigurationUpdateResult(GetOperationResult().get()); + }); + } + + SubscribeToConfigurationUpdateOperation::SubscribeToConfigurationUpdateOperation( + ClientConnection &connection, + SubscribeToConfigurationUpdateStreamHandler *streamHandler, + const SubscribeToConfigurationUpdateOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future SubscribeToConfigurationUpdateOperation::Activate( + const SubscribeToConfigurationUpdateRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String SubscribeToConfigurationUpdateOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + DeleteThingShadowOperationContext::DeleteThingShadowOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource DeleteThingShadowOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return DeleteThingShadowResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource DeleteThingShadowOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String DeleteThingShadowOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeleteThingShadowRequest"); + } + + Aws::Crt::String DeleteThingShadowOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeleteThingShadowResponse"); + } + + Aws::Crt::Optional DeleteThingShadowOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String DeleteThingShadowOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeleteThingShadow"); + } + + std::future DeleteThingShadowOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return DeleteThingShadowResult(GetOperationResult().get()); }); + } + + DeleteThingShadowOperation::DeleteThingShadowOperation( + ClientConnection &connection, + const DeleteThingShadowOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future DeleteThingShadowOperation::Activate( + const DeleteThingShadowRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String DeleteThingShadowOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + DeferComponentUpdateOperationContext::DeferComponentUpdateOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource DeferComponentUpdateOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return DeferComponentUpdateResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource DeferComponentUpdateOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String DeferComponentUpdateOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeferComponentUpdateRequest"); + } + + Aws::Crt::String DeferComponentUpdateOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeferComponentUpdateResponse"); + } + + Aws::Crt::Optional DeferComponentUpdateOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String DeferComponentUpdateOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#DeferComponentUpdate"); + } + + std::future DeferComponentUpdateOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return DeferComponentUpdateResult(GetOperationResult().get()); }); + } + + DeferComponentUpdateOperation::DeferComponentUpdateOperation( + ClientConnection &connection, + const DeferComponentUpdateOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future DeferComponentUpdateOperation::Activate( + const DeferComponentUpdateRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String DeferComponentUpdateOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + void SubscribeToValidateConfigurationUpdatesStreamHandler::OnStreamEvent( + Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool SubscribeToValidateConfigurationUpdatesStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + return true; + } + + SubscribeToValidateConfigurationUpdatesOperationContext:: + SubscribeToValidateConfigurationUpdatesOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SubscribeToValidateConfigurationUpdatesResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return ValidateConfigurationUpdateEvents::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String SubscribeToValidateConfigurationUpdatesOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesRequest"); + } + + Aws::Crt::String SubscribeToValidateConfigurationUpdatesOperationContext::GetInitialResponseModelName() const + noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesResponse"); + } + + Aws::Crt::Optional SubscribeToValidateConfigurationUpdatesOperationContext:: + GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvents"); + } + + Aws::Crt::String SubscribeToValidateConfigurationUpdatesOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdates"); + } + + std::future SubscribeToValidateConfigurationUpdatesOperation:: + GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { + return SubscribeToValidateConfigurationUpdatesResult(GetOperationResult().get()); + }); + } + + SubscribeToValidateConfigurationUpdatesOperation::SubscribeToValidateConfigurationUpdatesOperation( + ClientConnection &connection, + SubscribeToValidateConfigurationUpdatesStreamHandler *streamHandler, + const SubscribeToValidateConfigurationUpdatesOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future SubscribeToValidateConfigurationUpdatesOperation::Activate( + const SubscribeToValidateConfigurationUpdatesRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String SubscribeToValidateConfigurationUpdatesOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GetConfigurationOperationContext::GetConfigurationOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetConfigurationOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return GetConfigurationResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetConfigurationOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetConfigurationOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetConfigurationRequest"); + } + + Aws::Crt::String GetConfigurationOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetConfigurationResponse"); + } + + Aws::Crt::Optional GetConfigurationOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetConfigurationOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetConfiguration"); + } + + std::future GetConfigurationOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return GetConfigurationResult(GetOperationResult().get()); }); + } + + GetConfigurationOperation::GetConfigurationOperation( + ClientConnection &connection, + const GetConfigurationOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetConfigurationOperation::Activate( + const GetConfigurationRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetConfigurationOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + void SubscribeToTopicStreamHandler::OnStreamEvent(Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool SubscribeToTopicStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#InvalidArgumentsError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#UnauthorizedError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + return true; + } + + SubscribeToTopicOperationContext::SubscribeToTopicOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource SubscribeToTopicOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SubscribeToTopicResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource SubscribeToTopicOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SubscriptionResponseMessage::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String SubscribeToTopicOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToTopicRequest"); + } + + Aws::Crt::String SubscribeToTopicOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToTopicResponse"); + } + + Aws::Crt::Optional SubscribeToTopicOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::String("aws.greengrass#SubscriptionResponseMessage"); + } + + Aws::Crt::String SubscribeToTopicOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToTopic"); + } + + std::future SubscribeToTopicOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return SubscribeToTopicResult(GetOperationResult().get()); }); + } + + SubscribeToTopicOperation::SubscribeToTopicOperation( + ClientConnection &connection, + SubscribeToTopicStreamHandler *streamHandler, + const SubscribeToTopicOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future SubscribeToTopicOperation::Activate( + const SubscribeToTopicRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String SubscribeToTopicOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GetComponentDetailsOperationContext::GetComponentDetailsOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetComponentDetailsOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return GetComponentDetailsResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetComponentDetailsOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetComponentDetailsOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetComponentDetailsRequest"); + } + + Aws::Crt::String GetComponentDetailsOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetComponentDetailsResponse"); + } + + Aws::Crt::Optional GetComponentDetailsOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetComponentDetailsOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetComponentDetails"); + } + + std::future GetComponentDetailsOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return GetComponentDetailsResult(GetOperationResult().get()); }); + } + + GetComponentDetailsOperation::GetComponentDetailsOperation( + ClientConnection &connection, + const GetComponentDetailsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetComponentDetailsOperation::Activate( + const GetComponentDetailsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetComponentDetailsOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + PublishToTopicOperationContext::PublishToTopicOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource PublishToTopicOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return PublishToTopicResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource PublishToTopicOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String PublishToTopicOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToTopicRequest"); + } + + Aws::Crt::String PublishToTopicOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToTopicResponse"); + } + + Aws::Crt::Optional PublishToTopicOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String PublishToTopicOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#PublishToTopic"); + } + + std::future PublishToTopicOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return PublishToTopicResult(GetOperationResult().get()); }); + } + + PublishToTopicOperation::PublishToTopicOperation( + ClientConnection &connection, + const PublishToTopicOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future PublishToTopicOperation::Activate( + const PublishToTopicRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String PublishToTopicOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + ListComponentsOperationContext::ListComponentsOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource ListComponentsOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return ListComponentsResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource ListComponentsOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String ListComponentsOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListComponentsRequest"); + } + + Aws::Crt::String ListComponentsOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListComponentsResponse"); + } + + Aws::Crt::Optional ListComponentsOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String ListComponentsOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListComponents"); + } + + std::future ListComponentsOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return ListComponentsResult(GetOperationResult().get()); }); + } + + ListComponentsOperation::ListComponentsOperation( + ClientConnection &connection, + const ListComponentsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future ListComponentsOperation::Activate( + const ListComponentsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String ListComponentsOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + CreateDebugPasswordOperationContext::CreateDebugPasswordOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource CreateDebugPasswordOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return CreateDebugPasswordResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource CreateDebugPasswordOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String CreateDebugPasswordOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateDebugPasswordRequest"); + } + + Aws::Crt::String CreateDebugPasswordOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateDebugPasswordResponse"); + } + + Aws::Crt::Optional CreateDebugPasswordOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String CreateDebugPasswordOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateDebugPassword"); + } + + std::future CreateDebugPasswordOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return CreateDebugPasswordResult(GetOperationResult().get()); }); + } + + CreateDebugPasswordOperation::CreateDebugPasswordOperation( + ClientConnection &connection, + const CreateDebugPasswordOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future CreateDebugPasswordOperation::Activate( + const CreateDebugPasswordRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String CreateDebugPasswordOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GetThingShadowOperationContext::GetThingShadowOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetThingShadowOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return GetThingShadowResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetThingShadowOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetThingShadowOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetThingShadowRequest"); + } + + Aws::Crt::String GetThingShadowOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetThingShadowResponse"); + } + + Aws::Crt::Optional GetThingShadowOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetThingShadowOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetThingShadow"); + } + + std::future GetThingShadowOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return GetThingShadowResult(GetOperationResult().get()); }); + } + + GetThingShadowOperation::GetThingShadowOperation( + ClientConnection &connection, + const GetThingShadowOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetThingShadowOperation::Activate( + const GetThingShadowRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetThingShadowOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + SendConfigurationValidityReportOperationContext::SendConfigurationValidityReportOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource SendConfigurationValidityReportOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SendConfigurationValidityReportResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource SendConfigurationValidityReportOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String SendConfigurationValidityReportOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportRequest"); + } + + Aws::Crt::String SendConfigurationValidityReportOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportResponse"); + } + + Aws::Crt::Optional SendConfigurationValidityReportOperationContext:: + GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String SendConfigurationValidityReportOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReport"); + } + + std::future SendConfigurationValidityReportOperation:: + GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { + return SendConfigurationValidityReportResult(GetOperationResult().get()); + }); + } + + SendConfigurationValidityReportOperation::SendConfigurationValidityReportOperation( + ClientConnection &connection, + const SendConfigurationValidityReportOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future SendConfigurationValidityReportOperation::Activate( + const SendConfigurationValidityReportRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String SendConfigurationValidityReportOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + UpdateThingShadowOperationContext::UpdateThingShadowOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource UpdateThingShadowOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return UpdateThingShadowResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource UpdateThingShadowOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String UpdateThingShadowOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateThingShadowRequest"); + } + + Aws::Crt::String UpdateThingShadowOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateThingShadowResponse"); + } + + Aws::Crt::Optional UpdateThingShadowOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String UpdateThingShadowOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateThingShadow"); + } + + std::future UpdateThingShadowOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return UpdateThingShadowResult(GetOperationResult().get()); }); + } + + UpdateThingShadowOperation::UpdateThingShadowOperation( + ClientConnection &connection, + const UpdateThingShadowOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future UpdateThingShadowOperation::Activate( + const UpdateThingShadowRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String UpdateThingShadowOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + UpdateConfigurationOperationContext::UpdateConfigurationOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource UpdateConfigurationOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return UpdateConfigurationResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource UpdateConfigurationOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String UpdateConfigurationOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateConfigurationRequest"); + } + + Aws::Crt::String UpdateConfigurationOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateConfigurationResponse"); + } + + Aws::Crt::Optional UpdateConfigurationOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String UpdateConfigurationOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateConfiguration"); + } + + std::future UpdateConfigurationOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return UpdateConfigurationResult(GetOperationResult().get()); }); + } + + UpdateConfigurationOperation::UpdateConfigurationOperation( + ClientConnection &connection, + const UpdateConfigurationOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future UpdateConfigurationOperation::Activate( + const UpdateConfigurationRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String UpdateConfigurationOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + ValidateAuthorizationTokenOperationContext::ValidateAuthorizationTokenOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource ValidateAuthorizationTokenOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return ValidateAuthorizationTokenResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource ValidateAuthorizationTokenOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String ValidateAuthorizationTokenOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenRequest"); + } + + Aws::Crt::String ValidateAuthorizationTokenOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenResponse"); + } + + Aws::Crt::Optional ValidateAuthorizationTokenOperationContext::GetStreamingResponseModelName() + const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String ValidateAuthorizationTokenOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ValidateAuthorizationToken"); + } + + std::future ValidateAuthorizationTokenOperation::GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { + return ValidateAuthorizationTokenResult(GetOperationResult().get()); + }); + } + + ValidateAuthorizationTokenOperation::ValidateAuthorizationTokenOperation( + ClientConnection &connection, + const ValidateAuthorizationTokenOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future ValidateAuthorizationTokenOperation::Activate( + const ValidateAuthorizationTokenRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String ValidateAuthorizationTokenOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + RestartComponentOperationContext::RestartComponentOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource RestartComponentOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return RestartComponentResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource RestartComponentOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String RestartComponentOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#RestartComponentRequest"); + } + + Aws::Crt::String RestartComponentOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#RestartComponentResponse"); + } + + Aws::Crt::Optional RestartComponentOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String RestartComponentOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#RestartComponent"); + } + + std::future RestartComponentOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return RestartComponentResult(GetOperationResult().get()); }); + } + + RestartComponentOperation::RestartComponentOperation( + ClientConnection &connection, + const RestartComponentOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future RestartComponentOperation::Activate( + const RestartComponentRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String RestartComponentOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GetLocalDeploymentStatusOperationContext::GetLocalDeploymentStatusOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetLocalDeploymentStatusOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return GetLocalDeploymentStatusResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetLocalDeploymentStatusOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetLocalDeploymentStatusOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusRequest"); + } + + Aws::Crt::String GetLocalDeploymentStatusOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusResponse"); + } + + Aws::Crt::Optional GetLocalDeploymentStatusOperationContext::GetStreamingResponseModelName() + const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetLocalDeploymentStatusOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatus"); + } + + std::future GetLocalDeploymentStatusOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return GetLocalDeploymentStatusResult(GetOperationResult().get()); }); + } + + GetLocalDeploymentStatusOperation::GetLocalDeploymentStatusOperation( + ClientConnection &connection, + const GetLocalDeploymentStatusOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetLocalDeploymentStatusOperation::Activate( + const GetLocalDeploymentStatusRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetLocalDeploymentStatusOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GetSecretValueOperationContext::GetSecretValueOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource GetSecretValueOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return GetSecretValueResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource GetSecretValueOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String GetSecretValueOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetSecretValueRequest"); + } + + Aws::Crt::String GetSecretValueOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetSecretValueResponse"); + } + + Aws::Crt::Optional GetSecretValueOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String GetSecretValueOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#GetSecretValue"); + } + + std::future GetSecretValueOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return GetSecretValueResult(GetOperationResult().get()); }); + } + + GetSecretValueOperation::GetSecretValueOperation( + ClientConnection &connection, + const GetSecretValueOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future GetSecretValueOperation::Activate( + const GetSecretValueRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String GetSecretValueOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + UpdateStateOperationContext::UpdateStateOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource UpdateStateOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return UpdateStateResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource UpdateStateOperationContext::AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String UpdateStateOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateStateRequest"); + } + + Aws::Crt::String UpdateStateOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateStateResponse"); + } + + Aws::Crt::Optional UpdateStateOperationContext::GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String UpdateStateOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#UpdateState"); + } + + std::future UpdateStateOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return UpdateStateResult(GetOperationResult().get()); }); + } + + UpdateStateOperation::UpdateStateOperation( + ClientConnection &connection, + const UpdateStateOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future UpdateStateOperation::Activate( + const UpdateStateRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String UpdateStateOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + ListNamedShadowsForThingOperationContext::ListNamedShadowsForThingOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource ListNamedShadowsForThingOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return ListNamedShadowsForThingResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource ListNamedShadowsForThingOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String ListNamedShadowsForThingOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingRequest"); + } + + Aws::Crt::String ListNamedShadowsForThingOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingResponse"); + } + + Aws::Crt::Optional ListNamedShadowsForThingOperationContext::GetStreamingResponseModelName() + const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String ListNamedShadowsForThingOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThing"); + } + + std::future ListNamedShadowsForThingOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return ListNamedShadowsForThingResult(GetOperationResult().get()); }); + } + + ListNamedShadowsForThingOperation::ListNamedShadowsForThingOperation( + ClientConnection &connection, + const ListNamedShadowsForThingOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future ListNamedShadowsForThingOperation::Activate( + const ListNamedShadowsForThingRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String ListNamedShadowsForThingOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + void SubscribeToComponentUpdatesStreamHandler::OnStreamEvent( + Aws::Crt::ScopedResource response) + { + OnStreamEvent(static_cast(response.get())); + } + + bool SubscribeToComponentUpdatesStreamHandler::OnStreamError( + Aws::Crt::ScopedResource operationError, + RpcError rpcError) + { + if (operationError == nullptr) + return OnStreamError(rpcError); + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ResourceNotFoundError")) + { + return OnStreamError(static_cast(operationError.get()), rpcError); + } + return true; + } + + SubscribeToComponentUpdatesOperationContext::SubscribeToComponentUpdatesOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource SubscribeToComponentUpdatesOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return SubscribeToComponentUpdatesResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource SubscribeToComponentUpdatesOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return ComponentUpdatePolicyEvents::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::String SubscribeToComponentUpdatesOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesRequest"); + } + + Aws::Crt::String SubscribeToComponentUpdatesOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesResponse"); + } + + Aws::Crt::Optional SubscribeToComponentUpdatesOperationContext:: + GetStreamingResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ComponentUpdatePolicyEvents"); + } + + Aws::Crt::String SubscribeToComponentUpdatesOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdates"); + } + + std::future SubscribeToComponentUpdatesOperation::GetResult() noexcept + { + return std::async(std::launch::deferred, [this]() { + return SubscribeToComponentUpdatesResult(GetOperationResult().get()); + }); + } + + SubscribeToComponentUpdatesOperation::SubscribeToComponentUpdatesOperation( + ClientConnection &connection, + SubscribeToComponentUpdatesStreamHandler *streamHandler, + const SubscribeToComponentUpdatesOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, streamHandler, operationContext, allocator) + { + } + + std::future SubscribeToComponentUpdatesOperation::Activate( + const SubscribeToComponentUpdatesRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String SubscribeToComponentUpdatesOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + ListLocalDeploymentsOperationContext::ListLocalDeploymentsOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource ListLocalDeploymentsOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return ListLocalDeploymentsResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource ListLocalDeploymentsOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String ListLocalDeploymentsOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsRequest"); + } + + Aws::Crt::String ListLocalDeploymentsOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsResponse"); + } + + Aws::Crt::Optional ListLocalDeploymentsOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String ListLocalDeploymentsOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#ListLocalDeployments"); + } + + std::future ListLocalDeploymentsOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return ListLocalDeploymentsResult(GetOperationResult().get()); }); + } + + ListLocalDeploymentsOperation::ListLocalDeploymentsOperation( + ClientConnection &connection, + const ListLocalDeploymentsOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future ListLocalDeploymentsOperation::Activate( + const ListLocalDeploymentsRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String ListLocalDeploymentsOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + StopComponentOperationContext::StopComponentOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource StopComponentOperationContext::AllocateInitialResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + return StopComponentResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource StopComponentOperationContext::AllocateStreamingResponseFromPayload( + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String StopComponentOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#StopComponentRequest"); + } + + Aws::Crt::String StopComponentOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#StopComponentResponse"); + } + + Aws::Crt::Optional StopComponentOperationContext::GetStreamingResponseModelName() const + noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String StopComponentOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#StopComponent"); + } + + std::future StopComponentOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return StopComponentResult(GetOperationResult().get()); }); + } + + StopComponentOperation::StopComponentOperation( + ClientConnection &connection, + const StopComponentOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future StopComponentOperation::Activate( + const StopComponentRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String StopComponentOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + CreateLocalDeploymentOperationContext::CreateLocalDeploymentOperationContext( + const GreengrassCoreIpcServiceModel &serviceModel) noexcept + : OperationModelContext(serviceModel) + { + } + + Aws::Crt::ScopedResource CreateLocalDeploymentOperationContext:: + AllocateInitialResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + return CreateLocalDeploymentResponse::s_allocateFromPayload(stringView, allocator); + } + + Aws::Crt::ScopedResource CreateLocalDeploymentOperationContext:: + AllocateStreamingResponseFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) const + noexcept + { + (void)stringView; + (void)allocator; + return nullptr; + } + + Aws::Crt::String CreateLocalDeploymentOperationContext::GetRequestModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentRequest"); + } + + Aws::Crt::String CreateLocalDeploymentOperationContext::GetInitialResponseModelName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentResponse"); + } + + Aws::Crt::Optional CreateLocalDeploymentOperationContext::GetStreamingResponseModelName() + const noexcept + { + return Aws::Crt::Optional(); + } + + Aws::Crt::String CreateLocalDeploymentOperationContext::GetOperationName() const noexcept + { + return Aws::Crt::String("aws.greengrass#CreateLocalDeployment"); + } + + std::future CreateLocalDeploymentOperation::GetResult() noexcept + { + return std::async( + std::launch::deferred, [this]() { return CreateLocalDeploymentResult(GetOperationResult().get()); }); + } + + CreateLocalDeploymentOperation::CreateLocalDeploymentOperation( + ClientConnection &connection, + const CreateLocalDeploymentOperationContext &operationContext, + Aws::Crt::Allocator *allocator) noexcept + : ClientOperation(connection, nullptr, operationContext, allocator) + { + } + + std::future CreateLocalDeploymentOperation::Activate( + const CreateLocalDeploymentRequest &request, + OnMessageFlushCallback onMessageFlushCallback) noexcept + { + return ClientOperation::Activate(static_cast(&request), onMessageFlushCallback); + } + + Aws::Crt::String CreateLocalDeploymentOperation::GetModelName() const noexcept + { + return m_operationModelContext.GetOperationName(); + } + + GreengrassCoreIpcServiceModel::GreengrassCoreIpcServiceModel() noexcept + : m_subscribeToIoTCoreOperationContext(*this), m_publishToIoTCoreOperationContext(*this), + m_subscribeToConfigurationUpdateOperationContext(*this), m_deleteThingShadowOperationContext(*this), + m_deferComponentUpdateOperationContext(*this), + m_subscribeToValidateConfigurationUpdatesOperationContext(*this), + m_getConfigurationOperationContext(*this), m_subscribeToTopicOperationContext(*this), + m_getComponentDetailsOperationContext(*this), m_publishToTopicOperationContext(*this), + m_listComponentsOperationContext(*this), m_createDebugPasswordOperationContext(*this), + m_getThingShadowOperationContext(*this), m_sendConfigurationValidityReportOperationContext(*this), + m_updateThingShadowOperationContext(*this), m_updateConfigurationOperationContext(*this), + m_validateAuthorizationTokenOperationContext(*this), m_restartComponentOperationContext(*this), + m_getLocalDeploymentStatusOperationContext(*this), m_getSecretValueOperationContext(*this), + m_updateStateOperationContext(*this), m_listNamedShadowsForThingOperationContext(*this), + m_subscribeToComponentUpdatesOperationContext(*this), m_listLocalDeploymentsOperationContext(*this), + m_stopComponentOperationContext(*this), m_createLocalDeploymentOperationContext(*this) + { + } + + Aws::Crt::ScopedResource GreengrassCoreIpcServiceModel::AllocateOperationErrorFromPayload( + const Aws::Crt::String &errorModelName, + Aws::Crt::StringView stringView, + Aws::Crt::Allocator *allocator) const noexcept + { + auto it = m_modelNameToErrorResponse.find(errorModelName); + if (it == m_modelNameToErrorResponse.end()) + { + return nullptr; + } + else + { + return it->second(stringView, allocator); + } + } + + void GreengrassCoreIpcServiceModel::AssignModelNameToErrorResponse( + Aws::Crt::String modelName, + ErrorResponseFactory factory) noexcept + { + m_modelNameToErrorResponse[modelName] = factory; + } + } // namespace Greengrass +} // namespace Aws From bc05eca55f3743ae0cdbf752a777a32af11664f4 Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Thu, 1 Jul 2021 13:08:29 -0700 Subject: [PATCH 10/17] Use conditional variable to prevent closing prematurely --- .../aws/eventstreamrpc/EventStreamClient.h | 6 +-- eventstream_rpc/source/EventStreamClient.cpp | 31 ++++++--------- .../tests/EventStreamClientTest.cpp | 39 ++++++++++++------- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h index 2821fe97c..b8765706b 100644 --- a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h +++ b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h @@ -551,11 +551,9 @@ namespace Aws std::mutex m_continuationMutex; bool m_resultReceived; std::promise m_initialResponsePromise; - CloseState m_closeState; - std::atomic_int m_numCloses; + std::atomic_int m_expectedCloses; std::atomic_bool m_streamClosedCalled; - std::promise m_closedPromise; - std::condition_variable m_promiseReady; + std::condition_variable m_closeReady; }; class AWS_EVENTSTREAMRPC_API ClientConnection final diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index 9d0b33d8f..3cf5991da 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -1068,7 +1068,7 @@ namespace Aws Crt::Allocator *allocator) noexcept : m_operationModelContext(operationModelContext), m_messageCount(0), m_allocator(allocator), m_streamHandler(streamHandler), m_clientContinuation(connection.NewStream(*this)), - m_closeState(WONT_CLOSE), m_numCloses(0), m_streamClosedCalled(false) + m_expectedCloses(0), m_streamClosedCalled(false) { } @@ -1083,10 +1083,8 @@ namespace Aws ClientOperation::~ClientOperation() noexcept { Close().wait(); - if (m_numCloses.load() > 0) - { - m_closedPromise.get_future().wait(); - } + std::unique_lock lock(m_continuationMutex); + m_closeReady.wait(lock, [this]{return m_expectedCloses.load() == 0;}); } TaggedResult::TaggedResult(Crt::ScopedResource operationResponse) noexcept @@ -1326,8 +1324,7 @@ namespace Aws if (messageFlags & AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_TERMINATE_STREAM) { const std::lock_guard lock(m_continuationMutex); - m_closeState = WILL_CLOSE; - m_numCloses.fetch_add(1); + m_expectedCloses.fetch_add(1); } m_messageCount += 1; @@ -1434,12 +1431,10 @@ namespace Aws /* Promises must be reset in case the client would like to send a subsequent request with the same * `ClientOperation`. */ m_initialResponsePromise = {}; - m_closedPromise = {}; + //m_closedPromise = {}; { const std::lock_guard lock(m_continuationMutex); m_resultReceived = false; - if (m_closeState != WILL_CLOSE) - m_closeState = WONT_CLOSE; } Crt::List headers; @@ -1461,29 +1456,29 @@ namespace Aws void ClientOperation::OnContinuationClosed() { - std::unique_lock lock(m_continuationMutex); + const std::lock_guard lock(m_continuationMutex); if (!m_resultReceived) { m_initialResponsePromise.set_value(TaggedResult({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0})); m_resultReceived = true; } - m_numCloses.fetch_sub(1); - if (m_numCloses.load() == 0 && m_closeState != ALREADY_CLOSED) + if (m_expectedCloses.load() > 0) { - m_closedPromise.set_value(); - m_closeState = ALREADY_CLOSED; + m_expectedCloses.fetch_sub(1); if (!m_streamClosedCalled.load() && m_streamHandler) { m_streamHandler->OnStreamClosed(); m_streamClosedCalled.store(true); } + m_closeReady.notify_one(); } } std::future ClientOperation::Close(OnMessageFlushCallback onMessageFlushCallback) noexcept { - if (m_numCloses.load() > 0 || m_clientContinuation.IsClosed()) + const std::lock_guard lock(m_continuationMutex); + if (m_expectedCloses.load() > 0 || m_clientContinuation.IsClosed()) { std::promise errorPromise; errorPromise.set_value({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0}); @@ -1530,9 +1525,7 @@ namespace Aws } else { - const std::lock_guard lock(m_continuationMutex); - m_closeState = WILL_CLOSE; - m_numCloses.fetch_add(1); + m_expectedCloses.fetch_add(1); return callbackContainer->onFlushPromise.get_future(); } diff --git a/eventstream_rpc/tests/EventStreamClientTest.cpp b/eventstream_rpc/tests/EventStreamClientTest.cpp index a7bf41aa6..0f2e1b002 100644 --- a/eventstream_rpc/tests/EventStreamClientTest.cpp +++ b/eventstream_rpc/tests/EventStreamClientTest.cpp @@ -380,10 +380,9 @@ class ThreadPool ThreadPool(int numThreads = std::thread::hardware_concurrency()) noexcept : m_numThreads(numThreads), m_stopped(false) { - m_terminatePool = false; for (int i = 0; i < numThreads; i++) { - m_threadPool.push_back(std::thread(&ThreadPool::TaskConsumer, this)); + m_threadPool.push_back(std::thread(&ThreadPool::TaskWorker, this)); } m_taskErrorCode = AWS_OP_SUCCESS; } @@ -399,11 +398,6 @@ class ThreadPool void Shutdown() noexcept { - { - std::unique_lock lock(m_poolMutex); - m_terminatePool = true; - } - /* Wake up all threads so that they can complete. */ m_taskReady.notify_all(); @@ -425,7 +419,14 @@ class ThreadPool { if (m_queue.empty()) { + m_stopped = true; m_queueMutex.unlock(); + /* Wait for all threads to complete. */ + m_taskReady.notify_all(); + for (std::thread &thread : m_threadPool) + { + thread.join(); + } break; } else @@ -452,30 +453,30 @@ class ThreadPool std::mutex m_queueMutex; std::queue> m_queue; std::condition_variable m_taskReady; - bool m_terminatePool; int m_taskErrorCode; bool m_stopped; - void TaskConsumer() + void TaskWorker() { while (true) { { std::unique_lock lock(m_queueMutex); - m_taskReady.wait(lock, [this] { return !m_queue.empty() || m_terminatePool; }); + m_taskReady.wait(lock, [this] { return !m_queue.empty() || m_stopped; }); if (!m_queue.empty()) { std::function currentJob = m_queue.front(); + m_queue.pop(); + lock.unlock(); if (currentJob) { int errorCode = currentJob(); if (errorCode) m_taskErrorCode = errorCode; } - m_queue.pop(); } - if (m_terminatePool) + else if (m_stopped) { break; } @@ -504,7 +505,17 @@ static int s_TestStressClient(struct aws_allocator *allocator, void *ctx) messageData.SetStringMessage(expectedMessage); echoMessageRequest.SetMessage(messageData); auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); - requestFuture.wait(); + std::future_status status = requestFuture.wait_for(std::chrono::seconds(1)); + if (status != std::future_status::ready) + { + return AWS_OP_SUCCESS; + } + auto resultFuture = echoMessage.GetResult(); + status = resultFuture.wait_for(std::chrono::seconds(1)); + if (status != std::future_status::ready) + { + return AWS_OP_SUCCESS; + } auto result = echoMessage.GetResult().get(); ASSERT_TRUE(result); auto response = result.GetOperationResponse(); @@ -514,7 +525,7 @@ static int s_TestStressClient(struct aws_allocator *allocator, void *ctx) return AWS_OP_SUCCESS; }; - for (int i = 0; i < 100; i++) + for (int i = 0; i < 10000; i++) threadPool.AddTask(invokeOperation); threadPool.BlockUntilTasksFinish(); From 76b8ac31ad8d7ddd84ca61858202217058cefeef Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Thu, 1 Jul 2021 18:56:47 -0700 Subject: [PATCH 11/17] Update the interface for OnStreamError to support the base error type and decouple RpcError --- eventstream_rpc/source/EventStreamClient.cpp | 10 +- eventstream_rpc/tests/EchoTestRpcModel.cpp | 27 +- .../tests/EventStreamClientTest.cpp | 13 +- .../tests/include/awstest/EchoTestRpcClient.h | 7 + .../tests/include/awstest/EchoTestRpcModel.h | 141 ++++- .../aws/greengrass/GreengrassCoreIpcClient.h | 7 + .../aws/greengrass/GreengrassCoreIpcModel.h | 589 ++++++++++++++---- .../source/GreengrassCoreIpcModel.cpp | 115 ++-- 8 files changed, 700 insertions(+), 209 deletions(-) diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index 3cf5991da..df96332a2 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -839,9 +839,8 @@ namespace Aws { if (m_callbackData) { - m_callbackData->callbackMutex.lock(); + const std::lock_guard lock(m_callbackData->callbackMutex); m_callbackData->continuationDestroyed = true; - m_callbackData->callbackMutex.unlock(); } } @@ -1067,8 +1066,8 @@ namespace Aws const OperationModelContext &operationModelContext, Crt::Allocator *allocator) noexcept : m_operationModelContext(operationModelContext), m_messageCount(0), m_allocator(allocator), - m_streamHandler(streamHandler), m_clientContinuation(connection.NewStream(*this)), - m_expectedCloses(0), m_streamClosedCalled(false) + m_streamHandler(streamHandler), m_clientContinuation(connection.NewStream(*this)), m_expectedCloses(0), + m_streamClosedCalled(false) { } @@ -1084,7 +1083,7 @@ namespace Aws { Close().wait(); std::unique_lock lock(m_continuationMutex); - m_closeReady.wait(lock, [this]{return m_expectedCloses.load() == 0;}); + m_closeReady.wait(lock, [this] { return m_expectedCloses.load() == 0; }); } TaggedResult::TaggedResult(Crt::ScopedResource operationResponse) noexcept @@ -1431,7 +1430,6 @@ namespace Aws /* Promises must be reset in case the client would like to send a subsequent request with the same * `ClientOperation`. */ m_initialResponsePromise = {}; - //m_closedPromise = {}; { const std::lock_guard lock(m_continuationMutex); m_resultReceived = false; diff --git a/eventstream_rpc/tests/EchoTestRpcModel.cpp b/eventstream_rpc/tests/EchoTestRpcModel.cpp index 0ba00cdf7..1a52ca32e 100644 --- a/eventstream_rpc/tests/EchoTestRpcModel.cpp +++ b/eventstream_rpc/tests/EchoTestRpcModel.cpp @@ -1065,13 +1065,19 @@ namespace Awstest Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - if (operationError->GetModelName() == Aws::Crt::String("awstest#ServiceError")) + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(rpcError); } - return true; + if (operationError != nullptr && operationError->GetModelName() == Aws::Crt::String("awstest#ServiceError") && + !streamShouldTerminate) + { + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); + } + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } CauseStreamServiceToErrorOperationContext::CauseStreamServiceToErrorOperationContext( @@ -1151,9 +1157,14 @@ namespace Awstest Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - return true; + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + { + streamShouldTerminate = OnStreamError(rpcError); + } + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } EchoStreamMessagesOperationContext::EchoStreamMessagesOperationContext( diff --git a/eventstream_rpc/tests/EventStreamClientTest.cpp b/eventstream_rpc/tests/EventStreamClientTest.cpp index 0f2e1b002..3222f8afe 100644 --- a/eventstream_rpc/tests/EventStreamClientTest.cpp +++ b/eventstream_rpc/tests/EventStreamClientTest.cpp @@ -504,14 +504,11 @@ static int s_TestStressClient(struct aws_allocator *allocator, void *ctx) auto echoMessage = client.NewEchoMessage(); messageData.SetStringMessage(expectedMessage); echoMessageRequest.SetMessage(messageData); - auto requestFuture = echoMessage.Activate(echoMessageRequest, s_onMessageFlush); - std::future_status status = requestFuture.wait_for(std::chrono::seconds(1)); - if (status != std::future_status::ready) - { - return AWS_OP_SUCCESS; - } + auto requestStatus = echoMessage.Activate(echoMessageRequest, s_onMessageFlush).get(); auto resultFuture = echoMessage.GetResult(); - status = resultFuture.wait_for(std::chrono::seconds(1)); + /* The response may never arrive depending on how many ongoing requests are made + * so in case of timeout, assume success. */ + std::future_status status = resultFuture.wait_for(std::chrono::seconds(5)); if (status != std::future_status::ready) { return AWS_OP_SUCCESS; @@ -525,7 +522,7 @@ static int s_TestStressClient(struct aws_allocator *allocator, void *ctx) return AWS_OP_SUCCESS; }; - for (int i = 0; i < 10000; i++) + for (int i = 0; i < 1000; i++) threadPool.AddTask(invokeOperation); threadPool.BlockUntilTasksFinish(); diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h index 188823567..4bfa0006c 100644 --- a/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h @@ -24,6 +24,13 @@ namespace Awstest EchoTestRpcClient( Aws::Crt::Io::ClientBootstrap &clientBootstrap, Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Connect the client to the server + * @param lifecycleHandler An interface that is called upon when lifecycle events relating to the connection + * occur. + * @param connectionConfig The configuration parameters used for establishing the connection. + * @return An `RpcError` that can be used to check whether the connection was established. + */ std::future Connect( ConnectionLifecycleHandler &lifecycleHandler, const ConnectionConfig &connectionConfig = DefaultConnectionConfig()) noexcept; diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h index e97003756..76c0c2bcd 100644 --- a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h @@ -475,10 +475,10 @@ namespace Awstest GetAllProductsOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -513,10 +513,19 @@ namespace Awstest GetAllProductsOperation( ClientConnection &connection, const GetAllProductsOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetAllProductsOperation` + * @param request The request used for the `GetAllProductsOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetAllProductsRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -529,10 +538,10 @@ namespace Awstest CauseServiceErrorOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -567,10 +576,19 @@ namespace Awstest CauseServiceErrorOperation( ClientConnection &connection, const CauseServiceErrorOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `CauseServiceErrorOperation` + * @param request The request used for the `CauseServiceErrorOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const CauseServiceErrorRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -581,16 +599,34 @@ namespace Awstest { public: virtual void OnStreamEvent(EchoStreamingMessage *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } - virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ServiceError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ServiceError *operationError) + { + (void)operationError; + return true; + } + + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) { (void)operationError; - (void)rpcError; return true; } @@ -612,10 +648,10 @@ namespace Awstest CauseStreamServiceToErrorOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -653,10 +689,19 @@ namespace Awstest ClientConnection &connection, CauseStreamServiceToErrorStreamHandler *streamHandler, const CauseStreamServiceToErrorOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `CauseStreamServiceToErrorOperation` + * @param request The request used for the `CauseStreamServiceToErrorOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const EchoStreamingRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -667,12 +712,27 @@ namespace Awstest { public: virtual void OnStreamEvent(EchoStreamingMessage *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) + { + (void)operationError; + return true; + } + private: /** * Invoked when a message is received on this continuation. @@ -691,10 +751,10 @@ namespace Awstest EchoStreamMessagesOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -730,10 +790,19 @@ namespace Awstest ClientConnection &connection, EchoStreamMessagesStreamHandler *streamHandler, const EchoStreamMessagesOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `EchoStreamMessagesOperation` + * @param request The request used for the `EchoStreamMessagesOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const EchoStreamingRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -746,10 +815,10 @@ namespace Awstest EchoMessageOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -784,10 +853,19 @@ namespace Awstest EchoMessageOperation( ClientConnection &connection, const EchoMessageOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `EchoMessageOperation` + * @param request The request used for the `EchoMessageOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const EchoMessageRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -800,10 +878,10 @@ namespace Awstest GetAllCustomersOperationContext(const EchoTestRpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -838,10 +916,19 @@ namespace Awstest GetAllCustomersOperation( ClientConnection &connection, const GetAllCustomersOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetAllCustomersOperation` + * @param request The request used for the `GetAllCustomersOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetAllCustomersRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -855,7 +942,7 @@ namespace Awstest Aws::Crt::ScopedResource AllocateOperationErrorFromPayload( const Aws::Crt::String &errorModelName, Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; void AssignModelNameToErrorResponse(Aws::Crt::String, ErrorResponseFactory) noexcept; private: diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h index 36a9cab9d..13b7272d6 100644 --- a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h @@ -26,6 +26,13 @@ namespace Aws GreengrassCoreIpcClient( Aws::Crt::Io::ClientBootstrap &clientBootstrap, Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Connect the client to the server + * @param lifecycleHandler An interface that is called upon when lifecycle events relating to the connection + * occur. + * @param connectionConfig The configuration parameters used for establishing the connection. + * @return An `RpcError` that can be used to check whether the connection was established. + */ std::future Connect( ConnectionLifecycleHandler &lifecycleHandler, const ConnectionConfig &connectionConfig = DefaultConnectionConfig()) noexcept; diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h index f6f57a991..27b596fdf 100644 --- a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h @@ -2308,23 +2308,44 @@ namespace Aws { public: virtual void OnStreamEvent(IoTCoreMessage *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } - virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ServiceError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ServiceError *operationError) { (void)operationError; - (void)rpcError; return true; } - virtual bool OnStreamError(UnauthorizedError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `UnauthorizedError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(UnauthorizedError *operationError) + { + (void)operationError; + return true; + } + + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) { (void)operationError; - (void)rpcError; return true; } @@ -2346,10 +2367,10 @@ namespace Aws SubscribeToIoTCoreOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2385,10 +2406,19 @@ namespace Aws ClientConnection &connection, SubscribeToIoTCoreStreamHandler *streamHandler, const SubscribeToIoTCoreOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `SubscribeToIoTCoreOperation` + * @param request The request used for the `SubscribeToIoTCoreOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const SubscribeToIoTCoreRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2401,10 +2431,10 @@ namespace Aws PublishToIoTCoreOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2439,10 +2469,19 @@ namespace Aws PublishToIoTCoreOperation( ClientConnection &connection, const PublishToIoTCoreOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `PublishToIoTCoreOperation` + * @param request The request used for the `PublishToIoTCoreOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const PublishToIoTCoreRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2453,23 +2492,44 @@ namespace Aws { public: virtual void OnStreamEvent(ConfigurationUpdateEvents *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } - virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ServiceError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ServiceError *operationError) { (void)operationError; - (void)rpcError; return true; } - virtual bool OnStreamError(ResourceNotFoundError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ResourceNotFoundError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ResourceNotFoundError *operationError) + { + (void)operationError; + return true; + } + + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) { (void)operationError; - (void)rpcError; return true; } @@ -2491,10 +2551,10 @@ namespace Aws SubscribeToConfigurationUpdateOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2533,10 +2593,19 @@ namespace Aws ClientConnection &connection, SubscribeToConfigurationUpdateStreamHandler *streamHandler, const SubscribeToConfigurationUpdateOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `SubscribeToConfigurationUpdateOperation` + * @param request The request used for the `SubscribeToConfigurationUpdateOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const SubscribeToConfigurationUpdateRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2549,10 +2618,10 @@ namespace Aws DeleteThingShadowOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2587,10 +2656,19 @@ namespace Aws DeleteThingShadowOperation( ClientConnection &connection, const DeleteThingShadowOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `DeleteThingShadowOperation` + * @param request The request used for the `DeleteThingShadowOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const DeleteThingShadowRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2603,10 +2681,10 @@ namespace Aws DeferComponentUpdateOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2643,10 +2721,19 @@ namespace Aws DeferComponentUpdateOperation( ClientConnection &connection, const DeferComponentUpdateOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `DeferComponentUpdateOperation` + * @param request The request used for the `DeferComponentUpdateOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const DeferComponentUpdateRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2657,16 +2744,34 @@ namespace Aws { public: virtual void OnStreamEvent(ValidateConfigurationUpdateEvents *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } - virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ServiceError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ServiceError *operationError) + { + (void)operationError; + return true; + } + + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) { (void)operationError; - (void)rpcError; return true; } @@ -2689,10 +2794,10 @@ namespace Aws const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2732,10 +2837,19 @@ namespace Aws ClientConnection &connection, SubscribeToValidateConfigurationUpdatesStreamHandler *streamHandler, const SubscribeToValidateConfigurationUpdatesOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `SubscribeToValidateConfigurationUpdatesOperation` + * @param request The request used for the `SubscribeToValidateConfigurationUpdatesOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const SubscribeToValidateConfigurationUpdatesRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2748,10 +2862,10 @@ namespace Aws GetConfigurationOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2786,10 +2900,19 @@ namespace Aws GetConfigurationOperation( ClientConnection &connection, const GetConfigurationOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetConfigurationOperation` + * @param request The request used for the `GetConfigurationOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetConfigurationRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2800,30 +2923,54 @@ namespace Aws { public: virtual void OnStreamEvent(SubscriptionResponseMessage *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } - virtual bool OnStreamError(InvalidArgumentsError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `InvalidArgumentsError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(InvalidArgumentsError *operationError) { (void)operationError; - (void)rpcError; return true; } - virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ServiceError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ServiceError *operationError) { (void)operationError; - (void)rpcError; return true; } - virtual bool OnStreamError(UnauthorizedError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `UnauthorizedError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(UnauthorizedError *operationError) + { + (void)operationError; + return true; + } + + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) { (void)operationError; - (void)rpcError; return true; } @@ -2845,10 +2992,10 @@ namespace Aws SubscribeToTopicOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2884,10 +3031,19 @@ namespace Aws ClientConnection &connection, SubscribeToTopicStreamHandler *streamHandler, const SubscribeToTopicOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `SubscribeToTopicOperation` + * @param request The request used for the `SubscribeToTopicOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const SubscribeToTopicRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2900,10 +3056,10 @@ namespace Aws GetComponentDetailsOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2938,10 +3094,19 @@ namespace Aws GetComponentDetailsOperation( ClientConnection &connection, const GetComponentDetailsOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetComponentDetailsOperation` + * @param request The request used for the `GetComponentDetailsOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetComponentDetailsRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -2954,10 +3119,10 @@ namespace Aws PublishToTopicOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -2992,10 +3157,19 @@ namespace Aws PublishToTopicOperation( ClientConnection &connection, const PublishToTopicOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `PublishToTopicOperation` + * @param request The request used for the `PublishToTopicOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const PublishToTopicRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3008,10 +3182,10 @@ namespace Aws ListComponentsOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3046,10 +3220,19 @@ namespace Aws ListComponentsOperation( ClientConnection &connection, const ListComponentsOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `ListComponentsOperation` + * @param request The request used for the `ListComponentsOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const ListComponentsRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3062,10 +3245,10 @@ namespace Aws CreateDebugPasswordOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3100,10 +3283,19 @@ namespace Aws CreateDebugPasswordOperation( ClientConnection &connection, const CreateDebugPasswordOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `CreateDebugPasswordOperation` + * @param request The request used for the `CreateDebugPasswordOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const CreateDebugPasswordRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3116,10 +3308,10 @@ namespace Aws GetThingShadowOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3154,10 +3346,19 @@ namespace Aws GetThingShadowOperation( ClientConnection &connection, const GetThingShadowOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetThingShadowOperation` + * @param request The request used for the `GetThingShadowOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetThingShadowRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3170,10 +3371,10 @@ namespace Aws SendConfigurationValidityReportOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3211,10 +3412,19 @@ namespace Aws SendConfigurationValidityReportOperation( ClientConnection &connection, const SendConfigurationValidityReportOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `SendConfigurationValidityReportOperation` + * @param request The request used for the `SendConfigurationValidityReportOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const SendConfigurationValidityReportRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3227,10 +3437,10 @@ namespace Aws UpdateThingShadowOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3265,10 +3475,19 @@ namespace Aws UpdateThingShadowOperation( ClientConnection &connection, const UpdateThingShadowOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `UpdateThingShadowOperation` + * @param request The request used for the `UpdateThingShadowOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const UpdateThingShadowRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3281,10 +3500,10 @@ namespace Aws UpdateConfigurationOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3319,10 +3538,19 @@ namespace Aws UpdateConfigurationOperation( ClientConnection &connection, const UpdateConfigurationOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `UpdateConfigurationOperation` + * @param request The request used for the `UpdateConfigurationOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const UpdateConfigurationRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3335,10 +3563,10 @@ namespace Aws ValidateAuthorizationTokenOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3376,10 +3604,19 @@ namespace Aws ValidateAuthorizationTokenOperation( ClientConnection &connection, const ValidateAuthorizationTokenOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `ValidateAuthorizationTokenOperation` + * @param request The request used for the `ValidateAuthorizationTokenOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const ValidateAuthorizationTokenRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3392,10 +3629,10 @@ namespace Aws RestartComponentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3430,10 +3667,19 @@ namespace Aws RestartComponentOperation( ClientConnection &connection, const RestartComponentOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `RestartComponentOperation` + * @param request The request used for the `RestartComponentOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const RestartComponentRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3446,10 +3692,10 @@ namespace Aws GetLocalDeploymentStatusOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3487,10 +3733,19 @@ namespace Aws GetLocalDeploymentStatusOperation( ClientConnection &connection, const GetLocalDeploymentStatusOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetLocalDeploymentStatusOperation` + * @param request The request used for the `GetLocalDeploymentStatusOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetLocalDeploymentStatusRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3503,10 +3758,10 @@ namespace Aws GetSecretValueOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3541,10 +3796,19 @@ namespace Aws GetSecretValueOperation( ClientConnection &connection, const GetSecretValueOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `GetSecretValueOperation` + * @param request The request used for the `GetSecretValueOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const GetSecretValueRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3557,10 +3821,10 @@ namespace Aws UpdateStateOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3595,10 +3859,19 @@ namespace Aws UpdateStateOperation( ClientConnection &connection, const UpdateStateOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `UpdateStateOperation` + * @param request The request used for the `UpdateStateOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const UpdateStateRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3611,10 +3884,10 @@ namespace Aws ListNamedShadowsForThingOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3652,10 +3925,19 @@ namespace Aws ListNamedShadowsForThingOperation( ClientConnection &connection, const ListNamedShadowsForThingOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `ListNamedShadowsForThingOperation` + * @param request The request used for the `ListNamedShadowsForThingOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const ListNamedShadowsForThingRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3666,23 +3948,44 @@ namespace Aws { public: virtual void OnStreamEvent(ComponentUpdatePolicyEvents *response) { (void)response; } + + /** + * A callback that is invoked when an error occurs while parsing a message from the stream. + * @param rpcError The RPC error containing the status and possibly a CRT error. + */ virtual bool OnStreamError(RpcError rpcError) { (void)rpcError; return true; } - virtual bool OnStreamError(ServiceError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ServiceError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ServiceError *operationError) { (void)operationError; - (void)rpcError; return true; } - virtual bool OnStreamError(ResourceNotFoundError *operationError, RpcError rpcError) + /** + * A callback that is invoked upon receiving an error of type `ResourceNotFoundError`. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(ResourceNotFoundError *operationError) + { + (void)operationError; + return true; + } + + /** + * A callback that is invoked upon receiving an error response from the server. + * @param operationError The error message being received. + */ + virtual bool OnStreamError(OperationError *operationError) { (void)operationError; - (void)rpcError; return true; } @@ -3704,10 +4007,10 @@ namespace Aws SubscribeToComponentUpdatesOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3746,10 +4049,19 @@ namespace Aws ClientConnection &connection, SubscribeToComponentUpdatesStreamHandler *streamHandler, const SubscribeToComponentUpdatesOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `SubscribeToComponentUpdatesOperation` + * @param request The request used for the `SubscribeToComponentUpdatesOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const SubscribeToComponentUpdatesRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3762,10 +4074,10 @@ namespace Aws ListLocalDeploymentsOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3802,10 +4114,19 @@ namespace Aws ListLocalDeploymentsOperation( ClientConnection &connection, const ListLocalDeploymentsOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `ListLocalDeploymentsOperation` + * @param request The request used for the `ListLocalDeploymentsOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const ListLocalDeploymentsRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3818,10 +4139,10 @@ namespace Aws StopComponentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3856,10 +4177,19 @@ namespace Aws StopComponentOperation( ClientConnection &connection, const StopComponentOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `StopComponentOperation` + * @param request The request used for the `StopComponentOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const StopComponentRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3872,10 +4202,10 @@ namespace Aws CreateLocalDeploymentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept; Aws::Crt::ScopedResource AllocateInitialResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::ScopedResource AllocateStreamingResponseFromPayload( Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; Aws::Crt::String GetRequestModelName() const noexcept override; Aws::Crt::String GetInitialResponseModelName() const noexcept override; Aws::Crt::Optional GetStreamingResponseModelName() const noexcept override; @@ -3912,10 +4242,19 @@ namespace Aws CreateLocalDeploymentOperation( ClientConnection &connection, const CreateLocalDeploymentOperationContext &operationContext, - Aws::Crt::Allocator *allocator) noexcept; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept; + /** + * Used to activate a stream for the `CreateLocalDeploymentOperation` + * @param request The request used for the `CreateLocalDeploymentOperation` + * @param onMessageFlushCallback An optional callback that is invoked when the request is flushed. + * @return An `RpcError` that can be used to check whether the stream was activated. + */ std::future Activate( const CreateLocalDeploymentRequest &request, - OnMessageFlushCallback onMessageFlushCallback) noexcept; + OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept; + /** + * Retrieve the result from activating the stream. + */ std::future GetResult() noexcept; protected: @@ -3929,7 +4268,7 @@ namespace Aws Aws::Crt::ScopedResource AllocateOperationErrorFromPayload( const Aws::Crt::String &errorModelName, Aws::Crt::StringView stringView, - Aws::Crt::Allocator *allocator) const noexcept override; + Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override; void AssignModelNameToErrorResponse(Aws::Crt::String, ErrorResponseFactory) noexcept; private: diff --git a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp index 3407baba6..950bfa262 100644 --- a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp +++ b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp @@ -4681,17 +4681,26 @@ namespace Aws Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(rpcError); } - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#UnauthorizedError")) + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - return true; + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#UnauthorizedError") && + !streamShouldTerminate) + { + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); + } + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } SubscribeToIoTCoreOperationContext::SubscribeToIoTCoreOperationContext( @@ -4841,17 +4850,26 @@ namespace Aws Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(rpcError); } - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ResourceNotFoundError")) + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - return true; + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ResourceNotFoundError") && + !streamShouldTerminate) + { + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); + } + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } SubscribeToConfigurationUpdateOperationContext::SubscribeToConfigurationUpdateOperationContext( @@ -5071,13 +5089,20 @@ namespace Aws Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + { + streamShouldTerminate = OnStreamError(rpcError); + } + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - return true; + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } SubscribeToValidateConfigurationUpdatesOperationContext:: @@ -5230,21 +5255,32 @@ namespace Aws Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#InvalidArgumentsError")) + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + { + streamShouldTerminate = OnStreamError(rpcError); + } + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#InvalidArgumentsError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#UnauthorizedError")) + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#UnauthorizedError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - return true; + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } SubscribeToTopicOperationContext::SubscribeToTopicOperationContext( @@ -6293,17 +6329,26 @@ namespace Aws Aws::Crt::ScopedResource operationError, RpcError rpcError) { - if (operationError == nullptr) - return OnStreamError(rpcError); - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError")) + bool streamShouldTerminate = false; + if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + { + streamShouldTerminate = OnStreamError(rpcError); + } + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ServiceError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - if (operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ResourceNotFoundError")) + if (operationError != nullptr && + operationError->GetModelName() == Aws::Crt::String("aws.greengrass#ResourceNotFoundError") && + !streamShouldTerminate) { - return OnStreamError(static_cast(operationError.get()), rpcError); + streamShouldTerminate = OnStreamError(static_cast(operationError.get())); } - return true; + if (operationError != nullptr && !streamShouldTerminate) + streamShouldTerminate = OnStreamError(operationError.get()); + return streamShouldTerminate; } SubscribeToComponentUpdatesOperationContext::SubscribeToComponentUpdatesOperationContext( From a8200539e06f59db3d0c423acaaab7c6fbd35871 Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Thu, 1 Jul 2021 19:24:26 -0700 Subject: [PATCH 12/17] Remove unused header files --- eventstream_rpc/source/EventStreamClient.cpp | 8 +++++++- .../tests/include/awstest/EchoTestRpcModel.h | 4 ++-- .../include/aws/greengrass/GreengrassCoreIpcModel.h | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index df96332a2..21ef74655 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -12,7 +12,6 @@ #include #include -#include constexpr auto EVENTSTREAM_VERSION_HEADER = ":version"; constexpr auto EVENTSTREAM_VERSION_STRING = "0.1.0"; @@ -1268,6 +1267,13 @@ namespace Aws m_operationModelContext.AllocateOperationErrorFromPayload(modelName, payloadStringView, m_allocator); if (error.get() == nullptr) return EVENT_STREAM_RPC_UNMAPPED_DATA; + if (error->GetMessage().has_value()) + { + AWS_LOGF_ERROR( + AWS_LS_EVENT_STREAM_RPC_CLIENT, + "An error was received from the server: %s", + error->GetMessage().value().c_str()); + } TaggedResult taggedResult(std::move(error)); if (m_messageCount == 1) { diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h index 76c0c2bcd..40f5a100a 100644 --- a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h @@ -621,7 +621,7 @@ namespace Awstest } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) @@ -724,7 +724,7 @@ namespace Awstest } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h index 27b596fdf..762555b7e 100644 --- a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h @@ -2340,7 +2340,7 @@ namespace Aws } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) @@ -2524,7 +2524,7 @@ namespace Aws } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) @@ -2766,7 +2766,7 @@ namespace Aws } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) @@ -2965,7 +2965,7 @@ namespace Aws } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) @@ -3980,7 +3980,7 @@ namespace Aws } /** - * A callback that is invoked upon receiving an error response from the server. + * A callback that is invoked upon receiving ANY error response from the server. * @param operationError The error message being received. */ virtual bool OnStreamError(OperationError *operationError) From 658975813195eaf361038ee33f74d33378ad7a1c Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Thu, 1 Jul 2021 19:35:43 -0700 Subject: [PATCH 13/17] Update RpcError stream handler callback to be invoked upon receiving an error --- eventstream_rpc/tests/EchoTestRpcModel.cpp | 4 ++-- greengrass_ipc/source/GreengrassCoreIpcModel.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eventstream_rpc/tests/EchoTestRpcModel.cpp b/eventstream_rpc/tests/EchoTestRpcModel.cpp index 1a52ca32e..e5037f108 100644 --- a/eventstream_rpc/tests/EchoTestRpcModel.cpp +++ b/eventstream_rpc/tests/EchoTestRpcModel.cpp @@ -1066,7 +1066,7 @@ namespace Awstest RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } @@ -1158,7 +1158,7 @@ namespace Awstest RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } diff --git a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp index 950bfa262..d68c83c3f 100644 --- a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp +++ b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp @@ -4682,7 +4682,7 @@ namespace Aws RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } @@ -4851,7 +4851,7 @@ namespace Aws RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } @@ -5090,7 +5090,7 @@ namespace Aws RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } @@ -5256,7 +5256,7 @@ namespace Aws RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } @@ -6330,7 +6330,7 @@ namespace Aws RpcError rpcError) { bool streamShouldTerminate = false; - if (operationError == nullptr && rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) + if (rpcError.baseStatus != EVENT_STREAM_RPC_SUCCESS) { streamShouldTerminate = OnStreamError(rpcError); } From 29878fcba48d85ca306f9dac7c97d5cab0306417 Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Fri, 2 Jul 2021 11:21:08 -0700 Subject: [PATCH 14/17] Fix possible invalid read from hostname going out of scope --- eventstream_rpc/source/EventStreamClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index 21ef74655..7092adc59 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -260,11 +260,11 @@ namespace Aws } m_onConnectRequestCallback = m_connectionConfig.GetConnectRequestCallback(); + Crt::String hostName; if (baseError == EVENT_STREAM_RPC_SUCCESS) { AWS_ZERO_STRUCT(connOptions); - Crt::String hostName; if (m_connectionConfig.GetHostName().has_value()) { hostName = m_connectionConfig.GetHostName().value(); From e41ae3de4822f55e4c33d8848f54c948fe734ecc Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Mon, 5 Jul 2021 18:57:18 -0700 Subject: [PATCH 15/17] Add Greengrass IPC sample --- .../aws/eventstreamrpc/EventStreamClient.h | 66 +-- eventstream_rpc/source/EventStreamClient.cpp | 80 ++- eventstream_rpc/tests/EchoTestRpcModel.cpp | 94 +++- .../tests/EventStreamClientTest.cpp | 4 +- .../tests/include/awstest/EchoTestRpcModel.h | 16 + .../cmake/greengrassipc-cpp-config.cmake | 1 + .../aws/greengrass/GreengrassCoreIpcModel.h | 80 +++ .../source/GreengrassCoreIpcModel.cpp | 527 +++++++++++++++--- samples/README.md | 7 +- samples/greengrass/ipc/CMakeLists.txt | 26 + samples/greengrass/ipc/main.cpp | 266 +++++++++ 11 files changed, 1019 insertions(+), 148 deletions(-) create mode 100644 samples/greengrass/ipc/CMakeLists.txt create mode 100644 samples/greengrass/ipc/main.cpp diff --git a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h index b8765706b..887bc83de 100644 --- a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h +++ b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h @@ -134,11 +134,11 @@ namespace Aws MessageAmendment(const Crt::ByteBuf &payload, Crt::Allocator *allocator = Crt::g_allocator) noexcept; void AddHeader(EventStreamHeader &&header) noexcept; void SetPayload(const Crt::Optional &payload) noexcept; - Crt::List &GetHeaders() noexcept; + Crt::List &GetHeaders() const noexcept; const Crt::Optional &GetPayload() const noexcept; private: - Crt::List m_headers; + mutable Crt::List m_headers; Crt::Optional m_payload; Crt::Allocator *m_allocator; }; @@ -198,6 +198,31 @@ namespace Aws OnMessageFlushCallback m_connectRequestCallback; }; + enum EventStreamRpcStatusCode + { + EVENT_STREAM_RPC_SUCCESS = 0, + EVENT_STREAM_RPC_NULL_PARAMETER, + EVENT_STREAM_RPC_UNINITIALIZED, + EVENT_STREAM_RPC_ALLOCATION_ERROR, + EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED, + EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED, + EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED, + EVENT_STREAM_RPC_CONNECTION_CLOSED, + EVENT_STREAM_RPC_CONTINUATION_CLOSED, + EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE, + EVENT_STREAM_RPC_UNMAPPED_DATA, + EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE, + EVENT_STREAM_RPC_CRT_ERROR + }; + + struct RpcError + { + EventStreamRpcStatusCode baseStatus; + int crtError; + operator bool() const noexcept { return baseStatus == EVENT_STREAM_RPC_SUCCESS; } + Crt::String StatusToString(); + }; + class AWS_EVENTSTREAMRPC_API ConnectionLifecycleHandler { public: @@ -208,17 +233,19 @@ namespace Aws */ virtual void OnConnectCallback(); /** - * Invoked upon connection shutdown. `errorCode` will specify - * shutdown reason. A graceful connection close will set `errorCode` to - * `AWS_ERROR_SUCCESS` or 0. + * Invoked upon connection shutdown. + * @param status The status upon disconnection. It can be treated as a bool + * with true implying a successful disconnection. */ - virtual void OnDisconnectCallback(int errorCode); + virtual void OnDisconnectCallback(RpcError status); /** * Invoked upon receiving an error. Use the return value to determine * whether or not to force the connection to close. Keep in mind that once * closed, the `ClientConnection` can no longer send messages. + * @param status The status upon disconnection. It can be treated as a bool + * with true implying a successful disconnection. */ - virtual bool OnErrorCallback(int errorCode); + virtual bool OnErrorCallback(RpcError status); /** * Invoked upon receiving a ping from the server. The `headers` and `payload` * refer to what is contained in the ping message. @@ -272,31 +299,6 @@ namespace Aws ContinuationCallbackData *m_callbackData; }; - enum EventStreamRpcStatusCode - { - EVENT_STREAM_RPC_SUCCESS = 0, - EVENT_STREAM_RPC_NULL_PARAMETER, - EVENT_STREAM_RPC_UNINITIALIZED, - EVENT_STREAM_RPC_ALLOCATION_ERROR, - EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED, - EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED, - EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED, - EVENT_STREAM_RPC_CONNECTION_CLOSED, - EVENT_STREAM_RPC_CONTINUATION_CLOSED, - EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE, - EVENT_STREAM_RPC_UNMAPPED_DATA, - EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE, - EVENT_STREAM_RPC_CRT_ERROR - }; - - struct RpcError - { - EventStreamRpcStatusCode baseStatus; - int crtError; - operator bool() const noexcept { return baseStatus == EVENT_STREAM_RPC_SUCCESS; } - Crt::String ErrorToString(); - }; - class AWS_EVENTSTREAMRPC_API ClientContinuation final { public: diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index 7092adc59..6e9fe1545 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -97,7 +97,7 @@ namespace Aws rhs.m_payload = Crt::Optional(); } - Crt::List &MessageAmendment::GetHeaders() noexcept { return m_headers; } + Crt::List &MessageAmendment::GetHeaders() const noexcept { return m_headers; } const Crt::Optional &MessageAmendment::GetPayload() const noexcept { return m_payload; } @@ -213,10 +213,10 @@ namespace Aws } } - bool ConnectionLifecycleHandler::OnErrorCallback(int errorCode) + bool ConnectionLifecycleHandler::OnErrorCallback(RpcError error) { - (void)errorCode; - /* Returning true implies that the connection will close upon receiving an error. */ + (void)error; + /* Returning true implies that the connection should close as a result of encountering this error. */ return true; } @@ -230,7 +230,43 @@ namespace Aws void ConnectionLifecycleHandler::OnConnectCallback() {} - void ConnectionLifecycleHandler::OnDisconnectCallback(int errorCode) { (void)errorCode; } + void ConnectionLifecycleHandler::OnDisconnectCallback(RpcError error) { (void)error; } + + Crt::String RpcError::StatusToString() + { + switch (baseStatus) + { + case EVENT_STREAM_RPC_SUCCESS: + return "EVENT_STREAM_RPC_SUCCESS"; + case EVENT_STREAM_RPC_NULL_PARAMETER: + return "EVENT_STREAM_RPC_NULL_PARAMETER"; + case EVENT_STREAM_RPC_UNINITIALIZED: + return "EVENT_STREAM_RPC_UNINITIALIZED"; + case EVENT_STREAM_RPC_ALLOCATION_ERROR: + return "EVENT_STREAM_RPC_ALLOCATION_ERROR"; + case EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED: + return "EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED"; + case EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED: + return "EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED"; + case EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED: + return "EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED"; + case EVENT_STREAM_RPC_CONNECTION_CLOSED: + return "EVENT_STREAM_RPC_CONNECTION_CLOSED"; + case EVENT_STREAM_RPC_CONTINUATION_CLOSED: + return "EVENT_STREAM_RPC_CONTINUATION_CLOSED"; + case EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE: + return "EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE"; + case EVENT_STREAM_RPC_UNMAPPED_DATA: + return "EVENT_STREAM_RPC_UNMAPPED_DATA"; + case EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE: + return "EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE"; + case EVENT_STREAM_RPC_CRT_ERROR: + Crt::String ret = "Failed with EVENT_STREAM_RPC_CRT_ERROR, the CRT error was "; + ret += Crt::ErrorDebugString(crtError); + return ret; + } + return "Unknown status code"; + } std::future ClientConnection::Connect( const ConnectionConfig &connectionConfig, @@ -320,7 +356,7 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while attempting to establish the connection: %s", - aws_error_debug_str(crtError)); + Crt::ErrorDebugString(crtError)); errorPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, crtError}); return errorPromise.get_future(); } @@ -393,7 +429,7 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while attempting to send a message: %s", - aws_error_debug_str(errorCode)); + Crt::ErrorDebugString(errorCode)); callbackData->onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); } else @@ -463,7 +499,7 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while queueing a message to be sent on the connection: %s", - aws_error_debug_str(errorCode)); + Crt::ErrorDebugString(errorCode)); onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); Crt::Delete(callbackContainer, connection->m_allocator); } @@ -607,12 +643,12 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while setting up the connection: %s", - aws_error_debug_str(errorCode)); + Crt::ErrorDebugString(errorCode)); thisConnection->m_connectAckedPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); aws_event_stream_rpc_client_connection_release(connection); thisConnection->m_underlyingConnection = nullptr; /* No connection to close on error, so no need to check return value of the callback. */ - (void)thisConnection->m_lifecycleHandler->OnErrorCallback(errorCode); + (void)thisConnection->m_lifecycleHandler->OnErrorCallback({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); } else if (thisConnection->m_clientState == DISCONNECTING || thisConnection->m_clientState == DISCONNECTED) { @@ -687,7 +723,14 @@ namespace Aws if (thisConnection->m_onConnectCalled) { - thisConnection->m_lifecycleHandler->OnDisconnectCallback(errorCode); + if (errorCode) + { + thisConnection->m_lifecycleHandler->OnDisconnectCallback({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); + } + else + { + thisConnection->m_lifecycleHandler->OnDisconnectCallback({EVENT_STREAM_RPC_SUCCESS, 0}); + } thisConnection->m_onConnectCalled = false; } @@ -696,7 +739,7 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while shutting down the connection: %s", - aws_error_debug_str(errorCode)); + Crt::ErrorDebugString(errorCode)); thisConnection->m_closedPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); } else @@ -770,7 +813,8 @@ namespace Aws case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_PROTOCOL_ERROR: case AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_INTERNAL_ERROR: - if (thisConnection->m_lifecycleHandler->OnErrorCallback(AWS_ERROR_EVENT_STREAM_RPC_PROTOCOL_ERROR)) + if (thisConnection->m_lifecycleHandler->OnErrorCallback( + {EVENT_STREAM_RPC_CRT_ERROR, AWS_ERROR_EVENT_STREAM_RPC_PROTOCOL_ERROR})) { thisConnection->Close(); } @@ -780,7 +824,8 @@ namespace Aws default: return; - if (thisConnection->m_lifecycleHandler->OnErrorCallback(EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE)) + if (thisConnection->m_lifecycleHandler->OnErrorCallback( + {EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE, 0})) { thisConnection->Close(); } @@ -1022,7 +1067,7 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while queueing a message to be sent on a stream: %s", - aws_error_debug_str(errorCode)); + Crt::ErrorDebugString(errorCode)); onFlushPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); Crt::Delete(callbackContainer, m_allocator); } @@ -1307,7 +1352,8 @@ namespace Aws { (void)operationError; (void)rpcError; - /* Note: Always returning true forces the stream to close when an error occurs. */ + /* Note: Always returning true implies that the stream should close + * as a result of encountering this error. */ return true; } @@ -1523,7 +1569,7 @@ namespace Aws AWS_LOGF_ERROR( AWS_LS_EVENT_STREAM_RPC_CLIENT, "A CRT error occurred while closing the stream: %s", - aws_error_debug_str(errorCode)); + Crt::ErrorDebugString(errorCode)); onTerminatePromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, errorCode}); Crt::Delete(callbackContainer, m_allocator); } diff --git a/eventstream_rpc/tests/EchoTestRpcModel.cpp b/eventstream_rpc/tests/EchoTestRpcModel.cpp index e5037f108..f3bdc26d4 100644 --- a/eventstream_rpc/tests/EchoTestRpcModel.cpp +++ b/eventstream_rpc/tests/EchoTestRpcModel.cpp @@ -27,7 +27,9 @@ namespace Awstest } } - Aws::Crt::String Product::GetModelName() const noexcept { return Aws::Crt::String("awstest#Product"); } + Aws::Crt::String Product::s_getModelName() noexcept { return Aws::Crt::String("awstest#Product"); } + + Aws::Crt::String Product::GetModelName() const noexcept { return Product::s_getModelName(); } Aws::Crt::ScopedResource Product::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -81,7 +83,9 @@ namespace Awstest } } - Aws::Crt::String Customer::GetModelName() const noexcept { return Aws::Crt::String("awstest#Customer"); } + Aws::Crt::String Customer::s_getModelName() noexcept { return Aws::Crt::String("awstest#Customer"); } + + Aws::Crt::String Customer::GetModelName() const noexcept { return Customer::s_getModelName(); } Aws::Crt::ScopedResource Customer::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -127,7 +131,9 @@ namespace Awstest } } - Aws::Crt::String Pair::GetModelName() const noexcept { return Aws::Crt::String("awstest#Pair"); } + Aws::Crt::String Pair::s_getModelName() noexcept { return Aws::Crt::String("awstest#Pair"); } + + Aws::Crt::String Pair::GetModelName() const noexcept { return Pair::s_getModelName(); } Aws::Crt::ScopedResource Pair::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -328,7 +334,9 @@ namespace Awstest return Aws::Crt::Optional(); } - Aws::Crt::String MessageData::GetModelName() const noexcept { return Aws::Crt::String("awstest#MessageData"); } + Aws::Crt::String MessageData::s_getModelName() noexcept { return Aws::Crt::String("awstest#MessageData"); } + + Aws::Crt::String MessageData::GetModelName() const noexcept { return MessageData::s_getModelName(); } Aws::Crt::ScopedResource MessageData::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -402,11 +410,16 @@ namespace Awstest return *this; } - Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept + Aws::Crt::String EchoStreamingMessage::s_getModelName() noexcept { return Aws::Crt::String("awstest#EchoStreamingMessage"); } + Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept + { + return EchoStreamingMessage::s_getModelName(); + } + Aws::Crt::ScopedResource EchoStreamingMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -460,11 +473,16 @@ namespace Awstest } } - Aws::Crt::String GetAllProductsResponse::GetModelName() const noexcept + Aws::Crt::String GetAllProductsResponse::s_getModelName() noexcept { return Aws::Crt::String("awstest#GetAllProductsResponse"); } + Aws::Crt::String GetAllProductsResponse::GetModelName() const noexcept + { + return GetAllProductsResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetAllProductsResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -499,11 +517,16 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept + Aws::Crt::String GetAllProductsRequest::s_getModelName() noexcept { return Aws::Crt::String("awstest#GetAllProductsRequest"); } + Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept + { + return GetAllProductsRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetAllProductsRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -559,11 +582,16 @@ namespace Awstest } } - Aws::Crt::String GetAllCustomersResponse::GetModelName() const noexcept + Aws::Crt::String GetAllCustomersResponse::s_getModelName() noexcept { return Aws::Crt::String("awstest#GetAllCustomersResponse"); } + Aws::Crt::String GetAllCustomersResponse::GetModelName() const noexcept + { + return GetAllCustomersResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetAllCustomersResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -598,11 +626,16 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String GetAllCustomersRequest::GetModelName() const noexcept + Aws::Crt::String GetAllCustomersRequest::s_getModelName() noexcept { return Aws::Crt::String("awstest#GetAllCustomersRequest"); } + Aws::Crt::String GetAllCustomersRequest::GetModelName() const noexcept + { + return GetAllCustomersRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetAllCustomersRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -645,11 +678,16 @@ namespace Awstest } } - Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept + Aws::Crt::String EchoMessageResponse::s_getModelName() noexcept { return Aws::Crt::String("awstest#EchoMessageResponse"); } + Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept + { + return EchoMessageResponse::s_getModelName(); + } + Aws::Crt::ScopedResource EchoMessageResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -692,11 +730,13 @@ namespace Awstest } } - Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept + Aws::Crt::String EchoMessageRequest::s_getModelName() noexcept { return Aws::Crt::String("awstest#EchoMessageRequest"); } + Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept { return EchoMessageRequest::s_getModelName(); } + Aws::Crt::ScopedResource EchoMessageRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -731,11 +771,16 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept + Aws::Crt::String EchoStreamingResponse::s_getModelName() noexcept { return Aws::Crt::String("awstest#EchoStreamingResponse"); } + Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept + { + return EchoStreamingResponse::s_getModelName(); + } + Aws::Crt::ScopedResource EchoStreamingResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -770,11 +815,16 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept + Aws::Crt::String EchoStreamingRequest::s_getModelName() noexcept { return Aws::Crt::String("awstest#EchoStreamingRequest"); } + Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept + { + return EchoStreamingRequest::s_getModelName(); + } + Aws::Crt::ScopedResource EchoStreamingRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -820,7 +870,9 @@ namespace Awstest } } - Aws::Crt::String ServiceError::GetModelName() const noexcept { return Aws::Crt::String("awstest#ServiceError"); } + Aws::Crt::String ServiceError::s_getModelName() noexcept { return Aws::Crt::String("awstest#ServiceError"); } + + Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::s_getModelName(); } Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -856,11 +908,16 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String CauseServiceErrorResponse::GetModelName() const noexcept + Aws::Crt::String CauseServiceErrorResponse::s_getModelName() noexcept { return Aws::Crt::String("awstest#CauseServiceErrorResponse"); } + Aws::Crt::String CauseServiceErrorResponse::GetModelName() const noexcept + { + return CauseServiceErrorResponse::s_getModelName(); + } + Aws::Crt::ScopedResource CauseServiceErrorResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -895,11 +952,16 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String CauseServiceErrorRequest::GetModelName() const noexcept + Aws::Crt::String CauseServiceErrorRequest::s_getModelName() noexcept { return Aws::Crt::String("awstest#CauseServiceErrorRequest"); } + Aws::Crt::String CauseServiceErrorRequest::GetModelName() const noexcept + { + return CauseServiceErrorRequest::s_getModelName(); + } + Aws::Crt::ScopedResource CauseServiceErrorRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept diff --git a/eventstream_rpc/tests/EventStreamClientTest.cpp b/eventstream_rpc/tests/EventStreamClientTest.cpp index 3222f8afe..3db0e8606 100644 --- a/eventstream_rpc/tests/EventStreamClientTest.cpp +++ b/eventstream_rpc/tests/EventStreamClientTest.cpp @@ -76,11 +76,11 @@ class TestLifecycleHandler : public ConnectionLifecycleHandler semaphore.notify_one(); } - void OnDisconnectCallback(int errorCode) override + void OnDisconnectCallback(RpcError error) override { std::lock_guard lockGuard(semaphoreLock); - lastErrorCode = errorCode; + lastErrorCode = error.baseStatus; semaphore.notify_one(); } diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h index 40f5a100a..78f46a3f8 100644 --- a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h @@ -34,6 +34,7 @@ namespace Awstest static void s_customDeleter(Product *) noexcept; /* This needs to be defined so that `Product` can be used as a key in maps. */ bool operator<(const Product &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -62,6 +63,7 @@ namespace Awstest static void s_customDeleter(Customer *) noexcept; /* This needs to be defined so that `Customer` can be used as a key in maps. */ bool operator<(const Customer &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -97,6 +99,7 @@ namespace Awstest static void s_customDeleter(Pair *) noexcept; /* This needs to be defined so that `Pair` can be used as a key in maps. */ bool operator<(const Pair &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -155,6 +158,7 @@ namespace Awstest static void s_customDeleter(MessageData *) noexcept; /* This needs to be defined so that `MessageData` can be used as a key in maps. */ bool operator<(const MessageData &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -217,6 +221,7 @@ namespace Awstest static void s_customDeleter(EchoStreamingMessage *) noexcept; /* This needs to be defined so that `EchoStreamingMessage` can be used as a key in maps. */ bool operator<(const EchoStreamingMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -246,6 +251,7 @@ namespace Awstest static void s_customDeleter(GetAllProductsResponse *) noexcept; /* This needs to be defined so that `GetAllProductsResponse` can be used as a key in maps. */ bool operator<(const GetAllProductsResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -267,6 +273,7 @@ namespace Awstest static void s_customDeleter(GetAllProductsRequest *) noexcept; /* This needs to be defined so that `GetAllProductsRequest` can be used as a key in maps. */ bool operator<(const GetAllProductsRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -289,6 +296,7 @@ namespace Awstest static void s_customDeleter(GetAllCustomersResponse *) noexcept; /* This needs to be defined so that `GetAllCustomersResponse` can be used as a key in maps. */ bool operator<(const GetAllCustomersResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -310,6 +318,7 @@ namespace Awstest static void s_customDeleter(GetAllCustomersRequest *) noexcept; /* This needs to be defined so that `GetAllCustomersRequest` can be used as a key in maps. */ bool operator<(const GetAllCustomersRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -332,6 +341,7 @@ namespace Awstest static void s_customDeleter(EchoMessageResponse *) noexcept; /* This needs to be defined so that `EchoMessageResponse` can be used as a key in maps. */ bool operator<(const EchoMessageResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -355,6 +365,7 @@ namespace Awstest static void s_customDeleter(EchoMessageRequest *) noexcept; /* This needs to be defined so that `EchoMessageRequest` can be used as a key in maps. */ bool operator<(const EchoMessageRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -376,6 +387,7 @@ namespace Awstest static void s_customDeleter(EchoStreamingResponse *) noexcept; /* This needs to be defined so that `EchoStreamingResponse` can be used as a key in maps. */ bool operator<(const EchoStreamingResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -396,6 +408,7 @@ namespace Awstest static void s_customDeleter(EchoStreamingRequest *) noexcept; /* This needs to be defined so that `EchoStreamingRequest` can be used as a key in maps. */ bool operator<(const EchoStreamingRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -420,6 +433,7 @@ namespace Awstest static void s_customDeleter(ServiceError *) noexcept; /* This needs to be defined so that `ServiceError` can be used as a key in maps. */ bool operator<(const ServiceError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -442,6 +456,7 @@ namespace Awstest static void s_customDeleter(CauseServiceErrorResponse *) noexcept; /* This needs to be defined so that `CauseServiceErrorResponse` can be used as a key in maps. */ bool operator<(const CauseServiceErrorResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -462,6 +477,7 @@ namespace Awstest static void s_customDeleter(CauseServiceErrorRequest *) noexcept; /* This needs to be defined so that `CauseServiceErrorRequest` can be used as a key in maps. */ bool operator<(const CauseServiceErrorRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; diff --git a/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake b/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake index 8e68cfbfe..764478fff 100644 --- a/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake +++ b/greengrass_ipc/cmake/greengrassipc-cpp-config.cmake @@ -1,6 +1,7 @@ include(CMakeFindDependencyMacro) find_dependency(aws-crt-cpp) +find_dependency(EventstreamRpc-cpp) if (BUILD_SHARED_LIBS) include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h index 762555b7e..8d1f0afe5 100644 --- a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h @@ -39,6 +39,7 @@ namespace Aws static void s_customDeleter(ValidateConfigurationUpdateEvent *) noexcept; /* This needs to be defined so that `ValidateConfigurationUpdateEvent` can be used as a key in maps. */ bool operator<(const ValidateConfigurationUpdateEvent &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -65,6 +66,7 @@ namespace Aws static void s_customDeleter(MQTTMessage *) noexcept; /* This needs to be defined so that `MQTTMessage` can be used as a key in maps. */ bool operator<(const MQTTMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -91,6 +93,7 @@ namespace Aws static void s_customDeleter(ConfigurationUpdateEvent *) noexcept; /* This needs to be defined so that `ConfigurationUpdateEvent` can be used as a key in maps. */ bool operator<(const ConfigurationUpdateEvent &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -115,6 +118,7 @@ namespace Aws static void s_customDeleter(PostComponentUpdateEvent *) noexcept; /* This needs to be defined so that `PostComponentUpdateEvent` can be used as a key in maps. */ bool operator<(const PostComponentUpdateEvent &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -140,6 +144,7 @@ namespace Aws static void s_customDeleter(PreComponentUpdateEvent *) noexcept; /* This needs to be defined so that `PreComponentUpdateEvent` can be used as a key in maps. */ bool operator<(const PreComponentUpdateEvent &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -170,6 +175,7 @@ namespace Aws static void s_customDeleter(BinaryMessage *) noexcept; /* This needs to be defined so that `BinaryMessage` can be used as a key in maps. */ bool operator<(const BinaryMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -193,6 +199,7 @@ namespace Aws static void s_customDeleter(JsonMessage *) noexcept; /* This needs to be defined so that `JsonMessage` can be used as a key in maps. */ bool operator<(const JsonMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -236,6 +243,7 @@ namespace Aws static void s_customDeleter(RunWithInfo *) noexcept; /* This needs to be defined so that `RunWithInfo` can be used as a key in maps. */ bool operator<(const RunWithInfo &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -284,6 +292,7 @@ namespace Aws static void s_customDeleter(ValidateConfigurationUpdateEvents *) noexcept; /* This needs to be defined so that `ValidateConfigurationUpdateEvents` can be used as a key in maps. */ bool operator<(const ValidateConfigurationUpdateEvents &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -342,6 +351,7 @@ namespace Aws static void s_customDeleter(SubscriptionResponseMessage *) noexcept; /* This needs to be defined so that `SubscriptionResponseMessage` can be used as a key in maps. */ bool operator<(const SubscriptionResponseMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -386,6 +396,7 @@ namespace Aws static void s_customDeleter(IoTCoreMessage *) noexcept; /* This needs to be defined so that `IoTCoreMessage` can be used as a key in maps. */ bool operator<(const IoTCoreMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -428,6 +439,7 @@ namespace Aws static void s_customDeleter(ConfigurationUpdateEvents *) noexcept; /* This needs to be defined so that `ConfigurationUpdateEvents` can be used as a key in maps. */ bool operator<(const ConfigurationUpdateEvents &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -486,6 +498,7 @@ namespace Aws static void s_customDeleter(ComponentUpdatePolicyEvents *) noexcept; /* This needs to be defined so that `ComponentUpdatePolicyEvents` can be used as a key in maps. */ bool operator<(const ComponentUpdatePolicyEvents &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -519,6 +532,7 @@ namespace Aws static void s_customDeleter(ConfigurationValidityReport *) noexcept; /* This needs to be defined so that `ConfigurationValidityReport` can be used as a key in maps. */ bool operator<(const ConfigurationValidityReport &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -581,6 +595,7 @@ namespace Aws static void s_customDeleter(PublishMessage *) noexcept; /* This needs to be defined so that `PublishMessage` can be used as a key in maps. */ bool operator<(const PublishMessage &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -647,6 +662,7 @@ namespace Aws static void s_customDeleter(SecretValue *) noexcept; /* This needs to be defined so that `SecretValue` can be used as a key in maps. */ bool operator<(const SecretValue &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -678,6 +694,7 @@ namespace Aws static void s_customDeleter(LocalDeployment *) noexcept; /* This needs to be defined so that `LocalDeployment` can be used as a key in maps. */ bool operator<(const LocalDeployment &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -711,6 +728,7 @@ namespace Aws static void s_customDeleter(ComponentDetails *) noexcept; /* This needs to be defined so that `ComponentDetails` can be used as a key in maps. */ bool operator<(const ComponentDetails &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -737,6 +755,7 @@ namespace Aws static void s_customDeleter(InvalidTokenError *) noexcept; /* This needs to be defined so that `InvalidTokenError` can be used as a key in maps. */ bool operator<(const InvalidTokenError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -760,6 +779,7 @@ namespace Aws static void s_customDeleter(ValidateAuthorizationTokenResponse *) noexcept; /* This needs to be defined so that `ValidateAuthorizationTokenResponse` can be used as a key in maps. */ bool operator<(const ValidateAuthorizationTokenResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -783,6 +803,7 @@ namespace Aws static void s_customDeleter(ValidateAuthorizationTokenRequest *) noexcept; /* This needs to be defined so that `ValidateAuthorizationTokenRequest` can be used as a key in maps. */ bool operator<(const ValidateAuthorizationTokenRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -806,6 +827,7 @@ namespace Aws static void s_customDeleter(UpdateThingShadowResponse *) noexcept; /* This needs to be defined so that `UpdateThingShadowResponse` can be used as a key in maps. */ bool operator<(const UpdateThingShadowResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -833,6 +855,7 @@ namespace Aws static void s_customDeleter(UpdateThingShadowRequest *) noexcept; /* This needs to be defined so that `UpdateThingShadowRequest` can be used as a key in maps. */ bool operator<(const UpdateThingShadowRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -856,6 +879,7 @@ namespace Aws static void s_customDeleter(UpdateStateResponse *) noexcept; /* This needs to be defined so that `UpdateStateResponse` can be used as a key in maps. */ bool operator<(const UpdateStateResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -878,6 +902,7 @@ namespace Aws static void s_customDeleter(UpdateStateRequest *) noexcept; /* This needs to be defined so that `UpdateStateRequest` can be used as a key in maps. */ bool operator<(const UpdateStateRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -901,6 +926,7 @@ namespace Aws static void s_customDeleter(FailedUpdateConditionCheckError *) noexcept; /* This needs to be defined so that `FailedUpdateConditionCheckError` can be used as a key in maps. */ bool operator<(const FailedUpdateConditionCheckError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -924,6 +950,7 @@ namespace Aws static void s_customDeleter(ConflictError *) noexcept; /* This needs to be defined so that `ConflictError` can be used as a key in maps. */ bool operator<(const ConflictError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -945,6 +972,7 @@ namespace Aws static void s_customDeleter(UpdateConfigurationResponse *) noexcept; /* This needs to be defined so that `UpdateConfigurationResponse` can be used as a key in maps. */ bool operator<(const UpdateConfigurationResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -971,6 +999,7 @@ namespace Aws static void s_customDeleter(UpdateConfigurationRequest *) noexcept; /* This needs to be defined so that `UpdateConfigurationRequest` can be used as a key in maps. */ bool operator<(const UpdateConfigurationRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -998,6 +1027,7 @@ namespace Aws /* This needs to be defined so that `SubscribeToValidateConfigurationUpdatesResponse` can be used as a key * in maps. */ bool operator<(const SubscribeToValidateConfigurationUpdatesResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1022,6 +1052,7 @@ namespace Aws /* This needs to be defined so that `SubscribeToValidateConfigurationUpdatesRequest` can be used as a key in * maps. */ bool operator<(const SubscribeToValidateConfigurationUpdatesRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1044,6 +1075,7 @@ namespace Aws static void s_customDeleter(SubscribeToTopicResponse *) noexcept; /* This needs to be defined so that `SubscribeToTopicResponse` can be used as a key in maps. */ bool operator<(const SubscribeToTopicResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1067,6 +1099,7 @@ namespace Aws static void s_customDeleter(SubscribeToTopicRequest *) noexcept; /* This needs to be defined so that `SubscribeToTopicRequest` can be used as a key in maps. */ bool operator<(const SubscribeToTopicRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1088,6 +1121,7 @@ namespace Aws static void s_customDeleter(SubscribeToIoTCoreResponse *) noexcept; /* This needs to be defined so that `SubscribeToIoTCoreResponse` can be used as a key in maps. */ bool operator<(const SubscribeToIoTCoreResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1112,6 +1146,7 @@ namespace Aws static void s_customDeleter(SubscribeToIoTCoreRequest *) noexcept; /* This needs to be defined so that `SubscribeToIoTCoreRequest` can be used as a key in maps. */ bool operator<(const SubscribeToIoTCoreRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1137,6 +1172,7 @@ namespace Aws /* This needs to be defined so that `SubscribeToConfigurationUpdateResponse` can be used as a key in maps. */ bool operator<(const SubscribeToConfigurationUpdateResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1163,6 +1199,7 @@ namespace Aws static void s_customDeleter(SubscribeToConfigurationUpdateRequest *) noexcept; /* This needs to be defined so that `SubscribeToConfigurationUpdateRequest` can be used as a key in maps. */ bool operator<(const SubscribeToConfigurationUpdateRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1185,6 +1222,7 @@ namespace Aws static void s_customDeleter(SubscribeToComponentUpdatesResponse *) noexcept; /* This needs to be defined so that `SubscribeToComponentUpdatesResponse` can be used as a key in maps. */ bool operator<(const SubscribeToComponentUpdatesResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1205,6 +1243,7 @@ namespace Aws static void s_customDeleter(SubscribeToComponentUpdatesRequest *) noexcept; /* This needs to be defined so that `SubscribeToComponentUpdatesRequest` can be used as a key in maps. */ bool operator<(const SubscribeToComponentUpdatesRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1229,6 +1268,7 @@ namespace Aws static void s_customDeleter(StopComponentResponse *) noexcept; /* This needs to be defined so that `StopComponentResponse` can be used as a key in maps. */ bool operator<(const StopComponentResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1253,6 +1293,7 @@ namespace Aws static void s_customDeleter(StopComponentRequest *) noexcept; /* This needs to be defined so that `StopComponentRequest` can be used as a key in maps. */ bool operator<(const StopComponentRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1277,6 +1318,7 @@ namespace Aws /* This needs to be defined so that `SendConfigurationValidityReportResponse` can be used as a key in maps. */ bool operator<(const SendConfigurationValidityReportResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1308,6 +1350,7 @@ namespace Aws /* This needs to be defined so that `SendConfigurationValidityReportRequest` can be used as a key in maps. */ bool operator<(const SendConfigurationValidityReportRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1331,6 +1374,7 @@ namespace Aws static void s_customDeleter(ComponentNotFoundError *) noexcept; /* This needs to be defined so that `ComponentNotFoundError` can be used as a key in maps. */ bool operator<(const ComponentNotFoundError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1356,6 +1400,7 @@ namespace Aws static void s_customDeleter(RestartComponentResponse *) noexcept; /* This needs to be defined so that `RestartComponentResponse` can be used as a key in maps. */ bool operator<(const RestartComponentResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1380,6 +1425,7 @@ namespace Aws static void s_customDeleter(RestartComponentRequest *) noexcept; /* This needs to be defined so that `RestartComponentRequest` can be used as a key in maps. */ bool operator<(const RestartComponentRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1401,6 +1447,7 @@ namespace Aws static void s_customDeleter(PublishToTopicResponse *) noexcept; /* This needs to be defined so that `PublishToTopicResponse` can be used as a key in maps. */ bool operator<(const PublishToTopicResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1425,6 +1472,7 @@ namespace Aws static void s_customDeleter(PublishToTopicRequest *) noexcept; /* This needs to be defined so that `PublishToTopicRequest` can be used as a key in maps. */ bool operator<(const PublishToTopicRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1447,6 +1495,7 @@ namespace Aws static void s_customDeleter(PublishToIoTCoreResponse *) noexcept; /* This needs to be defined so that `PublishToIoTCoreResponse` can be used as a key in maps. */ bool operator<(const PublishToIoTCoreResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1473,6 +1522,7 @@ namespace Aws static void s_customDeleter(PublishToIoTCoreRequest *) noexcept; /* This needs to be defined so that `PublishToIoTCoreRequest` can be used as a key in maps. */ bool operator<(const PublishToIoTCoreRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1502,6 +1552,7 @@ namespace Aws static void s_customDeleter(ListNamedShadowsForThingResponse *) noexcept; /* This needs to be defined so that `ListNamedShadowsForThingResponse` can be used as a key in maps. */ bool operator<(const ListNamedShadowsForThingResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1531,6 +1582,7 @@ namespace Aws static void s_customDeleter(ListNamedShadowsForThingRequest *) noexcept; /* This needs to be defined so that `ListNamedShadowsForThingRequest` can be used as a key in maps. */ bool operator<(const ListNamedShadowsForThingRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1562,6 +1614,7 @@ namespace Aws static void s_customDeleter(ListLocalDeploymentsResponse *) noexcept; /* This needs to be defined so that `ListLocalDeploymentsResponse` can be used as a key in maps. */ bool operator<(const ListLocalDeploymentsResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1583,6 +1636,7 @@ namespace Aws static void s_customDeleter(ListLocalDeploymentsRequest *) noexcept; /* This needs to be defined so that `ListLocalDeploymentsRequest` can be used as a key in maps. */ bool operator<(const ListLocalDeploymentsRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1608,6 +1662,7 @@ namespace Aws static void s_customDeleter(ListComponentsResponse *) noexcept; /* This needs to be defined so that `ListComponentsResponse` can be used as a key in maps. */ bool operator<(const ListComponentsResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1629,6 +1684,7 @@ namespace Aws static void s_customDeleter(ListComponentsRequest *) noexcept; /* This needs to be defined so that `ListComponentsRequest` can be used as a key in maps. */ bool operator<(const ListComponentsRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1651,6 +1707,7 @@ namespace Aws static void s_customDeleter(GetThingShadowResponse *) noexcept; /* This needs to be defined so that `GetThingShadowResponse` can be used as a key in maps. */ bool operator<(const GetThingShadowResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1676,6 +1733,7 @@ namespace Aws static void s_customDeleter(GetThingShadowRequest *) noexcept; /* This needs to be defined so that `GetThingShadowRequest` can be used as a key in maps. */ bool operator<(const GetThingShadowRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1709,6 +1767,7 @@ namespace Aws static void s_customDeleter(GetSecretValueResponse *) noexcept; /* This needs to be defined so that `GetSecretValueResponse` can be used as a key in maps. */ bool operator<(const GetSecretValueResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1739,6 +1798,7 @@ namespace Aws static void s_customDeleter(GetSecretValueRequest *) noexcept; /* This needs to be defined so that `GetSecretValueRequest` can be used as a key in maps. */ bool operator<(const GetSecretValueRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1764,6 +1824,7 @@ namespace Aws static void s_customDeleter(GetLocalDeploymentStatusResponse *) noexcept; /* This needs to be defined so that `GetLocalDeploymentStatusResponse` can be used as a key in maps. */ bool operator<(const GetLocalDeploymentStatusResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1787,6 +1848,7 @@ namespace Aws static void s_customDeleter(GetLocalDeploymentStatusRequest *) noexcept; /* This needs to be defined so that `GetLocalDeploymentStatusRequest` can be used as a key in maps. */ bool operator<(const GetLocalDeploymentStatusRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1812,6 +1874,7 @@ namespace Aws static void s_customDeleter(GetConfigurationResponse *) noexcept; /* This needs to be defined so that `GetConfigurationResponse` can be used as a key in maps. */ bool operator<(const GetConfigurationResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1838,6 +1901,7 @@ namespace Aws static void s_customDeleter(GetConfigurationRequest *) noexcept; /* This needs to be defined so that `GetConfigurationRequest` can be used as a key in maps. */ bool operator<(const GetConfigurationRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1865,6 +1929,7 @@ namespace Aws static void s_customDeleter(GetComponentDetailsResponse *) noexcept; /* This needs to be defined so that `GetComponentDetailsResponse` can be used as a key in maps. */ bool operator<(const GetComponentDetailsResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1888,6 +1953,7 @@ namespace Aws static void s_customDeleter(GetComponentDetailsRequest *) noexcept; /* This needs to be defined so that `GetComponentDetailsRequest` can be used as a key in maps. */ bool operator<(const GetComponentDetailsRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1911,6 +1977,7 @@ namespace Aws static void s_customDeleter(DeleteThingShadowResponse *) noexcept; /* This needs to be defined so that `DeleteThingShadowResponse` can be used as a key in maps. */ bool operator<(const DeleteThingShadowResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1936,6 +2003,7 @@ namespace Aws static void s_customDeleter(DeleteThingShadowRequest *) noexcept; /* This needs to be defined so that `DeleteThingShadowRequest` can be used as a key in maps. */ bool operator<(const DeleteThingShadowRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1964,6 +2032,7 @@ namespace Aws static void s_customDeleter(ResourceNotFoundError *) noexcept; /* This needs to be defined so that `ResourceNotFoundError` can be used as a key in maps. */ bool operator<(const ResourceNotFoundError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1987,6 +2056,7 @@ namespace Aws static void s_customDeleter(DeferComponentUpdateResponse *) noexcept; /* This needs to be defined so that `DeferComponentUpdateResponse` can be used as a key in maps. */ bool operator<(const DeferComponentUpdateResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2013,6 +2083,7 @@ namespace Aws static void s_customDeleter(DeferComponentUpdateRequest *) noexcept; /* This needs to be defined so that `DeferComponentUpdateRequest` can be used as a key in maps. */ bool operator<(const DeferComponentUpdateRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2038,6 +2109,7 @@ namespace Aws static void s_customDeleter(InvalidArgumentsError *) noexcept; /* This needs to be defined so that `InvalidArgumentsError` can be used as a key in maps. */ bool operator<(const InvalidArgumentsError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2061,6 +2133,7 @@ namespace Aws static void s_customDeleter(InvalidArtifactsDirectoryPathError *) noexcept; /* This needs to be defined so that `InvalidArtifactsDirectoryPathError` can be used as a key in maps. */ bool operator<(const InvalidArtifactsDirectoryPathError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2084,6 +2157,7 @@ namespace Aws static void s_customDeleter(InvalidRecipeDirectoryPathError *) noexcept; /* This needs to be defined so that `InvalidRecipeDirectoryPathError` can be used as a key in maps. */ bool operator<(const InvalidRecipeDirectoryPathError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2107,6 +2181,7 @@ namespace Aws static void s_customDeleter(CreateLocalDeploymentResponse *) noexcept; /* This needs to be defined so that `CreateLocalDeploymentResponse` can be used as a key in maps. */ bool operator<(const CreateLocalDeploymentResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2180,6 +2255,7 @@ namespace Aws static void s_customDeleter(CreateLocalDeploymentRequest *) noexcept; /* This needs to be defined so that `CreateLocalDeploymentRequest` can be used as a key in maps. */ bool operator<(const CreateLocalDeploymentRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2209,6 +2285,7 @@ namespace Aws static void s_customDeleter(ServiceError *) noexcept; /* This needs to be defined so that `ServiceError` can be used as a key in maps. */ bool operator<(const ServiceError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2232,6 +2309,7 @@ namespace Aws static void s_customDeleter(UnauthorizedError *) noexcept; /* This needs to be defined so that `UnauthorizedError` can be used as a key in maps. */ bool operator<(const UnauthorizedError &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2272,6 +2350,7 @@ namespace Aws static void s_customDeleter(CreateDebugPasswordResponse *) noexcept; /* This needs to be defined so that `CreateDebugPasswordResponse` can be used as a key in maps. */ bool operator<(const CreateDebugPasswordResponse &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2297,6 +2376,7 @@ namespace Aws static void s_customDeleter(CreateDebugPasswordRequest *) noexcept; /* This needs to be defined so that `CreateDebugPasswordRequest` can be used as a key in maps. */ bool operator<(const CreateDebugPasswordRequest &) const noexcept; + static Aws::Crt::String s_getModelName() noexcept; protected: Aws::Crt::String GetModelName() const noexcept override; diff --git a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp index d68c83c3f..6f3e3fbcc 100644 --- a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp +++ b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp @@ -33,11 +33,16 @@ namespace Aws } } - Aws::Crt::String ValidateConfigurationUpdateEvent::GetModelName() const noexcept + Aws::Crt::String ValidateConfigurationUpdateEvent::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvent"); } + Aws::Crt::String ValidateConfigurationUpdateEvent::GetModelName() const noexcept + { + return ValidateConfigurationUpdateEvent::s_getModelName(); + } + Aws::Crt::ScopedResource ValidateConfigurationUpdateEvent::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -91,11 +96,13 @@ namespace Aws } } - Aws::Crt::String MQTTMessage::GetModelName() const noexcept + Aws::Crt::String MQTTMessage::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#MQTTMessage"); } + Aws::Crt::String MQTTMessage::GetModelName() const noexcept { return MQTTMessage::s_getModelName(); } + Aws::Crt::ScopedResource MQTTMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -159,11 +166,16 @@ namespace Aws } } - Aws::Crt::String ConfigurationUpdateEvent::GetModelName() const noexcept + Aws::Crt::String ConfigurationUpdateEvent::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvent"); } + Aws::Crt::String ConfigurationUpdateEvent::GetModelName() const noexcept + { + return ConfigurationUpdateEvent::s_getModelName(); + } + Aws::Crt::ScopedResource ConfigurationUpdateEvent::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -204,11 +216,16 @@ namespace Aws } } - Aws::Crt::String PostComponentUpdateEvent::GetModelName() const noexcept + Aws::Crt::String PostComponentUpdateEvent::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PostComponentUpdateEvent"); } + Aws::Crt::String PostComponentUpdateEvent::GetModelName() const noexcept + { + return PostComponentUpdateEvent::s_getModelName(); + } + Aws::Crt::ScopedResource PostComponentUpdateEvent::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -258,11 +275,16 @@ namespace Aws } } - Aws::Crt::String PreComponentUpdateEvent::GetModelName() const noexcept + Aws::Crt::String PreComponentUpdateEvent::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PreComponentUpdateEvent"); } + Aws::Crt::String PreComponentUpdateEvent::GetModelName() const noexcept + { + return PreComponentUpdateEvent::s_getModelName(); + } + Aws::Crt::ScopedResource PreComponentUpdateEvent::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -309,11 +331,13 @@ namespace Aws } } - Aws::Crt::String BinaryMessage::GetModelName() const noexcept + Aws::Crt::String BinaryMessage::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#BinaryMessage"); } + Aws::Crt::String BinaryMessage::GetModelName() const noexcept { return BinaryMessage::s_getModelName(); } + Aws::Crt::ScopedResource BinaryMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -352,11 +376,13 @@ namespace Aws } } - Aws::Crt::String JsonMessage::GetModelName() const noexcept + Aws::Crt::String JsonMessage::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#JsonMessage"); } + Aws::Crt::String JsonMessage::GetModelName() const noexcept { return JsonMessage::s_getModelName(); } + Aws::Crt::ScopedResource JsonMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -394,11 +420,13 @@ namespace Aws } } - Aws::Crt::String RunWithInfo::GetModelName() const noexcept + Aws::Crt::String RunWithInfo::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#RunWithInfo"); } + Aws::Crt::String RunWithInfo::GetModelName() const noexcept { return RunWithInfo::s_getModelName(); } + Aws::Crt::ScopedResource RunWithInfo::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -459,11 +487,16 @@ namespace Aws return *this; } - Aws::Crt::String ValidateConfigurationUpdateEvents::GetModelName() const noexcept + Aws::Crt::String ValidateConfigurationUpdateEvents::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvents"); } + Aws::Crt::String ValidateConfigurationUpdateEvents::GetModelName() const noexcept + { + return ValidateConfigurationUpdateEvents::s_getModelName(); + } + Aws::Crt::ScopedResource ValidateConfigurationUpdateEvents::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -538,11 +571,16 @@ namespace Aws return *this; } - Aws::Crt::String SubscriptionResponseMessage::GetModelName() const noexcept + Aws::Crt::String SubscriptionResponseMessage::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscriptionResponseMessage"); } + Aws::Crt::String SubscriptionResponseMessage::GetModelName() const noexcept + { + return SubscriptionResponseMessage::s_getModelName(); + } + Aws::Crt::ScopedResource SubscriptionResponseMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -596,11 +634,13 @@ namespace Aws return *this; } - Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept + Aws::Crt::String IoTCoreMessage::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#IoTCoreMessage"); } + Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept { return IoTCoreMessage::s_getModelName(); } + Aws::Crt::ScopedResource IoTCoreMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -657,11 +697,16 @@ namespace Aws return *this; } - Aws::Crt::String ConfigurationUpdateEvents::GetModelName() const noexcept + Aws::Crt::String ConfigurationUpdateEvents::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvents"); } + Aws::Crt::String ConfigurationUpdateEvents::GetModelName() const noexcept + { + return ConfigurationUpdateEvents::s_getModelName(); + } + Aws::Crt::ScopedResource ConfigurationUpdateEvents::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -735,11 +780,16 @@ namespace Aws return *this; } - Aws::Crt::String ComponentUpdatePolicyEvents::GetModelName() const noexcept + Aws::Crt::String ComponentUpdatePolicyEvents::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ComponentUpdatePolicyEvents"); } + Aws::Crt::String ComponentUpdatePolicyEvents::GetModelName() const noexcept + { + return ComponentUpdatePolicyEvents::s_getModelName(); + } + Aws::Crt::ScopedResource ComponentUpdatePolicyEvents::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -829,11 +879,16 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String ConfigurationValidityReport::GetModelName() const noexcept + Aws::Crt::String ConfigurationValidityReport::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ConfigurationValidityReport"); } + Aws::Crt::String ConfigurationValidityReport::GetModelName() const noexcept + { + return ConfigurationValidityReport::s_getModelName(); + } + Aws::Crt::ScopedResource ConfigurationValidityReport::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -906,11 +961,13 @@ namespace Aws return *this; } - Aws::Crt::String PublishMessage::GetModelName() const noexcept + Aws::Crt::String PublishMessage::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PublishMessage"); } + Aws::Crt::String PublishMessage::GetModelName() const noexcept { return PublishMessage::s_getModelName(); } + Aws::Crt::ScopedResource PublishMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -980,11 +1037,13 @@ namespace Aws return *this; } - Aws::Crt::String SecretValue::GetModelName() const noexcept + Aws::Crt::String SecretValue::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SecretValue"); } + Aws::Crt::String SecretValue::GetModelName() const noexcept { return SecretValue::s_getModelName(); } + Aws::Crt::ScopedResource SecretValue::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1078,11 +1137,13 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String LocalDeployment::GetModelName() const noexcept + Aws::Crt::String LocalDeployment::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#LocalDeployment"); } + Aws::Crt::String LocalDeployment::GetModelName() const noexcept { return LocalDeployment::s_getModelName(); } + Aws::Crt::ScopedResource LocalDeployment::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1221,11 +1282,13 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String ComponentDetails::GetModelName() const noexcept + Aws::Crt::String ComponentDetails::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ComponentDetails"); } + Aws::Crt::String ComponentDetails::GetModelName() const noexcept { return ComponentDetails::s_getModelName(); } + Aws::Crt::ScopedResource ComponentDetails::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1265,11 +1328,16 @@ namespace Aws } } - Aws::Crt::String InvalidTokenError::GetModelName() const noexcept + Aws::Crt::String InvalidTokenError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#InvalidTokenError"); } + Aws::Crt::String InvalidTokenError::GetModelName() const noexcept + { + return InvalidTokenError::s_getModelName(); + } + Aws::Crt::ScopedResource InvalidTokenError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1310,11 +1378,16 @@ namespace Aws } } - Aws::Crt::String ValidateAuthorizationTokenResponse::GetModelName() const noexcept + Aws::Crt::String ValidateAuthorizationTokenResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenResponse"); } + Aws::Crt::String ValidateAuthorizationTokenResponse::GetModelName() const noexcept + { + return ValidateAuthorizationTokenResponse::s_getModelName(); + } + Aws::Crt::ScopedResource ValidateAuthorizationTokenResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1357,11 +1430,16 @@ namespace Aws } } - Aws::Crt::String ValidateAuthorizationTokenRequest::GetModelName() const noexcept + Aws::Crt::String ValidateAuthorizationTokenRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenRequest"); } + Aws::Crt::String ValidateAuthorizationTokenRequest::GetModelName() const noexcept + { + return ValidateAuthorizationTokenRequest::s_getModelName(); + } + Aws::Crt::ScopedResource ValidateAuthorizationTokenRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1409,11 +1487,16 @@ namespace Aws } } - Aws::Crt::String UpdateThingShadowResponse::GetModelName() const noexcept + Aws::Crt::String UpdateThingShadowResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UpdateThingShadowResponse"); } + Aws::Crt::String UpdateThingShadowResponse::GetModelName() const noexcept + { + return UpdateThingShadowResponse::s_getModelName(); + } + Aws::Crt::ScopedResource UpdateThingShadowResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1478,11 +1561,16 @@ namespace Aws } } - Aws::Crt::String UpdateThingShadowRequest::GetModelName() const noexcept + Aws::Crt::String UpdateThingShadowRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UpdateThingShadowRequest"); } + Aws::Crt::String UpdateThingShadowRequest::GetModelName() const noexcept + { + return UpdateThingShadowRequest::s_getModelName(); + } + Aws::Crt::ScopedResource UpdateThingShadowRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1517,11 +1605,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept + Aws::Crt::String UpdateStateResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UpdateStateResponse"); } + Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept + { + return UpdateStateResponse::s_getModelName(); + } + Aws::Crt::ScopedResource UpdateStateResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1592,11 +1685,16 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept + Aws::Crt::String UpdateStateRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UpdateStateRequest"); } + Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept + { + return UpdateStateRequest::s_getModelName(); + } + Aws::Crt::ScopedResource UpdateStateRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1637,11 +1735,16 @@ namespace Aws } } - Aws::Crt::String FailedUpdateConditionCheckError::GetModelName() const noexcept + Aws::Crt::String FailedUpdateConditionCheckError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#FailedUpdateConditionCheckError"); } + Aws::Crt::String FailedUpdateConditionCheckError::GetModelName() const noexcept + { + return FailedUpdateConditionCheckError::s_getModelName(); + } + Aws::Crt::ScopedResource FailedUpdateConditionCheckError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1682,11 +1785,13 @@ namespace Aws } } - Aws::Crt::String ConflictError::GetModelName() const noexcept + Aws::Crt::String ConflictError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ConflictError"); } + Aws::Crt::String ConflictError::GetModelName() const noexcept { return ConflictError::s_getModelName(); } + Aws::Crt::ScopedResource ConflictError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1721,11 +1826,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String UpdateConfigurationResponse::GetModelName() const noexcept + Aws::Crt::String UpdateConfigurationResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UpdateConfigurationResponse"); } + Aws::Crt::String UpdateConfigurationResponse::GetModelName() const noexcept + { + return UpdateConfigurationResponse::s_getModelName(); + } + Aws::Crt::ScopedResource UpdateConfigurationResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1798,11 +1908,16 @@ namespace Aws } } - Aws::Crt::String UpdateConfigurationRequest::GetModelName() const noexcept + Aws::Crt::String UpdateConfigurationRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UpdateConfigurationRequest"); } + Aws::Crt::String UpdateConfigurationRequest::GetModelName() const noexcept + { + return UpdateConfigurationRequest::s_getModelName(); + } + Aws::Crt::ScopedResource UpdateConfigurationRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1838,11 +1953,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToValidateConfigurationUpdatesResponse::GetModelName() const noexcept + Aws::Crt::String SubscribeToValidateConfigurationUpdatesResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesResponse"); } + Aws::Crt::String SubscribeToValidateConfigurationUpdatesResponse::GetModelName() const noexcept + { + return SubscribeToValidateConfigurationUpdatesResponse::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesResponse:: s_allocateFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept { @@ -1879,11 +1999,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToValidateConfigurationUpdatesRequest::GetModelName() const noexcept + Aws::Crt::String SubscribeToValidateConfigurationUpdatesRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesRequest"); } + Aws::Crt::String SubscribeToValidateConfigurationUpdatesRequest::GetModelName() const noexcept + { + return SubscribeToValidateConfigurationUpdatesRequest::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesRequest:: s_allocateFromPayload(Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept { @@ -1925,11 +2050,16 @@ namespace Aws } } - Aws::Crt::String SubscribeToTopicResponse::GetModelName() const noexcept + Aws::Crt::String SubscribeToTopicResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToTopicResponse"); } + Aws::Crt::String SubscribeToTopicResponse::GetModelName() const noexcept + { + return SubscribeToTopicResponse::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToTopicResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -1969,11 +2099,16 @@ namespace Aws } } - Aws::Crt::String SubscribeToTopicRequest::GetModelName() const noexcept + Aws::Crt::String SubscribeToTopicRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToTopicRequest"); } + Aws::Crt::String SubscribeToTopicRequest::GetModelName() const noexcept + { + return SubscribeToTopicRequest::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToTopicRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2008,11 +2143,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToIoTCoreResponse::GetModelName() const noexcept + Aws::Crt::String SubscribeToIoTCoreResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreResponse"); } + Aws::Crt::String SubscribeToIoTCoreResponse::GetModelName() const noexcept + { + return SubscribeToIoTCoreResponse::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToIoTCoreResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2092,11 +2232,16 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String SubscribeToIoTCoreRequest::GetModelName() const noexcept + Aws::Crt::String SubscribeToIoTCoreRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreRequest"); } + Aws::Crt::String SubscribeToIoTCoreRequest::GetModelName() const noexcept + { + return SubscribeToIoTCoreRequest::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToIoTCoreRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2132,11 +2277,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToConfigurationUpdateResponse::GetModelName() const noexcept + Aws::Crt::String SubscribeToConfigurationUpdateResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateResponse"); } + Aws::Crt::String SubscribeToConfigurationUpdateResponse::GetModelName() const noexcept + { + return SubscribeToConfigurationUpdateResponse::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToConfigurationUpdateResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2203,11 +2353,16 @@ namespace Aws } } - Aws::Crt::String SubscribeToConfigurationUpdateRequest::GetModelName() const noexcept + Aws::Crt::String SubscribeToConfigurationUpdateRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateRequest"); } + Aws::Crt::String SubscribeToConfigurationUpdateRequest::GetModelName() const noexcept + { + return SubscribeToConfigurationUpdateRequest::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToConfigurationUpdateRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2245,11 +2400,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToComponentUpdatesResponse::GetModelName() const noexcept + Aws::Crt::String SubscribeToComponentUpdatesResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesResponse"); } + Aws::Crt::String SubscribeToComponentUpdatesResponse::GetModelName() const noexcept + { + return SubscribeToComponentUpdatesResponse::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToComponentUpdatesResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2286,11 +2446,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToComponentUpdatesRequest::GetModelName() const noexcept + Aws::Crt::String SubscribeToComponentUpdatesRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesRequest"); } + Aws::Crt::String SubscribeToComponentUpdatesRequest::GetModelName() const noexcept + { + return SubscribeToComponentUpdatesRequest::s_getModelName(); + } + Aws::Crt::ScopedResource SubscribeToComponentUpdatesRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2371,11 +2536,16 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String StopComponentResponse::GetModelName() const noexcept + Aws::Crt::String StopComponentResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#StopComponentResponse"); } + Aws::Crt::String StopComponentResponse::GetModelName() const noexcept + { + return StopComponentResponse::s_getModelName(); + } + Aws::Crt::ScopedResource StopComponentResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2416,11 +2586,16 @@ namespace Aws } } - Aws::Crt::String StopComponentRequest::GetModelName() const noexcept + Aws::Crt::String StopComponentRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#StopComponentRequest"); } + Aws::Crt::String StopComponentRequest::GetModelName() const noexcept + { + return StopComponentRequest::s_getModelName(); + } + Aws::Crt::ScopedResource StopComponentRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2456,11 +2631,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SendConfigurationValidityReportResponse::GetModelName() const noexcept + Aws::Crt::String SendConfigurationValidityReportResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportResponse"); } + Aws::Crt::String SendConfigurationValidityReportResponse::GetModelName() const noexcept + { + return SendConfigurationValidityReportResponse::s_getModelName(); + } + Aws::Crt::ScopedResource SendConfigurationValidityReportResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2508,11 +2688,16 @@ namespace Aws } } - Aws::Crt::String SendConfigurationValidityReportRequest::GetModelName() const noexcept + Aws::Crt::String SendConfigurationValidityReportRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportRequest"); } + Aws::Crt::String SendConfigurationValidityReportRequest::GetModelName() const noexcept + { + return SendConfigurationValidityReportRequest::s_getModelName(); + } + Aws::Crt::ScopedResource SendConfigurationValidityReportRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2554,11 +2739,16 @@ namespace Aws } } - Aws::Crt::String ComponentNotFoundError::GetModelName() const noexcept + Aws::Crt::String ComponentNotFoundError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ComponentNotFoundError"); } + Aws::Crt::String ComponentNotFoundError::GetModelName() const noexcept + { + return ComponentNotFoundError::s_getModelName(); + } + Aws::Crt::ScopedResource ComponentNotFoundError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2639,11 +2829,16 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String RestartComponentResponse::GetModelName() const noexcept + Aws::Crt::String RestartComponentResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#RestartComponentResponse"); } + Aws::Crt::String RestartComponentResponse::GetModelName() const noexcept + { + return RestartComponentResponse::s_getModelName(); + } + Aws::Crt::ScopedResource RestartComponentResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2684,11 +2879,16 @@ namespace Aws } } - Aws::Crt::String RestartComponentRequest::GetModelName() const noexcept + Aws::Crt::String RestartComponentRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#RestartComponentRequest"); } + Aws::Crt::String RestartComponentRequest::GetModelName() const noexcept + { + return RestartComponentRequest::s_getModelName(); + } + Aws::Crt::ScopedResource RestartComponentRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2723,11 +2923,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String PublishToTopicResponse::GetModelName() const noexcept + Aws::Crt::String PublishToTopicResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PublishToTopicResponse"); } + Aws::Crt::String PublishToTopicResponse::GetModelName() const noexcept + { + return PublishToTopicResponse::s_getModelName(); + } + Aws::Crt::ScopedResource PublishToTopicResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2779,11 +2984,16 @@ namespace Aws } } - Aws::Crt::String PublishToTopicRequest::GetModelName() const noexcept + Aws::Crt::String PublishToTopicRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PublishToTopicRequest"); } + Aws::Crt::String PublishToTopicRequest::GetModelName() const noexcept + { + return PublishToTopicRequest::s_getModelName(); + } + Aws::Crt::ScopedResource PublishToTopicRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2818,11 +3028,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String PublishToIoTCoreResponse::GetModelName() const noexcept + Aws::Crt::String PublishToIoTCoreResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PublishToIoTCoreResponse"); } + Aws::Crt::String PublishToIoTCoreResponse::GetModelName() const noexcept + { + return PublishToIoTCoreResponse::s_getModelName(); + } + Aws::Crt::ScopedResource PublishToIoTCoreResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2917,11 +3132,16 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String PublishToIoTCoreRequest::GetModelName() const noexcept + Aws::Crt::String PublishToIoTCoreRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#PublishToIoTCoreRequest"); } + Aws::Crt::String PublishToIoTCoreRequest::GetModelName() const noexcept + { + return PublishToIoTCoreRequest::s_getModelName(); + } + Aws::Crt::ScopedResource PublishToIoTCoreRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -2994,11 +3214,16 @@ namespace Aws } } - Aws::Crt::String ListNamedShadowsForThingResponse::GetModelName() const noexcept + Aws::Crt::String ListNamedShadowsForThingResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingResponse"); } + Aws::Crt::String ListNamedShadowsForThingResponse::GetModelName() const noexcept + { + return ListNamedShadowsForThingResponse::s_getModelName(); + } + Aws::Crt::ScopedResource ListNamedShadowsForThingResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3057,11 +3282,16 @@ namespace Aws } } - Aws::Crt::String ListNamedShadowsForThingRequest::GetModelName() const noexcept + Aws::Crt::String ListNamedShadowsForThingRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingRequest"); } + Aws::Crt::String ListNamedShadowsForThingRequest::GetModelName() const noexcept + { + return ListNamedShadowsForThingRequest::s_getModelName(); + } + Aws::Crt::ScopedResource ListNamedShadowsForThingRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3120,11 +3350,16 @@ namespace Aws } } - Aws::Crt::String ListLocalDeploymentsResponse::GetModelName() const noexcept + Aws::Crt::String ListLocalDeploymentsResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsResponse"); } + Aws::Crt::String ListLocalDeploymentsResponse::GetModelName() const noexcept + { + return ListLocalDeploymentsResponse::s_getModelName(); + } + Aws::Crt::ScopedResource ListLocalDeploymentsResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3159,11 +3394,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String ListLocalDeploymentsRequest::GetModelName() const noexcept + Aws::Crt::String ListLocalDeploymentsRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsRequest"); } + Aws::Crt::String ListLocalDeploymentsRequest::GetModelName() const noexcept + { + return ListLocalDeploymentsRequest::s_getModelName(); + } + Aws::Crt::ScopedResource ListLocalDeploymentsRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3219,11 +3459,16 @@ namespace Aws } } - Aws::Crt::String ListComponentsResponse::GetModelName() const noexcept + Aws::Crt::String ListComponentsResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ListComponentsResponse"); } + Aws::Crt::String ListComponentsResponse::GetModelName() const noexcept + { + return ListComponentsResponse::s_getModelName(); + } + Aws::Crt::ScopedResource ListComponentsResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3258,11 +3503,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String ListComponentsRequest::GetModelName() const noexcept + Aws::Crt::String ListComponentsRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ListComponentsRequest"); } + Aws::Crt::String ListComponentsRequest::GetModelName() const noexcept + { + return ListComponentsRequest::s_getModelName(); + } + Aws::Crt::ScopedResource ListComponentsRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3309,11 +3559,16 @@ namespace Aws } } - Aws::Crt::String GetThingShadowResponse::GetModelName() const noexcept + Aws::Crt::String GetThingShadowResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetThingShadowResponse"); } + Aws::Crt::String GetThingShadowResponse::GetModelName() const noexcept + { + return GetThingShadowResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetThingShadowResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3363,11 +3618,16 @@ namespace Aws } } - Aws::Crt::String GetThingShadowRequest::GetModelName() const noexcept + Aws::Crt::String GetThingShadowRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetThingShadowRequest"); } + Aws::Crt::String GetThingShadowRequest::GetModelName() const noexcept + { + return GetThingShadowRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetThingShadowRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3452,11 +3712,16 @@ namespace Aws } } - Aws::Crt::String GetSecretValueResponse::GetModelName() const noexcept + Aws::Crt::String GetSecretValueResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetSecretValueResponse"); } + Aws::Crt::String GetSecretValueResponse::GetModelName() const noexcept + { + return GetSecretValueResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetSecretValueResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3514,11 +3779,16 @@ namespace Aws } } - Aws::Crt::String GetSecretValueRequest::GetModelName() const noexcept + Aws::Crt::String GetSecretValueRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetSecretValueRequest"); } + Aws::Crt::String GetSecretValueRequest::GetModelName() const noexcept + { + return GetSecretValueRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetSecretValueRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3562,11 +3832,16 @@ namespace Aws } } - Aws::Crt::String GetLocalDeploymentStatusResponse::GetModelName() const noexcept + Aws::Crt::String GetLocalDeploymentStatusResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusResponse"); } + Aws::Crt::String GetLocalDeploymentStatusResponse::GetModelName() const noexcept + { + return GetLocalDeploymentStatusResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetLocalDeploymentStatusResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3608,11 +3883,16 @@ namespace Aws } } - Aws::Crt::String GetLocalDeploymentStatusRequest::GetModelName() const noexcept + Aws::Crt::String GetLocalDeploymentStatusRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusRequest"); } + Aws::Crt::String GetLocalDeploymentStatusRequest::GetModelName() const noexcept + { + return GetLocalDeploymentStatusRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetLocalDeploymentStatusRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3663,11 +3943,16 @@ namespace Aws } } - Aws::Crt::String GetConfigurationResponse::GetModelName() const noexcept + Aws::Crt::String GetConfigurationResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetConfigurationResponse"); } + Aws::Crt::String GetConfigurationResponse::GetModelName() const noexcept + { + return GetConfigurationResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetConfigurationResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3731,11 +4016,16 @@ namespace Aws } } - Aws::Crt::String GetConfigurationRequest::GetModelName() const noexcept + Aws::Crt::String GetConfigurationRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetConfigurationRequest"); } + Aws::Crt::String GetConfigurationRequest::GetModelName() const noexcept + { + return GetConfigurationRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetConfigurationRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3779,11 +4069,16 @@ namespace Aws } } - Aws::Crt::String GetComponentDetailsResponse::GetModelName() const noexcept + Aws::Crt::String GetComponentDetailsResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetComponentDetailsResponse"); } + Aws::Crt::String GetComponentDetailsResponse::GetModelName() const noexcept + { + return GetComponentDetailsResponse::s_getModelName(); + } + Aws::Crt::ScopedResource GetComponentDetailsResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3824,11 +4119,16 @@ namespace Aws } } - Aws::Crt::String GetComponentDetailsRequest::GetModelName() const noexcept + Aws::Crt::String GetComponentDetailsRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#GetComponentDetailsRequest"); } + Aws::Crt::String GetComponentDetailsRequest::GetModelName() const noexcept + { + return GetComponentDetailsRequest::s_getModelName(); + } + Aws::Crt::ScopedResource GetComponentDetailsRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3875,11 +4175,16 @@ namespace Aws } } - Aws::Crt::String DeleteThingShadowResponse::GetModelName() const noexcept + Aws::Crt::String DeleteThingShadowResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#DeleteThingShadowResponse"); } + Aws::Crt::String DeleteThingShadowResponse::GetModelName() const noexcept + { + return DeleteThingShadowResponse::s_getModelName(); + } + Aws::Crt::ScopedResource DeleteThingShadowResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3929,11 +4234,16 @@ namespace Aws } } - Aws::Crt::String DeleteThingShadowRequest::GetModelName() const noexcept + Aws::Crt::String DeleteThingShadowRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#DeleteThingShadowRequest"); } + Aws::Crt::String DeleteThingShadowRequest::GetModelName() const noexcept + { + return DeleteThingShadowRequest::s_getModelName(); + } + Aws::Crt::ScopedResource DeleteThingShadowRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -3991,11 +4301,16 @@ namespace Aws } } - Aws::Crt::String ResourceNotFoundError::GetModelName() const noexcept + Aws::Crt::String ResourceNotFoundError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ResourceNotFoundError"); } + Aws::Crt::String ResourceNotFoundError::GetModelName() const noexcept + { + return ResourceNotFoundError::s_getModelName(); + } + Aws::Crt::ScopedResource ResourceNotFoundError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4030,11 +4345,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String DeferComponentUpdateResponse::GetModelName() const noexcept + Aws::Crt::String DeferComponentUpdateResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#DeferComponentUpdateResponse"); } + Aws::Crt::String DeferComponentUpdateResponse::GetModelName() const noexcept + { + return DeferComponentUpdateResponse::s_getModelName(); + } + Aws::Crt::ScopedResource DeferComponentUpdateResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4093,11 +4413,16 @@ namespace Aws } } - Aws::Crt::String DeferComponentUpdateRequest::GetModelName() const noexcept + Aws::Crt::String DeferComponentUpdateRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#DeferComponentUpdateRequest"); } + Aws::Crt::String DeferComponentUpdateRequest::GetModelName() const noexcept + { + return DeferComponentUpdateRequest::s_getModelName(); + } + Aws::Crt::ScopedResource DeferComponentUpdateRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4137,11 +4462,16 @@ namespace Aws } } - Aws::Crt::String InvalidArgumentsError::GetModelName() const noexcept + Aws::Crt::String InvalidArgumentsError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#InvalidArgumentsError"); } + Aws::Crt::String InvalidArgumentsError::GetModelName() const noexcept + { + return InvalidArgumentsError::s_getModelName(); + } + Aws::Crt::ScopedResource InvalidArgumentsError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4183,11 +4513,16 @@ namespace Aws } } - Aws::Crt::String InvalidArtifactsDirectoryPathError::GetModelName() const noexcept + Aws::Crt::String InvalidArtifactsDirectoryPathError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#InvalidArtifactsDirectoryPathError"); } + Aws::Crt::String InvalidArtifactsDirectoryPathError::GetModelName() const noexcept + { + return InvalidArtifactsDirectoryPathError::s_getModelName(); + } + Aws::Crt::ScopedResource InvalidArtifactsDirectoryPathError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4229,11 +4564,16 @@ namespace Aws } } - Aws::Crt::String InvalidRecipeDirectoryPathError::GetModelName() const noexcept + Aws::Crt::String InvalidRecipeDirectoryPathError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#InvalidRecipeDirectoryPathError"); } + Aws::Crt::String InvalidRecipeDirectoryPathError::GetModelName() const noexcept + { + return InvalidRecipeDirectoryPathError::s_getModelName(); + } + Aws::Crt::ScopedResource InvalidRecipeDirectoryPathError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4275,11 +4615,16 @@ namespace Aws } } - Aws::Crt::String CreateLocalDeploymentResponse::GetModelName() const noexcept + Aws::Crt::String CreateLocalDeploymentResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentResponse"); } + Aws::Crt::String CreateLocalDeploymentResponse::GetModelName() const noexcept + { + return CreateLocalDeploymentResponse::s_getModelName(); + } + Aws::Crt::ScopedResource CreateLocalDeploymentResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4440,11 +4785,16 @@ namespace Aws } } - Aws::Crt::String CreateLocalDeploymentRequest::GetModelName() const noexcept + Aws::Crt::String CreateLocalDeploymentRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentRequest"); } + Aws::Crt::String CreateLocalDeploymentRequest::GetModelName() const noexcept + { + return CreateLocalDeploymentRequest::s_getModelName(); + } + Aws::Crt::ScopedResource CreateLocalDeploymentRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4482,11 +4832,13 @@ namespace Aws } } - Aws::Crt::String ServiceError::GetModelName() const noexcept + Aws::Crt::String ServiceError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#ServiceError"); } + Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::s_getModelName(); } + Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4526,11 +4878,16 @@ namespace Aws } } - Aws::Crt::String UnauthorizedError::GetModelName() const noexcept + Aws::Crt::String UnauthorizedError::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#UnauthorizedError"); } + Aws::Crt::String UnauthorizedError::GetModelName() const noexcept + { + return UnauthorizedError::s_getModelName(); + } + Aws::Crt::ScopedResource UnauthorizedError::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4607,11 +4964,16 @@ namespace Aws } } - Aws::Crt::String CreateDebugPasswordResponse::GetModelName() const noexcept + Aws::Crt::String CreateDebugPasswordResponse::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#CreateDebugPasswordResponse"); } + Aws::Crt::String CreateDebugPasswordResponse::GetModelName() const noexcept + { + return CreateDebugPasswordResponse::s_getModelName(); + } + Aws::Crt::ScopedResource CreateDebugPasswordResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept @@ -4646,11 +5008,16 @@ namespace Aws (void)jsonView; } - Aws::Crt::String CreateDebugPasswordRequest::GetModelName() const noexcept + Aws::Crt::String CreateDebugPasswordRequest::s_getModelName() noexcept { return Aws::Crt::String("aws.greengrass#CreateDebugPasswordRequest"); } + Aws::Crt::String CreateDebugPasswordRequest::GetModelName() const noexcept + { + return CreateDebugPasswordRequest::s_getModelName(); + } + Aws::Crt::ScopedResource CreateDebugPasswordRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, Aws::Crt::Allocator *allocator) noexcept diff --git a/samples/README.md b/samples/README.md index 9b02f904d..3e445eb89 100644 --- a/samples/README.md +++ b/samples/README.md @@ -6,6 +6,7 @@ * [Shadow](#shadow) * [Jobs](#jobs) * [Greengrass discovery](#greengrass-discovery) +* [Greengrass IPC](#greengrass-ipc) ## Build Instruction @@ -342,4 +343,8 @@ Source: `samples/secure_tunneling` ## Greengrass discovery -This sample is intended for direct usage with the Greengrass tutorial found [here](https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html). +This sample is intended for direct usage with the Greengrass Discovery tutorial found [here](https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html). + +## Greengrass IPC + +This sample is intended for direct usage with the Greengrass IPC tutorial found [here](https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-iot-core-mqtt.html). diff --git a/samples/greengrass/ipc/CMakeLists.txt b/samples/greengrass/ipc/CMakeLists.txt new file mode 100644 index 000000000..6af6170b5 --- /dev/null +++ b/samples/greengrass/ipc/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.1) +# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12 +project(greengrass-ipc CXX) + +file(GLOB SRC_FILES + "*.cpp" +) + +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(GreengrassIpc-cpp REQUIRED) + +install(TARGETS ${PROJECT_NAME} DESTINATION bin) + +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::EventstreamRpc-cpp AWS::GreengrassIpc-cpp) diff --git a/samples/greengrass/ipc/main.cpp b/samples/greengrass/ipc/main.cpp new file mode 100644 index 000000000..21b05f959 --- /dev/null +++ b/samples/greengrass/ipc/main.cpp @@ -0,0 +1,266 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#include +#include + +#include + +using namespace Aws::Crt; +using namespace Aws::Greengrass; + +static void s_printHelp() +{ + fprintf(stdout, "Usage:\n"); + fprintf(stdout, "greengrass-ipc --topic --message \n\n"); + fprintf(stdout, "topic: targeted topic. Default is test/topic\n"); + fprintf(stdout, "message: message to publish. default 'Hello World'\n"); +} + +/* Used to check that the publish has been received so that the demo can exit successfully. */ +static std::atomic_bool s_publishReceived(false); + +bool s_cmdOptionExists(char **begin, char **end, const String &option) +{ + return std::find(begin, end, option) != end; +} + +char *s_getCmdOption(char **begin, char **end, const String &option) +{ + char **itr = std::find(begin, end, option); + if (itr != end && ++itr != end) + { + return *itr; + } + return 0; +} + +int main(int argc, char *argv[]) +{ + /************************ Setup the Lib ****************************/ + /* + * Do the global initialization for the API. + */ + ApiHandle apiHandle; + + String topic("test/topic"); + String message("Hello World"); + + /*********************** Parse Arguments ***************************/ + if (s_cmdOptionExists(argv, argv + argc, "--help")) + { + s_printHelp(); + return 0; + } + + if (s_cmdOptionExists(argv, argv + argc, "--topic")) + { + topic = s_getCmdOption(argv, argv + argc, "--topic"); + } + + if (s_cmdOptionExists(argv, argv + argc, "--message")) + { + message = s_getCmdOption(argv, argv + argc, "--message"); + } + + Io::EventLoopGroup eventLoopGroup(1); + if (!eventLoopGroup) + { + fprintf( + stderr, "Event Loop Group Creation failed with error %s\n", ErrorDebugString(eventLoopGroup.LastError())); + exit(-1); + } + + Io::DefaultHostResolver resolver(eventLoopGroup, 64, 30); + Io::ClientBootstrap bootstrap(eventLoopGroup, resolver); + + if (!bootstrap) + { + fprintf(stderr, "ClientBootstrap failed with error %s\n", ErrorDebugString(bootstrap.LastError())); + exit(-1); + } + + /* + * Inheriting from ConnectionLifecycleHandler allows us to define callbacks that are + * called upon when connection lifecycle events occur. + */ + class SampleLifecycleHandler : public ConnectionLifecycleHandler + { + public: + SampleLifecycleHandler() {} + + void OnConnectCallback() override { fprintf(stdout, "Connected to Greengrass Core\n"); } + + void OnDisconnectCallback(RpcError status) override + { + if (!status) + { + fprintf(stdout, "Disconnected from Greengrass Core with error: %s\n", status.StatusToString().c_str()); + exit(-1); + } + } + + bool OnErrorCallback(RpcError status) override + { + fprintf( + stdout, + "Processing messages from the Greengrass Core resulted in error: %s\n", + status.StatusToString().c_str()); + return true; + } + }; + /* + * Note: The lifecycle handler should be declared before the client + * so that it is destroyed AFTER the client is destroyed. + */ + SampleLifecycleHandler lifecycleHandler; + GreengrassCoreIpcClient client(bootstrap); + auto connectionStatus = client.Connect(lifecycleHandler).get(); + + if (!connectionStatus) + { + fprintf(stderr, "Failed to establish connection with error %s\n", connectionStatus.StatusToString().c_str()); + exit(-1); + } + + /* + * Upon receiving a message on the topic, print it and set an atomic bool so that the demo can complete. + */ + class SubscribeStreamHandler : public SubscribeToIoTCoreStreamHandler + { + void OnStreamEvent(IoTCoreMessage *response) override + { + auto message = response->GetMessage(); + + if (message.has_value() && message.value().GetPayload().has_value()) + { + auto payloadBytes = message.value().GetPayload().value(); + std::string payloadString(payloadBytes.begin(), payloadBytes.end()); + fprintf(stdout, "Received payload: %s\n", payloadString.c_str()); + } + + s_publishReceived.store(true); + }; + }; + + SubscribeStreamHandler streamHandler; + auto subscribeOperation = client.NewSubscribeToIoTCore(streamHandler); + SubscribeToIoTCoreRequest subscribeRequest; + subscribeRequest.SetQos(QOS_AT_LEAST_ONCE); + subscribeRequest.SetTopicName(topic); + + fprintf(stdout, "Attempting to subscribe to %s topic\n", topic.c_str()); + auto requestStatus = subscribeOperation.Activate(subscribeRequest).get(); + if (!requestStatus) + { + fprintf(stderr, "Failed to send subscription request to %s topic\n", topic.c_str()); + exit(-1); + } + + auto subscribeResultFuture = subscribeOperation.GetResult(); + /* + // To avoid throwing exceptions, wait on the result for a specified timeout: + if (subscribeResultFuture.wait_for(std::chrono::seconds(10)) != std::future_status::ready) + { + fprintf(stderr, "Timed out while waiting for response from Greengrass Core\n"); + exit(-1); + } + */ + + auto subscribeResult = subscribeResultFuture.get(); + if (subscribeResult) + { + fprintf(stdout, "Successfully subscribed to %s topic\n", topic.c_str()); + } + else + { + auto errorType = subscribeResult.GetResultType(); + if (errorType == OPERATION_ERROR) + { + OperationError *error = subscribeResult.GetOperationError(); + /* + * This pointer can be casted to any error type like so: + * if(error->GetModelName() == UnauthorizedError::s_getModelName()) + * UnauthorizedError *unauthorizedError = static_cast(error); + */ + if (error->GetMessage().has_value()) + fprintf(stderr, "Greengrass Core responded with an error: %s\n", error->GetMessage().value().c_str()); + } + else + { + fprintf( + stderr, + "Attempting to receive the response from the server failed with error code %s\n", + subscribeResult.GetRpcError().StatusToString().c_str()); + } + } + + /* Publish to the same topic that is currently subscribed to. */ + auto publishOperation = client.NewPublishToIoTCore(); + PublishToIoTCoreRequest publishRequest; + publishRequest.SetTopicName(topic); + Vector payload(message.begin(), message.end()); + publishRequest.SetPayload(payload); + publishRequest.SetQos(QOS_AT_LEAST_ONCE); + + fprintf(stdout, "Attempting to publish to %s topic\n", topic.c_str()); + requestStatus = publishOperation.Activate(publishRequest).get(); + if (!requestStatus) + { + fprintf( + stderr, + "Failed to publish to %s topic with error %s\n", + topic.c_str(), + requestStatus.StatusToString().c_str()); + exit(-1); + } + + auto publishResultFuture = publishOperation.GetResult(); + /* + // To avoid throwing exceptions, wait on the result for a specified timeout: + if (publishResultFuture.wait_for(std::chrono::seconds(10)) != std::future_status::ready) + { + fprintf(stderr, "Timed out while waiting for response from Greengrass Core\n"); + exit(-1); + } + */ + + auto publishResult = publishResultFuture.get(); + if (publishResult) + { + fprintf(stdout, "Successfully published to %s topic\n", topic.c_str()); + auto *response = publishResult.GetOperationResponse(); + (void)response; + } + else + { + auto errorType = publishResult.GetResultType(); + if (errorType == OPERATION_ERROR) + { + OperationError *error = publishResult.GetOperationError(); + /* + * This pointer can be casted to any error type like so: + * if(error->GetModelName() == UnauthorizedError::s_getModelName()) + * UnauthorizedError *unauthorizedError = static_cast(error); + */ + if (error->GetMessage().has_value()) + fprintf(stderr, "Greengrass Core responded with an error: %s\n", error->GetMessage().value().c_str()); + } + else + { + fprintf( + stderr, + "Attempting to receive the response from the server failed with error code %s\n", + publishResult.GetRpcError().StatusToString().c_str()); + } + } + + /* Wait for the publish to be received since this sample subscribes to the same topic it publishes to. */ + while (!s_publishReceived.load()) + { + continue; + } + + return 0; +} From 720491e1ee15cad94d25f6832149b4dbb7467457 Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Wed, 7 Jul 2021 12:06:12 -0700 Subject: [PATCH 16/17] Address PR comments --- .../aws/eventstreamrpc/EventStreamClient.h | 4 +- eventstream_rpc/source/EventStreamClient.cpp | 6 +- eventstream_rpc/tests/EchoTestRpcModel.cpp | 112 +--- .../tests/include/awstest/EchoTestRpcModel.h | 32 +- .../aws/greengrass/GreengrassCoreIpcModel.h | 160 ++--- .../source/GreengrassCoreIpcModel.cpp | 582 +++++------------- samples/greengrass/ipc/main.cpp | 8 +- 7 files changed, 307 insertions(+), 597 deletions(-) diff --git a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h index 887bc83de..88103b83d 100644 --- a/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h +++ b/eventstream_rpc/include/aws/eventstreamrpc/EventStreamClient.h @@ -134,11 +134,11 @@ namespace Aws MessageAmendment(const Crt::ByteBuf &payload, Crt::Allocator *allocator = Crt::g_allocator) noexcept; void AddHeader(EventStreamHeader &&header) noexcept; void SetPayload(const Crt::Optional &payload) noexcept; - Crt::List &GetHeaders() const noexcept; + const Crt::List &GetHeaders() const noexcept; const Crt::Optional &GetPayload() const noexcept; private: - mutable Crt::List m_headers; + Crt::List m_headers; Crt::Optional m_payload; Crt::Allocator *m_allocator; }; diff --git a/eventstream_rpc/source/EventStreamClient.cpp b/eventstream_rpc/source/EventStreamClient.cpp index 6e9fe1545..6a7ed8b9c 100644 --- a/eventstream_rpc/source/EventStreamClient.cpp +++ b/eventstream_rpc/source/EventStreamClient.cpp @@ -97,7 +97,7 @@ namespace Aws rhs.m_payload = Crt::Optional(); } - Crt::List &MessageAmendment::GetHeaders() const noexcept { return m_headers; } + const Crt::List &MessageAmendment::GetHeaders() const noexcept { return m_headers; } const Crt::Optional &MessageAmendment::GetPayload() const noexcept { return m_payload; } @@ -661,12 +661,12 @@ namespace Aws thisConnection->m_clientState = WAITING_FOR_CONNECT_ACK; thisConnection->m_underlyingConnection = connection; MessageAmendment messageAmendment; - auto &messageAmendmentHeaders = messageAmendment.GetHeaders(); + Crt::List messageAmendmentHeaders = messageAmendment.GetHeaders(); if (thisConnection->m_connectMessageAmender) { MessageAmendment connectAmendment(thisConnection->m_connectMessageAmender()); - auto &amenderHeaderList = connectAmendment.GetHeaders(); + Crt::List amenderHeaderList = connectAmendment.GetHeaders(); /* The version header is necessary for establishing the connection. */ messageAmendment.AddHeader(EventStreamHeader( Crt::String(EVENTSTREAM_VERSION_HEADER), diff --git a/eventstream_rpc/tests/EchoTestRpcModel.cpp b/eventstream_rpc/tests/EchoTestRpcModel.cpp index f3bdc26d4..b951ad0db 100644 --- a/eventstream_rpc/tests/EchoTestRpcModel.cpp +++ b/eventstream_rpc/tests/EchoTestRpcModel.cpp @@ -27,9 +27,9 @@ namespace Awstest } } - Aws::Crt::String Product::s_getModelName() noexcept { return Aws::Crt::String("awstest#Product"); } + const char *Product::MODEL_NAME = "awstest#Product"; - Aws::Crt::String Product::GetModelName() const noexcept { return Product::s_getModelName(); } + Aws::Crt::String Product::GetModelName() const noexcept { return Product::MODEL_NAME; } Aws::Crt::ScopedResource Product::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -83,9 +83,9 @@ namespace Awstest } } - Aws::Crt::String Customer::s_getModelName() noexcept { return Aws::Crt::String("awstest#Customer"); } + const char *Customer::MODEL_NAME = "awstest#Customer"; - Aws::Crt::String Customer::GetModelName() const noexcept { return Customer::s_getModelName(); } + Aws::Crt::String Customer::GetModelName() const noexcept { return Customer::MODEL_NAME; } Aws::Crt::ScopedResource Customer::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -131,9 +131,9 @@ namespace Awstest } } - Aws::Crt::String Pair::s_getModelName() noexcept { return Aws::Crt::String("awstest#Pair"); } + const char *Pair::MODEL_NAME = "awstest#Pair"; - Aws::Crt::String Pair::GetModelName() const noexcept { return Pair::s_getModelName(); } + Aws::Crt::String Pair::GetModelName() const noexcept { return Pair::MODEL_NAME; } Aws::Crt::ScopedResource Pair::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -334,9 +334,9 @@ namespace Awstest return Aws::Crt::Optional(); } - Aws::Crt::String MessageData::s_getModelName() noexcept { return Aws::Crt::String("awstest#MessageData"); } + const char *MessageData::MODEL_NAME = "awstest#MessageData"; - Aws::Crt::String MessageData::GetModelName() const noexcept { return MessageData::s_getModelName(); } + Aws::Crt::String MessageData::GetModelName() const noexcept { return MessageData::MODEL_NAME; } Aws::Crt::ScopedResource MessageData::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -410,15 +410,9 @@ namespace Awstest return *this; } - Aws::Crt::String EchoStreamingMessage::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#EchoStreamingMessage"); - } + const char *EchoStreamingMessage::MODEL_NAME = "awstest#EchoStreamingMessage"; - Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept - { - return EchoStreamingMessage::s_getModelName(); - } + Aws::Crt::String EchoStreamingMessage::GetModelName() const noexcept { return EchoStreamingMessage::MODEL_NAME; } Aws::Crt::ScopedResource EchoStreamingMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -473,14 +467,11 @@ namespace Awstest } } - Aws::Crt::String GetAllProductsResponse::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#GetAllProductsResponse"); - } + const char *GetAllProductsResponse::MODEL_NAME = "awstest#GetAllProductsResponse"; Aws::Crt::String GetAllProductsResponse::GetModelName() const noexcept { - return GetAllProductsResponse::s_getModelName(); + return GetAllProductsResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetAllProductsResponse::s_allocateFromPayload( @@ -517,15 +508,9 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String GetAllProductsRequest::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#GetAllProductsRequest"); - } + const char *GetAllProductsRequest::MODEL_NAME = "awstest#GetAllProductsRequest"; - Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept - { - return GetAllProductsRequest::s_getModelName(); - } + Aws::Crt::String GetAllProductsRequest::GetModelName() const noexcept { return GetAllProductsRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetAllProductsRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -582,14 +567,11 @@ namespace Awstest } } - Aws::Crt::String GetAllCustomersResponse::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#GetAllCustomersResponse"); - } + const char *GetAllCustomersResponse::MODEL_NAME = "awstest#GetAllCustomersResponse"; Aws::Crt::String GetAllCustomersResponse::GetModelName() const noexcept { - return GetAllCustomersResponse::s_getModelName(); + return GetAllCustomersResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetAllCustomersResponse::s_allocateFromPayload( @@ -626,14 +608,11 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String GetAllCustomersRequest::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#GetAllCustomersRequest"); - } + const char *GetAllCustomersRequest::MODEL_NAME = "awstest#GetAllCustomersRequest"; Aws::Crt::String GetAllCustomersRequest::GetModelName() const noexcept { - return GetAllCustomersRequest::s_getModelName(); + return GetAllCustomersRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetAllCustomersRequest::s_allocateFromPayload( @@ -678,15 +657,9 @@ namespace Awstest } } - Aws::Crt::String EchoMessageResponse::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#EchoMessageResponse"); - } + const char *EchoMessageResponse::MODEL_NAME = "awstest#EchoMessageResponse"; - Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept - { - return EchoMessageResponse::s_getModelName(); - } + Aws::Crt::String EchoMessageResponse::GetModelName() const noexcept { return EchoMessageResponse::MODEL_NAME; } Aws::Crt::ScopedResource EchoMessageResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -730,12 +703,9 @@ namespace Awstest } } - Aws::Crt::String EchoMessageRequest::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#EchoMessageRequest"); - } + const char *EchoMessageRequest::MODEL_NAME = "awstest#EchoMessageRequest"; - Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept { return EchoMessageRequest::s_getModelName(); } + Aws::Crt::String EchoMessageRequest::GetModelName() const noexcept { return EchoMessageRequest::MODEL_NAME; } Aws::Crt::ScopedResource EchoMessageRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -771,15 +741,9 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String EchoStreamingResponse::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#EchoStreamingResponse"); - } + const char *EchoStreamingResponse::MODEL_NAME = "awstest#EchoStreamingResponse"; - Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept - { - return EchoStreamingResponse::s_getModelName(); - } + Aws::Crt::String EchoStreamingResponse::GetModelName() const noexcept { return EchoStreamingResponse::MODEL_NAME; } Aws::Crt::ScopedResource EchoStreamingResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -815,15 +779,9 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String EchoStreamingRequest::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#EchoStreamingRequest"); - } + const char *EchoStreamingRequest::MODEL_NAME = "awstest#EchoStreamingRequest"; - Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept - { - return EchoStreamingRequest::s_getModelName(); - } + Aws::Crt::String EchoStreamingRequest::GetModelName() const noexcept { return EchoStreamingRequest::MODEL_NAME; } Aws::Crt::ScopedResource EchoStreamingRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -870,9 +828,9 @@ namespace Awstest } } - Aws::Crt::String ServiceError::s_getModelName() noexcept { return Aws::Crt::String("awstest#ServiceError"); } + const char *ServiceError::MODEL_NAME = "awstest#ServiceError"; - Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::s_getModelName(); } + Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::MODEL_NAME; } Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -908,14 +866,11 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String CauseServiceErrorResponse::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#CauseServiceErrorResponse"); - } + const char *CauseServiceErrorResponse::MODEL_NAME = "awstest#CauseServiceErrorResponse"; Aws::Crt::String CauseServiceErrorResponse::GetModelName() const noexcept { - return CauseServiceErrorResponse::s_getModelName(); + return CauseServiceErrorResponse::MODEL_NAME; } Aws::Crt::ScopedResource CauseServiceErrorResponse::s_allocateFromPayload( @@ -952,14 +907,11 @@ namespace Awstest (void)jsonView; } - Aws::Crt::String CauseServiceErrorRequest::s_getModelName() noexcept - { - return Aws::Crt::String("awstest#CauseServiceErrorRequest"); - } + const char *CauseServiceErrorRequest::MODEL_NAME = "awstest#CauseServiceErrorRequest"; Aws::Crt::String CauseServiceErrorRequest::GetModelName() const noexcept { - return CauseServiceErrorRequest::s_getModelName(); + return CauseServiceErrorRequest::MODEL_NAME; } Aws::Crt::ScopedResource CauseServiceErrorRequest::s_allocateFromPayload( diff --git a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h index 78f46a3f8..40a5cf370 100644 --- a/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h +++ b/eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h @@ -34,7 +34,7 @@ namespace Awstest static void s_customDeleter(Product *) noexcept; /* This needs to be defined so that `Product` can be used as a key in maps. */ bool operator<(const Product &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -63,7 +63,7 @@ namespace Awstest static void s_customDeleter(Customer *) noexcept; /* This needs to be defined so that `Customer` can be used as a key in maps. */ bool operator<(const Customer &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -99,7 +99,7 @@ namespace Awstest static void s_customDeleter(Pair *) noexcept; /* This needs to be defined so that `Pair` can be used as a key in maps. */ bool operator<(const Pair &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -158,7 +158,7 @@ namespace Awstest static void s_customDeleter(MessageData *) noexcept; /* This needs to be defined so that `MessageData` can be used as a key in maps. */ bool operator<(const MessageData &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -221,7 +221,7 @@ namespace Awstest static void s_customDeleter(EchoStreamingMessage *) noexcept; /* This needs to be defined so that `EchoStreamingMessage` can be used as a key in maps. */ bool operator<(const EchoStreamingMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -251,7 +251,7 @@ namespace Awstest static void s_customDeleter(GetAllProductsResponse *) noexcept; /* This needs to be defined so that `GetAllProductsResponse` can be used as a key in maps. */ bool operator<(const GetAllProductsResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -273,7 +273,7 @@ namespace Awstest static void s_customDeleter(GetAllProductsRequest *) noexcept; /* This needs to be defined so that `GetAllProductsRequest` can be used as a key in maps. */ bool operator<(const GetAllProductsRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -296,7 +296,7 @@ namespace Awstest static void s_customDeleter(GetAllCustomersResponse *) noexcept; /* This needs to be defined so that `GetAllCustomersResponse` can be used as a key in maps. */ bool operator<(const GetAllCustomersResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -318,7 +318,7 @@ namespace Awstest static void s_customDeleter(GetAllCustomersRequest *) noexcept; /* This needs to be defined so that `GetAllCustomersRequest` can be used as a key in maps. */ bool operator<(const GetAllCustomersRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -341,7 +341,7 @@ namespace Awstest static void s_customDeleter(EchoMessageResponse *) noexcept; /* This needs to be defined so that `EchoMessageResponse` can be used as a key in maps. */ bool operator<(const EchoMessageResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -365,7 +365,7 @@ namespace Awstest static void s_customDeleter(EchoMessageRequest *) noexcept; /* This needs to be defined so that `EchoMessageRequest` can be used as a key in maps. */ bool operator<(const EchoMessageRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -387,7 +387,7 @@ namespace Awstest static void s_customDeleter(EchoStreamingResponse *) noexcept; /* This needs to be defined so that `EchoStreamingResponse` can be used as a key in maps. */ bool operator<(const EchoStreamingResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -408,7 +408,7 @@ namespace Awstest static void s_customDeleter(EchoStreamingRequest *) noexcept; /* This needs to be defined so that `EchoStreamingRequest` can be used as a key in maps. */ bool operator<(const EchoStreamingRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -433,7 +433,7 @@ namespace Awstest static void s_customDeleter(ServiceError *) noexcept; /* This needs to be defined so that `ServiceError` can be used as a key in maps. */ bool operator<(const ServiceError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -456,7 +456,7 @@ namespace Awstest static void s_customDeleter(CauseServiceErrorResponse *) noexcept; /* This needs to be defined so that `CauseServiceErrorResponse` can be used as a key in maps. */ bool operator<(const CauseServiceErrorResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -477,7 +477,7 @@ namespace Awstest static void s_customDeleter(CauseServiceErrorRequest *) noexcept; /* This needs to be defined so that `CauseServiceErrorRequest` can be used as a key in maps. */ bool operator<(const CauseServiceErrorRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; diff --git a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h index 8d1f0afe5..fd07d52e0 100644 --- a/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h +++ b/greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h @@ -39,7 +39,7 @@ namespace Aws static void s_customDeleter(ValidateConfigurationUpdateEvent *) noexcept; /* This needs to be defined so that `ValidateConfigurationUpdateEvent` can be used as a key in maps. */ bool operator<(const ValidateConfigurationUpdateEvent &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -66,7 +66,7 @@ namespace Aws static void s_customDeleter(MQTTMessage *) noexcept; /* This needs to be defined so that `MQTTMessage` can be used as a key in maps. */ bool operator<(const MQTTMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -93,7 +93,7 @@ namespace Aws static void s_customDeleter(ConfigurationUpdateEvent *) noexcept; /* This needs to be defined so that `ConfigurationUpdateEvent` can be used as a key in maps. */ bool operator<(const ConfigurationUpdateEvent &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -118,7 +118,7 @@ namespace Aws static void s_customDeleter(PostComponentUpdateEvent *) noexcept; /* This needs to be defined so that `PostComponentUpdateEvent` can be used as a key in maps. */ bool operator<(const PostComponentUpdateEvent &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -144,7 +144,7 @@ namespace Aws static void s_customDeleter(PreComponentUpdateEvent *) noexcept; /* This needs to be defined so that `PreComponentUpdateEvent` can be used as a key in maps. */ bool operator<(const PreComponentUpdateEvent &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -175,7 +175,7 @@ namespace Aws static void s_customDeleter(BinaryMessage *) noexcept; /* This needs to be defined so that `BinaryMessage` can be used as a key in maps. */ bool operator<(const BinaryMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -199,7 +199,7 @@ namespace Aws static void s_customDeleter(JsonMessage *) noexcept; /* This needs to be defined so that `JsonMessage` can be used as a key in maps. */ bool operator<(const JsonMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -243,7 +243,7 @@ namespace Aws static void s_customDeleter(RunWithInfo *) noexcept; /* This needs to be defined so that `RunWithInfo` can be used as a key in maps. */ bool operator<(const RunWithInfo &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -292,7 +292,7 @@ namespace Aws static void s_customDeleter(ValidateConfigurationUpdateEvents *) noexcept; /* This needs to be defined so that `ValidateConfigurationUpdateEvents` can be used as a key in maps. */ bool operator<(const ValidateConfigurationUpdateEvents &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -351,7 +351,7 @@ namespace Aws static void s_customDeleter(SubscriptionResponseMessage *) noexcept; /* This needs to be defined so that `SubscriptionResponseMessage` can be used as a key in maps. */ bool operator<(const SubscriptionResponseMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -396,7 +396,7 @@ namespace Aws static void s_customDeleter(IoTCoreMessage *) noexcept; /* This needs to be defined so that `IoTCoreMessage` can be used as a key in maps. */ bool operator<(const IoTCoreMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -439,7 +439,7 @@ namespace Aws static void s_customDeleter(ConfigurationUpdateEvents *) noexcept; /* This needs to be defined so that `ConfigurationUpdateEvents` can be used as a key in maps. */ bool operator<(const ConfigurationUpdateEvents &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -498,7 +498,7 @@ namespace Aws static void s_customDeleter(ComponentUpdatePolicyEvents *) noexcept; /* This needs to be defined so that `ComponentUpdatePolicyEvents` can be used as a key in maps. */ bool operator<(const ComponentUpdatePolicyEvents &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -532,7 +532,7 @@ namespace Aws static void s_customDeleter(ConfigurationValidityReport *) noexcept; /* This needs to be defined so that `ConfigurationValidityReport` can be used as a key in maps. */ bool operator<(const ConfigurationValidityReport &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -595,7 +595,7 @@ namespace Aws static void s_customDeleter(PublishMessage *) noexcept; /* This needs to be defined so that `PublishMessage` can be used as a key in maps. */ bool operator<(const PublishMessage &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -662,7 +662,7 @@ namespace Aws static void s_customDeleter(SecretValue *) noexcept; /* This needs to be defined so that `SecretValue` can be used as a key in maps. */ bool operator<(const SecretValue &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -694,7 +694,7 @@ namespace Aws static void s_customDeleter(LocalDeployment *) noexcept; /* This needs to be defined so that `LocalDeployment` can be used as a key in maps. */ bool operator<(const LocalDeployment &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -728,7 +728,7 @@ namespace Aws static void s_customDeleter(ComponentDetails *) noexcept; /* This needs to be defined so that `ComponentDetails` can be used as a key in maps. */ bool operator<(const ComponentDetails &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -755,7 +755,7 @@ namespace Aws static void s_customDeleter(InvalidTokenError *) noexcept; /* This needs to be defined so that `InvalidTokenError` can be used as a key in maps. */ bool operator<(const InvalidTokenError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -779,7 +779,7 @@ namespace Aws static void s_customDeleter(ValidateAuthorizationTokenResponse *) noexcept; /* This needs to be defined so that `ValidateAuthorizationTokenResponse` can be used as a key in maps. */ bool operator<(const ValidateAuthorizationTokenResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -803,7 +803,7 @@ namespace Aws static void s_customDeleter(ValidateAuthorizationTokenRequest *) noexcept; /* This needs to be defined so that `ValidateAuthorizationTokenRequest` can be used as a key in maps. */ bool operator<(const ValidateAuthorizationTokenRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -827,7 +827,7 @@ namespace Aws static void s_customDeleter(UpdateThingShadowResponse *) noexcept; /* This needs to be defined so that `UpdateThingShadowResponse` can be used as a key in maps. */ bool operator<(const UpdateThingShadowResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -855,7 +855,7 @@ namespace Aws static void s_customDeleter(UpdateThingShadowRequest *) noexcept; /* This needs to be defined so that `UpdateThingShadowRequest` can be used as a key in maps. */ bool operator<(const UpdateThingShadowRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -879,7 +879,7 @@ namespace Aws static void s_customDeleter(UpdateStateResponse *) noexcept; /* This needs to be defined so that `UpdateStateResponse` can be used as a key in maps. */ bool operator<(const UpdateStateResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -902,7 +902,7 @@ namespace Aws static void s_customDeleter(UpdateStateRequest *) noexcept; /* This needs to be defined so that `UpdateStateRequest` can be used as a key in maps. */ bool operator<(const UpdateStateRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -926,7 +926,7 @@ namespace Aws static void s_customDeleter(FailedUpdateConditionCheckError *) noexcept; /* This needs to be defined so that `FailedUpdateConditionCheckError` can be used as a key in maps. */ bool operator<(const FailedUpdateConditionCheckError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -950,7 +950,7 @@ namespace Aws static void s_customDeleter(ConflictError *) noexcept; /* This needs to be defined so that `ConflictError` can be used as a key in maps. */ bool operator<(const ConflictError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -972,7 +972,7 @@ namespace Aws static void s_customDeleter(UpdateConfigurationResponse *) noexcept; /* This needs to be defined so that `UpdateConfigurationResponse` can be used as a key in maps. */ bool operator<(const UpdateConfigurationResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -999,7 +999,7 @@ namespace Aws static void s_customDeleter(UpdateConfigurationRequest *) noexcept; /* This needs to be defined so that `UpdateConfigurationRequest` can be used as a key in maps. */ bool operator<(const UpdateConfigurationRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1027,7 +1027,7 @@ namespace Aws /* This needs to be defined so that `SubscribeToValidateConfigurationUpdatesResponse` can be used as a key * in maps. */ bool operator<(const SubscribeToValidateConfigurationUpdatesResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1052,7 +1052,7 @@ namespace Aws /* This needs to be defined so that `SubscribeToValidateConfigurationUpdatesRequest` can be used as a key in * maps. */ bool operator<(const SubscribeToValidateConfigurationUpdatesRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1075,7 +1075,7 @@ namespace Aws static void s_customDeleter(SubscribeToTopicResponse *) noexcept; /* This needs to be defined so that `SubscribeToTopicResponse` can be used as a key in maps. */ bool operator<(const SubscribeToTopicResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1099,7 +1099,7 @@ namespace Aws static void s_customDeleter(SubscribeToTopicRequest *) noexcept; /* This needs to be defined so that `SubscribeToTopicRequest` can be used as a key in maps. */ bool operator<(const SubscribeToTopicRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1121,7 +1121,7 @@ namespace Aws static void s_customDeleter(SubscribeToIoTCoreResponse *) noexcept; /* This needs to be defined so that `SubscribeToIoTCoreResponse` can be used as a key in maps. */ bool operator<(const SubscribeToIoTCoreResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1146,7 +1146,7 @@ namespace Aws static void s_customDeleter(SubscribeToIoTCoreRequest *) noexcept; /* This needs to be defined so that `SubscribeToIoTCoreRequest` can be used as a key in maps. */ bool operator<(const SubscribeToIoTCoreRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1172,7 +1172,7 @@ namespace Aws /* This needs to be defined so that `SubscribeToConfigurationUpdateResponse` can be used as a key in maps. */ bool operator<(const SubscribeToConfigurationUpdateResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1199,7 +1199,7 @@ namespace Aws static void s_customDeleter(SubscribeToConfigurationUpdateRequest *) noexcept; /* This needs to be defined so that `SubscribeToConfigurationUpdateRequest` can be used as a key in maps. */ bool operator<(const SubscribeToConfigurationUpdateRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1222,7 +1222,7 @@ namespace Aws static void s_customDeleter(SubscribeToComponentUpdatesResponse *) noexcept; /* This needs to be defined so that `SubscribeToComponentUpdatesResponse` can be used as a key in maps. */ bool operator<(const SubscribeToComponentUpdatesResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1243,7 +1243,7 @@ namespace Aws static void s_customDeleter(SubscribeToComponentUpdatesRequest *) noexcept; /* This needs to be defined so that `SubscribeToComponentUpdatesRequest` can be used as a key in maps. */ bool operator<(const SubscribeToComponentUpdatesRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1268,7 +1268,7 @@ namespace Aws static void s_customDeleter(StopComponentResponse *) noexcept; /* This needs to be defined so that `StopComponentResponse` can be used as a key in maps. */ bool operator<(const StopComponentResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1293,7 +1293,7 @@ namespace Aws static void s_customDeleter(StopComponentRequest *) noexcept; /* This needs to be defined so that `StopComponentRequest` can be used as a key in maps. */ bool operator<(const StopComponentRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1318,7 +1318,7 @@ namespace Aws /* This needs to be defined so that `SendConfigurationValidityReportResponse` can be used as a key in maps. */ bool operator<(const SendConfigurationValidityReportResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1350,7 +1350,7 @@ namespace Aws /* This needs to be defined so that `SendConfigurationValidityReportRequest` can be used as a key in maps. */ bool operator<(const SendConfigurationValidityReportRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1374,7 +1374,7 @@ namespace Aws static void s_customDeleter(ComponentNotFoundError *) noexcept; /* This needs to be defined so that `ComponentNotFoundError` can be used as a key in maps. */ bool operator<(const ComponentNotFoundError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1400,7 +1400,7 @@ namespace Aws static void s_customDeleter(RestartComponentResponse *) noexcept; /* This needs to be defined so that `RestartComponentResponse` can be used as a key in maps. */ bool operator<(const RestartComponentResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1425,7 +1425,7 @@ namespace Aws static void s_customDeleter(RestartComponentRequest *) noexcept; /* This needs to be defined so that `RestartComponentRequest` can be used as a key in maps. */ bool operator<(const RestartComponentRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1447,7 +1447,7 @@ namespace Aws static void s_customDeleter(PublishToTopicResponse *) noexcept; /* This needs to be defined so that `PublishToTopicResponse` can be used as a key in maps. */ bool operator<(const PublishToTopicResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1472,7 +1472,7 @@ namespace Aws static void s_customDeleter(PublishToTopicRequest *) noexcept; /* This needs to be defined so that `PublishToTopicRequest` can be used as a key in maps. */ bool operator<(const PublishToTopicRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1495,7 +1495,7 @@ namespace Aws static void s_customDeleter(PublishToIoTCoreResponse *) noexcept; /* This needs to be defined so that `PublishToIoTCoreResponse` can be used as a key in maps. */ bool operator<(const PublishToIoTCoreResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1522,7 +1522,7 @@ namespace Aws static void s_customDeleter(PublishToIoTCoreRequest *) noexcept; /* This needs to be defined so that `PublishToIoTCoreRequest` can be used as a key in maps. */ bool operator<(const PublishToIoTCoreRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1552,7 +1552,7 @@ namespace Aws static void s_customDeleter(ListNamedShadowsForThingResponse *) noexcept; /* This needs to be defined so that `ListNamedShadowsForThingResponse` can be used as a key in maps. */ bool operator<(const ListNamedShadowsForThingResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1582,7 +1582,7 @@ namespace Aws static void s_customDeleter(ListNamedShadowsForThingRequest *) noexcept; /* This needs to be defined so that `ListNamedShadowsForThingRequest` can be used as a key in maps. */ bool operator<(const ListNamedShadowsForThingRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1614,7 +1614,7 @@ namespace Aws static void s_customDeleter(ListLocalDeploymentsResponse *) noexcept; /* This needs to be defined so that `ListLocalDeploymentsResponse` can be used as a key in maps. */ bool operator<(const ListLocalDeploymentsResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1636,7 +1636,7 @@ namespace Aws static void s_customDeleter(ListLocalDeploymentsRequest *) noexcept; /* This needs to be defined so that `ListLocalDeploymentsRequest` can be used as a key in maps. */ bool operator<(const ListLocalDeploymentsRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1662,7 +1662,7 @@ namespace Aws static void s_customDeleter(ListComponentsResponse *) noexcept; /* This needs to be defined so that `ListComponentsResponse` can be used as a key in maps. */ bool operator<(const ListComponentsResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1684,7 +1684,7 @@ namespace Aws static void s_customDeleter(ListComponentsRequest *) noexcept; /* This needs to be defined so that `ListComponentsRequest` can be used as a key in maps. */ bool operator<(const ListComponentsRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1707,7 +1707,7 @@ namespace Aws static void s_customDeleter(GetThingShadowResponse *) noexcept; /* This needs to be defined so that `GetThingShadowResponse` can be used as a key in maps. */ bool operator<(const GetThingShadowResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1733,7 +1733,7 @@ namespace Aws static void s_customDeleter(GetThingShadowRequest *) noexcept; /* This needs to be defined so that `GetThingShadowRequest` can be used as a key in maps. */ bool operator<(const GetThingShadowRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1767,7 +1767,7 @@ namespace Aws static void s_customDeleter(GetSecretValueResponse *) noexcept; /* This needs to be defined so that `GetSecretValueResponse` can be used as a key in maps. */ bool operator<(const GetSecretValueResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1798,7 +1798,7 @@ namespace Aws static void s_customDeleter(GetSecretValueRequest *) noexcept; /* This needs to be defined so that `GetSecretValueRequest` can be used as a key in maps. */ bool operator<(const GetSecretValueRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1824,7 +1824,7 @@ namespace Aws static void s_customDeleter(GetLocalDeploymentStatusResponse *) noexcept; /* This needs to be defined so that `GetLocalDeploymentStatusResponse` can be used as a key in maps. */ bool operator<(const GetLocalDeploymentStatusResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1848,7 +1848,7 @@ namespace Aws static void s_customDeleter(GetLocalDeploymentStatusRequest *) noexcept; /* This needs to be defined so that `GetLocalDeploymentStatusRequest` can be used as a key in maps. */ bool operator<(const GetLocalDeploymentStatusRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1874,7 +1874,7 @@ namespace Aws static void s_customDeleter(GetConfigurationResponse *) noexcept; /* This needs to be defined so that `GetConfigurationResponse` can be used as a key in maps. */ bool operator<(const GetConfigurationResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1901,7 +1901,7 @@ namespace Aws static void s_customDeleter(GetConfigurationRequest *) noexcept; /* This needs to be defined so that `GetConfigurationRequest` can be used as a key in maps. */ bool operator<(const GetConfigurationRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1929,7 +1929,7 @@ namespace Aws static void s_customDeleter(GetComponentDetailsResponse *) noexcept; /* This needs to be defined so that `GetComponentDetailsResponse` can be used as a key in maps. */ bool operator<(const GetComponentDetailsResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1953,7 +1953,7 @@ namespace Aws static void s_customDeleter(GetComponentDetailsRequest *) noexcept; /* This needs to be defined so that `GetComponentDetailsRequest` can be used as a key in maps. */ bool operator<(const GetComponentDetailsRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -1977,7 +1977,7 @@ namespace Aws static void s_customDeleter(DeleteThingShadowResponse *) noexcept; /* This needs to be defined so that `DeleteThingShadowResponse` can be used as a key in maps. */ bool operator<(const DeleteThingShadowResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2003,7 +2003,7 @@ namespace Aws static void s_customDeleter(DeleteThingShadowRequest *) noexcept; /* This needs to be defined so that `DeleteThingShadowRequest` can be used as a key in maps. */ bool operator<(const DeleteThingShadowRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2032,7 +2032,7 @@ namespace Aws static void s_customDeleter(ResourceNotFoundError *) noexcept; /* This needs to be defined so that `ResourceNotFoundError` can be used as a key in maps. */ bool operator<(const ResourceNotFoundError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2056,7 +2056,7 @@ namespace Aws static void s_customDeleter(DeferComponentUpdateResponse *) noexcept; /* This needs to be defined so that `DeferComponentUpdateResponse` can be used as a key in maps. */ bool operator<(const DeferComponentUpdateResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2083,7 +2083,7 @@ namespace Aws static void s_customDeleter(DeferComponentUpdateRequest *) noexcept; /* This needs to be defined so that `DeferComponentUpdateRequest` can be used as a key in maps. */ bool operator<(const DeferComponentUpdateRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2109,7 +2109,7 @@ namespace Aws static void s_customDeleter(InvalidArgumentsError *) noexcept; /* This needs to be defined so that `InvalidArgumentsError` can be used as a key in maps. */ bool operator<(const InvalidArgumentsError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2133,7 +2133,7 @@ namespace Aws static void s_customDeleter(InvalidArtifactsDirectoryPathError *) noexcept; /* This needs to be defined so that `InvalidArtifactsDirectoryPathError` can be used as a key in maps. */ bool operator<(const InvalidArtifactsDirectoryPathError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2157,7 +2157,7 @@ namespace Aws static void s_customDeleter(InvalidRecipeDirectoryPathError *) noexcept; /* This needs to be defined so that `InvalidRecipeDirectoryPathError` can be used as a key in maps. */ bool operator<(const InvalidRecipeDirectoryPathError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2181,7 +2181,7 @@ namespace Aws static void s_customDeleter(CreateLocalDeploymentResponse *) noexcept; /* This needs to be defined so that `CreateLocalDeploymentResponse` can be used as a key in maps. */ bool operator<(const CreateLocalDeploymentResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2255,7 +2255,7 @@ namespace Aws static void s_customDeleter(CreateLocalDeploymentRequest *) noexcept; /* This needs to be defined so that `CreateLocalDeploymentRequest` can be used as a key in maps. */ bool operator<(const CreateLocalDeploymentRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2285,7 +2285,7 @@ namespace Aws static void s_customDeleter(ServiceError *) noexcept; /* This needs to be defined so that `ServiceError` can be used as a key in maps. */ bool operator<(const ServiceError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2309,7 +2309,7 @@ namespace Aws static void s_customDeleter(UnauthorizedError *) noexcept; /* This needs to be defined so that `UnauthorizedError` can be used as a key in maps. */ bool operator<(const UnauthorizedError &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2350,7 +2350,7 @@ namespace Aws static void s_customDeleter(CreateDebugPasswordResponse *) noexcept; /* This needs to be defined so that `CreateDebugPasswordResponse` can be used as a key in maps. */ bool operator<(const CreateDebugPasswordResponse &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; @@ -2376,7 +2376,7 @@ namespace Aws static void s_customDeleter(CreateDebugPasswordRequest *) noexcept; /* This needs to be defined so that `CreateDebugPasswordRequest` can be used as a key in maps. */ bool operator<(const CreateDebugPasswordRequest &) const noexcept; - static Aws::Crt::String s_getModelName() noexcept; + static const char *MODEL_NAME; protected: Aws::Crt::String GetModelName() const noexcept override; diff --git a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp index 6f3e3fbcc..b456ae5d1 100644 --- a/greengrass_ipc/source/GreengrassCoreIpcModel.cpp +++ b/greengrass_ipc/source/GreengrassCoreIpcModel.cpp @@ -33,14 +33,11 @@ namespace Aws } } - Aws::Crt::String ValidateConfigurationUpdateEvent::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvent"); - } + const char *ValidateConfigurationUpdateEvent::MODEL_NAME = "aws.greengrass#ValidateConfigurationUpdateEvent"; Aws::Crt::String ValidateConfigurationUpdateEvent::GetModelName() const noexcept { - return ValidateConfigurationUpdateEvent::s_getModelName(); + return ValidateConfigurationUpdateEvent::MODEL_NAME; } Aws::Crt::ScopedResource ValidateConfigurationUpdateEvent::s_allocateFromPayload( @@ -96,12 +93,9 @@ namespace Aws } } - Aws::Crt::String MQTTMessage::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#MQTTMessage"); - } + const char *MQTTMessage::MODEL_NAME = "aws.greengrass#MQTTMessage"; - Aws::Crt::String MQTTMessage::GetModelName() const noexcept { return MQTTMessage::s_getModelName(); } + Aws::Crt::String MQTTMessage::GetModelName() const noexcept { return MQTTMessage::MODEL_NAME; } Aws::Crt::ScopedResource MQTTMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -166,14 +160,11 @@ namespace Aws } } - Aws::Crt::String ConfigurationUpdateEvent::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvent"); - } + const char *ConfigurationUpdateEvent::MODEL_NAME = "aws.greengrass#ConfigurationUpdateEvent"; Aws::Crt::String ConfigurationUpdateEvent::GetModelName() const noexcept { - return ConfigurationUpdateEvent::s_getModelName(); + return ConfigurationUpdateEvent::MODEL_NAME; } Aws::Crt::ScopedResource ConfigurationUpdateEvent::s_allocateFromPayload( @@ -216,14 +207,11 @@ namespace Aws } } - Aws::Crt::String PostComponentUpdateEvent::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PostComponentUpdateEvent"); - } + const char *PostComponentUpdateEvent::MODEL_NAME = "aws.greengrass#PostComponentUpdateEvent"; Aws::Crt::String PostComponentUpdateEvent::GetModelName() const noexcept { - return PostComponentUpdateEvent::s_getModelName(); + return PostComponentUpdateEvent::MODEL_NAME; } Aws::Crt::ScopedResource PostComponentUpdateEvent::s_allocateFromPayload( @@ -275,14 +263,11 @@ namespace Aws } } - Aws::Crt::String PreComponentUpdateEvent::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PreComponentUpdateEvent"); - } + const char *PreComponentUpdateEvent::MODEL_NAME = "aws.greengrass#PreComponentUpdateEvent"; Aws::Crt::String PreComponentUpdateEvent::GetModelName() const noexcept { - return PreComponentUpdateEvent::s_getModelName(); + return PreComponentUpdateEvent::MODEL_NAME; } Aws::Crt::ScopedResource PreComponentUpdateEvent::s_allocateFromPayload( @@ -331,12 +316,9 @@ namespace Aws } } - Aws::Crt::String BinaryMessage::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#BinaryMessage"); - } + const char *BinaryMessage::MODEL_NAME = "aws.greengrass#BinaryMessage"; - Aws::Crt::String BinaryMessage::GetModelName() const noexcept { return BinaryMessage::s_getModelName(); } + Aws::Crt::String BinaryMessage::GetModelName() const noexcept { return BinaryMessage::MODEL_NAME; } Aws::Crt::ScopedResource BinaryMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -376,12 +358,9 @@ namespace Aws } } - Aws::Crt::String JsonMessage::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#JsonMessage"); - } + const char *JsonMessage::MODEL_NAME = "aws.greengrass#JsonMessage"; - Aws::Crt::String JsonMessage::GetModelName() const noexcept { return JsonMessage::s_getModelName(); } + Aws::Crt::String JsonMessage::GetModelName() const noexcept { return JsonMessage::MODEL_NAME; } Aws::Crt::ScopedResource JsonMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -420,12 +399,9 @@ namespace Aws } } - Aws::Crt::String RunWithInfo::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#RunWithInfo"); - } + const char *RunWithInfo::MODEL_NAME = "aws.greengrass#RunWithInfo"; - Aws::Crt::String RunWithInfo::GetModelName() const noexcept { return RunWithInfo::s_getModelName(); } + Aws::Crt::String RunWithInfo::GetModelName() const noexcept { return RunWithInfo::MODEL_NAME; } Aws::Crt::ScopedResource RunWithInfo::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -487,14 +463,11 @@ namespace Aws return *this; } - Aws::Crt::String ValidateConfigurationUpdateEvents::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ValidateConfigurationUpdateEvents"); - } + const char *ValidateConfigurationUpdateEvents::MODEL_NAME = "aws.greengrass#ValidateConfigurationUpdateEvents"; Aws::Crt::String ValidateConfigurationUpdateEvents::GetModelName() const noexcept { - return ValidateConfigurationUpdateEvents::s_getModelName(); + return ValidateConfigurationUpdateEvents::MODEL_NAME; } Aws::Crt::ScopedResource ValidateConfigurationUpdateEvents::s_allocateFromPayload( @@ -571,14 +544,11 @@ namespace Aws return *this; } - Aws::Crt::String SubscriptionResponseMessage::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscriptionResponseMessage"); - } + const char *SubscriptionResponseMessage::MODEL_NAME = "aws.greengrass#SubscriptionResponseMessage"; Aws::Crt::String SubscriptionResponseMessage::GetModelName() const noexcept { - return SubscriptionResponseMessage::s_getModelName(); + return SubscriptionResponseMessage::MODEL_NAME; } Aws::Crt::ScopedResource SubscriptionResponseMessage::s_allocateFromPayload( @@ -634,12 +604,9 @@ namespace Aws return *this; } - Aws::Crt::String IoTCoreMessage::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#IoTCoreMessage"); - } + const char *IoTCoreMessage::MODEL_NAME = "aws.greengrass#IoTCoreMessage"; - Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept { return IoTCoreMessage::s_getModelName(); } + Aws::Crt::String IoTCoreMessage::GetModelName() const noexcept { return IoTCoreMessage::MODEL_NAME; } Aws::Crt::ScopedResource IoTCoreMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -697,14 +664,11 @@ namespace Aws return *this; } - Aws::Crt::String ConfigurationUpdateEvents::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ConfigurationUpdateEvents"); - } + const char *ConfigurationUpdateEvents::MODEL_NAME = "aws.greengrass#ConfigurationUpdateEvents"; Aws::Crt::String ConfigurationUpdateEvents::GetModelName() const noexcept { - return ConfigurationUpdateEvents::s_getModelName(); + return ConfigurationUpdateEvents::MODEL_NAME; } Aws::Crt::ScopedResource ConfigurationUpdateEvents::s_allocateFromPayload( @@ -780,14 +744,11 @@ namespace Aws return *this; } - Aws::Crt::String ComponentUpdatePolicyEvents::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ComponentUpdatePolicyEvents"); - } + const char *ComponentUpdatePolicyEvents::MODEL_NAME = "aws.greengrass#ComponentUpdatePolicyEvents"; Aws::Crt::String ComponentUpdatePolicyEvents::GetModelName() const noexcept { - return ComponentUpdatePolicyEvents::s_getModelName(); + return ComponentUpdatePolicyEvents::MODEL_NAME; } Aws::Crt::ScopedResource ComponentUpdatePolicyEvents::s_allocateFromPayload( @@ -879,14 +840,11 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String ConfigurationValidityReport::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ConfigurationValidityReport"); - } + const char *ConfigurationValidityReport::MODEL_NAME = "aws.greengrass#ConfigurationValidityReport"; Aws::Crt::String ConfigurationValidityReport::GetModelName() const noexcept { - return ConfigurationValidityReport::s_getModelName(); + return ConfigurationValidityReport::MODEL_NAME; } Aws::Crt::ScopedResource ConfigurationValidityReport::s_allocateFromPayload( @@ -961,12 +919,9 @@ namespace Aws return *this; } - Aws::Crt::String PublishMessage::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PublishMessage"); - } + const char *PublishMessage::MODEL_NAME = "aws.greengrass#PublishMessage"; - Aws::Crt::String PublishMessage::GetModelName() const noexcept { return PublishMessage::s_getModelName(); } + Aws::Crt::String PublishMessage::GetModelName() const noexcept { return PublishMessage::MODEL_NAME; } Aws::Crt::ScopedResource PublishMessage::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1037,12 +992,9 @@ namespace Aws return *this; } - Aws::Crt::String SecretValue::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SecretValue"); - } + const char *SecretValue::MODEL_NAME = "aws.greengrass#SecretValue"; - Aws::Crt::String SecretValue::GetModelName() const noexcept { return SecretValue::s_getModelName(); } + Aws::Crt::String SecretValue::GetModelName() const noexcept { return SecretValue::MODEL_NAME; } Aws::Crt::ScopedResource SecretValue::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1137,12 +1089,9 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String LocalDeployment::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#LocalDeployment"); - } + const char *LocalDeployment::MODEL_NAME = "aws.greengrass#LocalDeployment"; - Aws::Crt::String LocalDeployment::GetModelName() const noexcept { return LocalDeployment::s_getModelName(); } + Aws::Crt::String LocalDeployment::GetModelName() const noexcept { return LocalDeployment::MODEL_NAME; } Aws::Crt::ScopedResource LocalDeployment::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1282,12 +1231,9 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String ComponentDetails::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ComponentDetails"); - } + const char *ComponentDetails::MODEL_NAME = "aws.greengrass#ComponentDetails"; - Aws::Crt::String ComponentDetails::GetModelName() const noexcept { return ComponentDetails::s_getModelName(); } + Aws::Crt::String ComponentDetails::GetModelName() const noexcept { return ComponentDetails::MODEL_NAME; } Aws::Crt::ScopedResource ComponentDetails::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1328,15 +1274,9 @@ namespace Aws } } - Aws::Crt::String InvalidTokenError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#InvalidTokenError"); - } + const char *InvalidTokenError::MODEL_NAME = "aws.greengrass#InvalidTokenError"; - Aws::Crt::String InvalidTokenError::GetModelName() const noexcept - { - return InvalidTokenError::s_getModelName(); - } + Aws::Crt::String InvalidTokenError::GetModelName() const noexcept { return InvalidTokenError::MODEL_NAME; } Aws::Crt::ScopedResource InvalidTokenError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1378,14 +1318,12 @@ namespace Aws } } - Aws::Crt::String ValidateAuthorizationTokenResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenResponse"); - } + const char *ValidateAuthorizationTokenResponse::MODEL_NAME = + "aws.greengrass#ValidateAuthorizationTokenResponse"; Aws::Crt::String ValidateAuthorizationTokenResponse::GetModelName() const noexcept { - return ValidateAuthorizationTokenResponse::s_getModelName(); + return ValidateAuthorizationTokenResponse::MODEL_NAME; } Aws::Crt::ScopedResource ValidateAuthorizationTokenResponse::s_allocateFromPayload( @@ -1430,14 +1368,11 @@ namespace Aws } } - Aws::Crt::String ValidateAuthorizationTokenRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ValidateAuthorizationTokenRequest"); - } + const char *ValidateAuthorizationTokenRequest::MODEL_NAME = "aws.greengrass#ValidateAuthorizationTokenRequest"; Aws::Crt::String ValidateAuthorizationTokenRequest::GetModelName() const noexcept { - return ValidateAuthorizationTokenRequest::s_getModelName(); + return ValidateAuthorizationTokenRequest::MODEL_NAME; } Aws::Crt::ScopedResource ValidateAuthorizationTokenRequest::s_allocateFromPayload( @@ -1487,14 +1422,11 @@ namespace Aws } } - Aws::Crt::String UpdateThingShadowResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UpdateThingShadowResponse"); - } + const char *UpdateThingShadowResponse::MODEL_NAME = "aws.greengrass#UpdateThingShadowResponse"; Aws::Crt::String UpdateThingShadowResponse::GetModelName() const noexcept { - return UpdateThingShadowResponse::s_getModelName(); + return UpdateThingShadowResponse::MODEL_NAME; } Aws::Crt::ScopedResource UpdateThingShadowResponse::s_allocateFromPayload( @@ -1561,14 +1493,11 @@ namespace Aws } } - Aws::Crt::String UpdateThingShadowRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UpdateThingShadowRequest"); - } + const char *UpdateThingShadowRequest::MODEL_NAME = "aws.greengrass#UpdateThingShadowRequest"; Aws::Crt::String UpdateThingShadowRequest::GetModelName() const noexcept { - return UpdateThingShadowRequest::s_getModelName(); + return UpdateThingShadowRequest::MODEL_NAME; } Aws::Crt::ScopedResource UpdateThingShadowRequest::s_allocateFromPayload( @@ -1605,15 +1534,9 @@ namespace Aws (void)jsonView; } - Aws::Crt::String UpdateStateResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UpdateStateResponse"); - } + const char *UpdateStateResponse::MODEL_NAME = "aws.greengrass#UpdateStateResponse"; - Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept - { - return UpdateStateResponse::s_getModelName(); - } + Aws::Crt::String UpdateStateResponse::GetModelName() const noexcept { return UpdateStateResponse::MODEL_NAME; } Aws::Crt::ScopedResource UpdateStateResponse::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1685,15 +1608,9 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String UpdateStateRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UpdateStateRequest"); - } + const char *UpdateStateRequest::MODEL_NAME = "aws.greengrass#UpdateStateRequest"; - Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept - { - return UpdateStateRequest::s_getModelName(); - } + Aws::Crt::String UpdateStateRequest::GetModelName() const noexcept { return UpdateStateRequest::MODEL_NAME; } Aws::Crt::ScopedResource UpdateStateRequest::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1735,14 +1652,11 @@ namespace Aws } } - Aws::Crt::String FailedUpdateConditionCheckError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#FailedUpdateConditionCheckError"); - } + const char *FailedUpdateConditionCheckError::MODEL_NAME = "aws.greengrass#FailedUpdateConditionCheckError"; Aws::Crt::String FailedUpdateConditionCheckError::GetModelName() const noexcept { - return FailedUpdateConditionCheckError::s_getModelName(); + return FailedUpdateConditionCheckError::MODEL_NAME; } Aws::Crt::ScopedResource FailedUpdateConditionCheckError::s_allocateFromPayload( @@ -1785,12 +1699,9 @@ namespace Aws } } - Aws::Crt::String ConflictError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ConflictError"); - } + const char *ConflictError::MODEL_NAME = "aws.greengrass#ConflictError"; - Aws::Crt::String ConflictError::GetModelName() const noexcept { return ConflictError::s_getModelName(); } + Aws::Crt::String ConflictError::GetModelName() const noexcept { return ConflictError::MODEL_NAME; } Aws::Crt::ScopedResource ConflictError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -1826,14 +1737,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String UpdateConfigurationResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UpdateConfigurationResponse"); - } + const char *UpdateConfigurationResponse::MODEL_NAME = "aws.greengrass#UpdateConfigurationResponse"; Aws::Crt::String UpdateConfigurationResponse::GetModelName() const noexcept { - return UpdateConfigurationResponse::s_getModelName(); + return UpdateConfigurationResponse::MODEL_NAME; } Aws::Crt::ScopedResource UpdateConfigurationResponse::s_allocateFromPayload( @@ -1908,14 +1816,11 @@ namespace Aws } } - Aws::Crt::String UpdateConfigurationRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UpdateConfigurationRequest"); - } + const char *UpdateConfigurationRequest::MODEL_NAME = "aws.greengrass#UpdateConfigurationRequest"; Aws::Crt::String UpdateConfigurationRequest::GetModelName() const noexcept { - return UpdateConfigurationRequest::s_getModelName(); + return UpdateConfigurationRequest::MODEL_NAME; } Aws::Crt::ScopedResource UpdateConfigurationRequest::s_allocateFromPayload( @@ -1953,14 +1858,12 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToValidateConfigurationUpdatesResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesResponse"); - } + const char *SubscribeToValidateConfigurationUpdatesResponse::MODEL_NAME = + "aws.greengrass#SubscribeToValidateConfigurationUpdatesResponse"; Aws::Crt::String SubscribeToValidateConfigurationUpdatesResponse::GetModelName() const noexcept { - return SubscribeToValidateConfigurationUpdatesResponse::s_getModelName(); + return SubscribeToValidateConfigurationUpdatesResponse::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesResponse:: @@ -1999,14 +1902,12 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToValidateConfigurationUpdatesRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToValidateConfigurationUpdatesRequest"); - } + const char *SubscribeToValidateConfigurationUpdatesRequest::MODEL_NAME = + "aws.greengrass#SubscribeToValidateConfigurationUpdatesRequest"; Aws::Crt::String SubscribeToValidateConfigurationUpdatesRequest::GetModelName() const noexcept { - return SubscribeToValidateConfigurationUpdatesRequest::s_getModelName(); + return SubscribeToValidateConfigurationUpdatesRequest::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToValidateConfigurationUpdatesRequest:: @@ -2050,14 +1951,11 @@ namespace Aws } } - Aws::Crt::String SubscribeToTopicResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToTopicResponse"); - } + const char *SubscribeToTopicResponse::MODEL_NAME = "aws.greengrass#SubscribeToTopicResponse"; Aws::Crt::String SubscribeToTopicResponse::GetModelName() const noexcept { - return SubscribeToTopicResponse::s_getModelName(); + return SubscribeToTopicResponse::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToTopicResponse::s_allocateFromPayload( @@ -2099,14 +1997,11 @@ namespace Aws } } - Aws::Crt::String SubscribeToTopicRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToTopicRequest"); - } + const char *SubscribeToTopicRequest::MODEL_NAME = "aws.greengrass#SubscribeToTopicRequest"; Aws::Crt::String SubscribeToTopicRequest::GetModelName() const noexcept { - return SubscribeToTopicRequest::s_getModelName(); + return SubscribeToTopicRequest::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToTopicRequest::s_allocateFromPayload( @@ -2143,14 +2038,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToIoTCoreResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreResponse"); - } + const char *SubscribeToIoTCoreResponse::MODEL_NAME = "aws.greengrass#SubscribeToIoTCoreResponse"; Aws::Crt::String SubscribeToIoTCoreResponse::GetModelName() const noexcept { - return SubscribeToIoTCoreResponse::s_getModelName(); + return SubscribeToIoTCoreResponse::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToIoTCoreResponse::s_allocateFromPayload( @@ -2232,14 +2124,11 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String SubscribeToIoTCoreRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToIoTCoreRequest"); - } + const char *SubscribeToIoTCoreRequest::MODEL_NAME = "aws.greengrass#SubscribeToIoTCoreRequest"; Aws::Crt::String SubscribeToIoTCoreRequest::GetModelName() const noexcept { - return SubscribeToIoTCoreRequest::s_getModelName(); + return SubscribeToIoTCoreRequest::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToIoTCoreRequest::s_allocateFromPayload( @@ -2277,14 +2166,12 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToConfigurationUpdateResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateResponse"); - } + const char *SubscribeToConfigurationUpdateResponse::MODEL_NAME = + "aws.greengrass#SubscribeToConfigurationUpdateResponse"; Aws::Crt::String SubscribeToConfigurationUpdateResponse::GetModelName() const noexcept { - return SubscribeToConfigurationUpdateResponse::s_getModelName(); + return SubscribeToConfigurationUpdateResponse::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToConfigurationUpdateResponse::s_allocateFromPayload( @@ -2353,14 +2240,12 @@ namespace Aws } } - Aws::Crt::String SubscribeToConfigurationUpdateRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToConfigurationUpdateRequest"); - } + const char *SubscribeToConfigurationUpdateRequest::MODEL_NAME = + "aws.greengrass#SubscribeToConfigurationUpdateRequest"; Aws::Crt::String SubscribeToConfigurationUpdateRequest::GetModelName() const noexcept { - return SubscribeToConfigurationUpdateRequest::s_getModelName(); + return SubscribeToConfigurationUpdateRequest::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToConfigurationUpdateRequest::s_allocateFromPayload( @@ -2400,14 +2285,12 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToComponentUpdatesResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesResponse"); - } + const char *SubscribeToComponentUpdatesResponse::MODEL_NAME = + "aws.greengrass#SubscribeToComponentUpdatesResponse"; Aws::Crt::String SubscribeToComponentUpdatesResponse::GetModelName() const noexcept { - return SubscribeToComponentUpdatesResponse::s_getModelName(); + return SubscribeToComponentUpdatesResponse::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToComponentUpdatesResponse::s_allocateFromPayload( @@ -2446,14 +2329,12 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SubscribeToComponentUpdatesRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SubscribeToComponentUpdatesRequest"); - } + const char *SubscribeToComponentUpdatesRequest::MODEL_NAME = + "aws.greengrass#SubscribeToComponentUpdatesRequest"; Aws::Crt::String SubscribeToComponentUpdatesRequest::GetModelName() const noexcept { - return SubscribeToComponentUpdatesRequest::s_getModelName(); + return SubscribeToComponentUpdatesRequest::MODEL_NAME; } Aws::Crt::ScopedResource SubscribeToComponentUpdatesRequest::s_allocateFromPayload( @@ -2536,14 +2417,11 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String StopComponentResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#StopComponentResponse"); - } + const char *StopComponentResponse::MODEL_NAME = "aws.greengrass#StopComponentResponse"; Aws::Crt::String StopComponentResponse::GetModelName() const noexcept { - return StopComponentResponse::s_getModelName(); + return StopComponentResponse::MODEL_NAME; } Aws::Crt::ScopedResource StopComponentResponse::s_allocateFromPayload( @@ -2586,14 +2464,11 @@ namespace Aws } } - Aws::Crt::String StopComponentRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#StopComponentRequest"); - } + const char *StopComponentRequest::MODEL_NAME = "aws.greengrass#StopComponentRequest"; Aws::Crt::String StopComponentRequest::GetModelName() const noexcept { - return StopComponentRequest::s_getModelName(); + return StopComponentRequest::MODEL_NAME; } Aws::Crt::ScopedResource StopComponentRequest::s_allocateFromPayload( @@ -2631,14 +2506,12 @@ namespace Aws (void)jsonView; } - Aws::Crt::String SendConfigurationValidityReportResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportResponse"); - } + const char *SendConfigurationValidityReportResponse::MODEL_NAME = + "aws.greengrass#SendConfigurationValidityReportResponse"; Aws::Crt::String SendConfigurationValidityReportResponse::GetModelName() const noexcept { - return SendConfigurationValidityReportResponse::s_getModelName(); + return SendConfigurationValidityReportResponse::MODEL_NAME; } Aws::Crt::ScopedResource SendConfigurationValidityReportResponse::s_allocateFromPayload( @@ -2688,14 +2561,12 @@ namespace Aws } } - Aws::Crt::String SendConfigurationValidityReportRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#SendConfigurationValidityReportRequest"); - } + const char *SendConfigurationValidityReportRequest::MODEL_NAME = + "aws.greengrass#SendConfigurationValidityReportRequest"; Aws::Crt::String SendConfigurationValidityReportRequest::GetModelName() const noexcept { - return SendConfigurationValidityReportRequest::s_getModelName(); + return SendConfigurationValidityReportRequest::MODEL_NAME; } Aws::Crt::ScopedResource SendConfigurationValidityReportRequest::s_allocateFromPayload( @@ -2739,14 +2610,11 @@ namespace Aws } } - Aws::Crt::String ComponentNotFoundError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ComponentNotFoundError"); - } + const char *ComponentNotFoundError::MODEL_NAME = "aws.greengrass#ComponentNotFoundError"; Aws::Crt::String ComponentNotFoundError::GetModelName() const noexcept { - return ComponentNotFoundError::s_getModelName(); + return ComponentNotFoundError::MODEL_NAME; } Aws::Crt::ScopedResource ComponentNotFoundError::s_allocateFromPayload( @@ -2829,14 +2697,11 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String RestartComponentResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#RestartComponentResponse"); - } + const char *RestartComponentResponse::MODEL_NAME = "aws.greengrass#RestartComponentResponse"; Aws::Crt::String RestartComponentResponse::GetModelName() const noexcept { - return RestartComponentResponse::s_getModelName(); + return RestartComponentResponse::MODEL_NAME; } Aws::Crt::ScopedResource RestartComponentResponse::s_allocateFromPayload( @@ -2879,14 +2744,11 @@ namespace Aws } } - Aws::Crt::String RestartComponentRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#RestartComponentRequest"); - } + const char *RestartComponentRequest::MODEL_NAME = "aws.greengrass#RestartComponentRequest"; Aws::Crt::String RestartComponentRequest::GetModelName() const noexcept { - return RestartComponentRequest::s_getModelName(); + return RestartComponentRequest::MODEL_NAME; } Aws::Crt::ScopedResource RestartComponentRequest::s_allocateFromPayload( @@ -2923,14 +2785,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String PublishToTopicResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PublishToTopicResponse"); - } + const char *PublishToTopicResponse::MODEL_NAME = "aws.greengrass#PublishToTopicResponse"; Aws::Crt::String PublishToTopicResponse::GetModelName() const noexcept { - return PublishToTopicResponse::s_getModelName(); + return PublishToTopicResponse::MODEL_NAME; } Aws::Crt::ScopedResource PublishToTopicResponse::s_allocateFromPayload( @@ -2984,14 +2843,11 @@ namespace Aws } } - Aws::Crt::String PublishToTopicRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PublishToTopicRequest"); - } + const char *PublishToTopicRequest::MODEL_NAME = "aws.greengrass#PublishToTopicRequest"; Aws::Crt::String PublishToTopicRequest::GetModelName() const noexcept { - return PublishToTopicRequest::s_getModelName(); + return PublishToTopicRequest::MODEL_NAME; } Aws::Crt::ScopedResource PublishToTopicRequest::s_allocateFromPayload( @@ -3028,14 +2884,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String PublishToIoTCoreResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PublishToIoTCoreResponse"); - } + const char *PublishToIoTCoreResponse::MODEL_NAME = "aws.greengrass#PublishToIoTCoreResponse"; Aws::Crt::String PublishToIoTCoreResponse::GetModelName() const noexcept { - return PublishToIoTCoreResponse::s_getModelName(); + return PublishToIoTCoreResponse::MODEL_NAME; } Aws::Crt::ScopedResource PublishToIoTCoreResponse::s_allocateFromPayload( @@ -3132,14 +2985,11 @@ namespace Aws return Aws::Crt::Optional(); } - Aws::Crt::String PublishToIoTCoreRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#PublishToIoTCoreRequest"); - } + const char *PublishToIoTCoreRequest::MODEL_NAME = "aws.greengrass#PublishToIoTCoreRequest"; Aws::Crt::String PublishToIoTCoreRequest::GetModelName() const noexcept { - return PublishToIoTCoreRequest::s_getModelName(); + return PublishToIoTCoreRequest::MODEL_NAME; } Aws::Crt::ScopedResource PublishToIoTCoreRequest::s_allocateFromPayload( @@ -3214,14 +3064,11 @@ namespace Aws } } - Aws::Crt::String ListNamedShadowsForThingResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingResponse"); - } + const char *ListNamedShadowsForThingResponse::MODEL_NAME = "aws.greengrass#ListNamedShadowsForThingResponse"; Aws::Crt::String ListNamedShadowsForThingResponse::GetModelName() const noexcept { - return ListNamedShadowsForThingResponse::s_getModelName(); + return ListNamedShadowsForThingResponse::MODEL_NAME; } Aws::Crt::ScopedResource ListNamedShadowsForThingResponse::s_allocateFromPayload( @@ -3282,14 +3129,11 @@ namespace Aws } } - Aws::Crt::String ListNamedShadowsForThingRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ListNamedShadowsForThingRequest"); - } + const char *ListNamedShadowsForThingRequest::MODEL_NAME = "aws.greengrass#ListNamedShadowsForThingRequest"; Aws::Crt::String ListNamedShadowsForThingRequest::GetModelName() const noexcept { - return ListNamedShadowsForThingRequest::s_getModelName(); + return ListNamedShadowsForThingRequest::MODEL_NAME; } Aws::Crt::ScopedResource ListNamedShadowsForThingRequest::s_allocateFromPayload( @@ -3350,14 +3194,11 @@ namespace Aws } } - Aws::Crt::String ListLocalDeploymentsResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsResponse"); - } + const char *ListLocalDeploymentsResponse::MODEL_NAME = "aws.greengrass#ListLocalDeploymentsResponse"; Aws::Crt::String ListLocalDeploymentsResponse::GetModelName() const noexcept { - return ListLocalDeploymentsResponse::s_getModelName(); + return ListLocalDeploymentsResponse::MODEL_NAME; } Aws::Crt::ScopedResource ListLocalDeploymentsResponse::s_allocateFromPayload( @@ -3394,14 +3235,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String ListLocalDeploymentsRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ListLocalDeploymentsRequest"); - } + const char *ListLocalDeploymentsRequest::MODEL_NAME = "aws.greengrass#ListLocalDeploymentsRequest"; Aws::Crt::String ListLocalDeploymentsRequest::GetModelName() const noexcept { - return ListLocalDeploymentsRequest::s_getModelName(); + return ListLocalDeploymentsRequest::MODEL_NAME; } Aws::Crt::ScopedResource ListLocalDeploymentsRequest::s_allocateFromPayload( @@ -3459,14 +3297,11 @@ namespace Aws } } - Aws::Crt::String ListComponentsResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ListComponentsResponse"); - } + const char *ListComponentsResponse::MODEL_NAME = "aws.greengrass#ListComponentsResponse"; Aws::Crt::String ListComponentsResponse::GetModelName() const noexcept { - return ListComponentsResponse::s_getModelName(); + return ListComponentsResponse::MODEL_NAME; } Aws::Crt::ScopedResource ListComponentsResponse::s_allocateFromPayload( @@ -3503,14 +3338,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String ListComponentsRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ListComponentsRequest"); - } + const char *ListComponentsRequest::MODEL_NAME = "aws.greengrass#ListComponentsRequest"; Aws::Crt::String ListComponentsRequest::GetModelName() const noexcept { - return ListComponentsRequest::s_getModelName(); + return ListComponentsRequest::MODEL_NAME; } Aws::Crt::ScopedResource ListComponentsRequest::s_allocateFromPayload( @@ -3559,14 +3391,11 @@ namespace Aws } } - Aws::Crt::String GetThingShadowResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetThingShadowResponse"); - } + const char *GetThingShadowResponse::MODEL_NAME = "aws.greengrass#GetThingShadowResponse"; Aws::Crt::String GetThingShadowResponse::GetModelName() const noexcept { - return GetThingShadowResponse::s_getModelName(); + return GetThingShadowResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetThingShadowResponse::s_allocateFromPayload( @@ -3618,14 +3447,11 @@ namespace Aws } } - Aws::Crt::String GetThingShadowRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetThingShadowRequest"); - } + const char *GetThingShadowRequest::MODEL_NAME = "aws.greengrass#GetThingShadowRequest"; Aws::Crt::String GetThingShadowRequest::GetModelName() const noexcept { - return GetThingShadowRequest::s_getModelName(); + return GetThingShadowRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetThingShadowRequest::s_allocateFromPayload( @@ -3712,14 +3538,11 @@ namespace Aws } } - Aws::Crt::String GetSecretValueResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetSecretValueResponse"); - } + const char *GetSecretValueResponse::MODEL_NAME = "aws.greengrass#GetSecretValueResponse"; Aws::Crt::String GetSecretValueResponse::GetModelName() const noexcept { - return GetSecretValueResponse::s_getModelName(); + return GetSecretValueResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetSecretValueResponse::s_allocateFromPayload( @@ -3779,14 +3602,11 @@ namespace Aws } } - Aws::Crt::String GetSecretValueRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetSecretValueRequest"); - } + const char *GetSecretValueRequest::MODEL_NAME = "aws.greengrass#GetSecretValueRequest"; Aws::Crt::String GetSecretValueRequest::GetModelName() const noexcept { - return GetSecretValueRequest::s_getModelName(); + return GetSecretValueRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetSecretValueRequest::s_allocateFromPayload( @@ -3832,14 +3652,11 @@ namespace Aws } } - Aws::Crt::String GetLocalDeploymentStatusResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusResponse"); - } + const char *GetLocalDeploymentStatusResponse::MODEL_NAME = "aws.greengrass#GetLocalDeploymentStatusResponse"; Aws::Crt::String GetLocalDeploymentStatusResponse::GetModelName() const noexcept { - return GetLocalDeploymentStatusResponse::s_getModelName(); + return GetLocalDeploymentStatusResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetLocalDeploymentStatusResponse::s_allocateFromPayload( @@ -3883,14 +3700,11 @@ namespace Aws } } - Aws::Crt::String GetLocalDeploymentStatusRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetLocalDeploymentStatusRequest"); - } + const char *GetLocalDeploymentStatusRequest::MODEL_NAME = "aws.greengrass#GetLocalDeploymentStatusRequest"; Aws::Crt::String GetLocalDeploymentStatusRequest::GetModelName() const noexcept { - return GetLocalDeploymentStatusRequest::s_getModelName(); + return GetLocalDeploymentStatusRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetLocalDeploymentStatusRequest::s_allocateFromPayload( @@ -3943,14 +3757,11 @@ namespace Aws } } - Aws::Crt::String GetConfigurationResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetConfigurationResponse"); - } + const char *GetConfigurationResponse::MODEL_NAME = "aws.greengrass#GetConfigurationResponse"; Aws::Crt::String GetConfigurationResponse::GetModelName() const noexcept { - return GetConfigurationResponse::s_getModelName(); + return GetConfigurationResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetConfigurationResponse::s_allocateFromPayload( @@ -4016,14 +3827,11 @@ namespace Aws } } - Aws::Crt::String GetConfigurationRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetConfigurationRequest"); - } + const char *GetConfigurationRequest::MODEL_NAME = "aws.greengrass#GetConfigurationRequest"; Aws::Crt::String GetConfigurationRequest::GetModelName() const noexcept { - return GetConfigurationRequest::s_getModelName(); + return GetConfigurationRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetConfigurationRequest::s_allocateFromPayload( @@ -4069,14 +3877,11 @@ namespace Aws } } - Aws::Crt::String GetComponentDetailsResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetComponentDetailsResponse"); - } + const char *GetComponentDetailsResponse::MODEL_NAME = "aws.greengrass#GetComponentDetailsResponse"; Aws::Crt::String GetComponentDetailsResponse::GetModelName() const noexcept { - return GetComponentDetailsResponse::s_getModelName(); + return GetComponentDetailsResponse::MODEL_NAME; } Aws::Crt::ScopedResource GetComponentDetailsResponse::s_allocateFromPayload( @@ -4119,14 +3924,11 @@ namespace Aws } } - Aws::Crt::String GetComponentDetailsRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#GetComponentDetailsRequest"); - } + const char *GetComponentDetailsRequest::MODEL_NAME = "aws.greengrass#GetComponentDetailsRequest"; Aws::Crt::String GetComponentDetailsRequest::GetModelName() const noexcept { - return GetComponentDetailsRequest::s_getModelName(); + return GetComponentDetailsRequest::MODEL_NAME; } Aws::Crt::ScopedResource GetComponentDetailsRequest::s_allocateFromPayload( @@ -4175,14 +3977,11 @@ namespace Aws } } - Aws::Crt::String DeleteThingShadowResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#DeleteThingShadowResponse"); - } + const char *DeleteThingShadowResponse::MODEL_NAME = "aws.greengrass#DeleteThingShadowResponse"; Aws::Crt::String DeleteThingShadowResponse::GetModelName() const noexcept { - return DeleteThingShadowResponse::s_getModelName(); + return DeleteThingShadowResponse::MODEL_NAME; } Aws::Crt::ScopedResource DeleteThingShadowResponse::s_allocateFromPayload( @@ -4234,14 +4033,11 @@ namespace Aws } } - Aws::Crt::String DeleteThingShadowRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#DeleteThingShadowRequest"); - } + const char *DeleteThingShadowRequest::MODEL_NAME = "aws.greengrass#DeleteThingShadowRequest"; Aws::Crt::String DeleteThingShadowRequest::GetModelName() const noexcept { - return DeleteThingShadowRequest::s_getModelName(); + return DeleteThingShadowRequest::MODEL_NAME; } Aws::Crt::ScopedResource DeleteThingShadowRequest::s_allocateFromPayload( @@ -4301,14 +4097,11 @@ namespace Aws } } - Aws::Crt::String ResourceNotFoundError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ResourceNotFoundError"); - } + const char *ResourceNotFoundError::MODEL_NAME = "aws.greengrass#ResourceNotFoundError"; Aws::Crt::String ResourceNotFoundError::GetModelName() const noexcept { - return ResourceNotFoundError::s_getModelName(); + return ResourceNotFoundError::MODEL_NAME; } Aws::Crt::ScopedResource ResourceNotFoundError::s_allocateFromPayload( @@ -4345,14 +4138,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String DeferComponentUpdateResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#DeferComponentUpdateResponse"); - } + const char *DeferComponentUpdateResponse::MODEL_NAME = "aws.greengrass#DeferComponentUpdateResponse"; Aws::Crt::String DeferComponentUpdateResponse::GetModelName() const noexcept { - return DeferComponentUpdateResponse::s_getModelName(); + return DeferComponentUpdateResponse::MODEL_NAME; } Aws::Crt::ScopedResource DeferComponentUpdateResponse::s_allocateFromPayload( @@ -4413,14 +4203,11 @@ namespace Aws } } - Aws::Crt::String DeferComponentUpdateRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#DeferComponentUpdateRequest"); - } + const char *DeferComponentUpdateRequest::MODEL_NAME = "aws.greengrass#DeferComponentUpdateRequest"; Aws::Crt::String DeferComponentUpdateRequest::GetModelName() const noexcept { - return DeferComponentUpdateRequest::s_getModelName(); + return DeferComponentUpdateRequest::MODEL_NAME; } Aws::Crt::ScopedResource DeferComponentUpdateRequest::s_allocateFromPayload( @@ -4462,14 +4249,11 @@ namespace Aws } } - Aws::Crt::String InvalidArgumentsError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#InvalidArgumentsError"); - } + const char *InvalidArgumentsError::MODEL_NAME = "aws.greengrass#InvalidArgumentsError"; Aws::Crt::String InvalidArgumentsError::GetModelName() const noexcept { - return InvalidArgumentsError::s_getModelName(); + return InvalidArgumentsError::MODEL_NAME; } Aws::Crt::ScopedResource InvalidArgumentsError::s_allocateFromPayload( @@ -4513,14 +4297,12 @@ namespace Aws } } - Aws::Crt::String InvalidArtifactsDirectoryPathError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#InvalidArtifactsDirectoryPathError"); - } + const char *InvalidArtifactsDirectoryPathError::MODEL_NAME = + "aws.greengrass#InvalidArtifactsDirectoryPathError"; Aws::Crt::String InvalidArtifactsDirectoryPathError::GetModelName() const noexcept { - return InvalidArtifactsDirectoryPathError::s_getModelName(); + return InvalidArtifactsDirectoryPathError::MODEL_NAME; } Aws::Crt::ScopedResource InvalidArtifactsDirectoryPathError::s_allocateFromPayload( @@ -4564,14 +4346,11 @@ namespace Aws } } - Aws::Crt::String InvalidRecipeDirectoryPathError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#InvalidRecipeDirectoryPathError"); - } + const char *InvalidRecipeDirectoryPathError::MODEL_NAME = "aws.greengrass#InvalidRecipeDirectoryPathError"; Aws::Crt::String InvalidRecipeDirectoryPathError::GetModelName() const noexcept { - return InvalidRecipeDirectoryPathError::s_getModelName(); + return InvalidRecipeDirectoryPathError::MODEL_NAME; } Aws::Crt::ScopedResource InvalidRecipeDirectoryPathError::s_allocateFromPayload( @@ -4615,14 +4394,11 @@ namespace Aws } } - Aws::Crt::String CreateLocalDeploymentResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentResponse"); - } + const char *CreateLocalDeploymentResponse::MODEL_NAME = "aws.greengrass#CreateLocalDeploymentResponse"; Aws::Crt::String CreateLocalDeploymentResponse::GetModelName() const noexcept { - return CreateLocalDeploymentResponse::s_getModelName(); + return CreateLocalDeploymentResponse::MODEL_NAME; } Aws::Crt::ScopedResource CreateLocalDeploymentResponse::s_allocateFromPayload( @@ -4785,14 +4561,11 @@ namespace Aws } } - Aws::Crt::String CreateLocalDeploymentRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#CreateLocalDeploymentRequest"); - } + const char *CreateLocalDeploymentRequest::MODEL_NAME = "aws.greengrass#CreateLocalDeploymentRequest"; Aws::Crt::String CreateLocalDeploymentRequest::GetModelName() const noexcept { - return CreateLocalDeploymentRequest::s_getModelName(); + return CreateLocalDeploymentRequest::MODEL_NAME; } Aws::Crt::ScopedResource CreateLocalDeploymentRequest::s_allocateFromPayload( @@ -4832,12 +4605,9 @@ namespace Aws } } - Aws::Crt::String ServiceError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#ServiceError"); - } + const char *ServiceError::MODEL_NAME = "aws.greengrass#ServiceError"; - Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::s_getModelName(); } + Aws::Crt::String ServiceError::GetModelName() const noexcept { return ServiceError::MODEL_NAME; } Aws::Crt::ScopedResource ServiceError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -4878,15 +4648,9 @@ namespace Aws } } - Aws::Crt::String UnauthorizedError::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#UnauthorizedError"); - } + const char *UnauthorizedError::MODEL_NAME = "aws.greengrass#UnauthorizedError"; - Aws::Crt::String UnauthorizedError::GetModelName() const noexcept - { - return UnauthorizedError::s_getModelName(); - } + Aws::Crt::String UnauthorizedError::GetModelName() const noexcept { return UnauthorizedError::MODEL_NAME; } Aws::Crt::ScopedResource UnauthorizedError::s_allocateFromPayload( Aws::Crt::StringView stringView, @@ -4964,14 +4728,11 @@ namespace Aws } } - Aws::Crt::String CreateDebugPasswordResponse::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#CreateDebugPasswordResponse"); - } + const char *CreateDebugPasswordResponse::MODEL_NAME = "aws.greengrass#CreateDebugPasswordResponse"; Aws::Crt::String CreateDebugPasswordResponse::GetModelName() const noexcept { - return CreateDebugPasswordResponse::s_getModelName(); + return CreateDebugPasswordResponse::MODEL_NAME; } Aws::Crt::ScopedResource CreateDebugPasswordResponse::s_allocateFromPayload( @@ -5008,14 +4769,11 @@ namespace Aws (void)jsonView; } - Aws::Crt::String CreateDebugPasswordRequest::s_getModelName() noexcept - { - return Aws::Crt::String("aws.greengrass#CreateDebugPasswordRequest"); - } + const char *CreateDebugPasswordRequest::MODEL_NAME = "aws.greengrass#CreateDebugPasswordRequest"; Aws::Crt::String CreateDebugPasswordRequest::GetModelName() const noexcept { - return CreateDebugPasswordRequest::s_getModelName(); + return CreateDebugPasswordRequest::MODEL_NAME; } Aws::Crt::ScopedResource CreateDebugPasswordRequest::s_allocateFromPayload( diff --git a/samples/greengrass/ipc/main.cpp b/samples/greengrass/ipc/main.cpp index 21b05f959..fe06b2352 100644 --- a/samples/greengrass/ipc/main.cpp +++ b/samples/greengrass/ipc/main.cpp @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) auto subscribeResultFuture = subscribeOperation.GetResult(); /* // To avoid throwing exceptions, wait on the result for a specified timeout: - if (subscribeResultFuture.wait_for(std::chrono::seconds(10)) != std::future_status::ready) + if (subscribeResultFuture.wait_for(std::chrono::seconds(10)) == std::future_status::timeout) { fprintf(stderr, "Timed out while waiting for response from Greengrass Core\n"); exit(-1); @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) OperationError *error = subscribeResult.GetOperationError(); /* * This pointer can be casted to any error type like so: - * if(error->GetModelName() == UnauthorizedError::s_getModelName()) + * if(error->GetModelName() == UnauthorizedError::MODEL_NAME) * UnauthorizedError *unauthorizedError = static_cast(error); */ if (error->GetMessage().has_value()) @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) auto publishResultFuture = publishOperation.GetResult(); /* // To avoid throwing exceptions, wait on the result for a specified timeout: - if (publishResultFuture.wait_for(std::chrono::seconds(10)) != std::future_status::ready) + if (publishResultFuture.wait_for(std::chrono::seconds(10)) == std::future_status::timeout) { fprintf(stderr, "Timed out while waiting for response from Greengrass Core\n"); exit(-1); @@ -241,7 +241,7 @@ int main(int argc, char *argv[]) OperationError *error = publishResult.GetOperationError(); /* * This pointer can be casted to any error type like so: - * if(error->GetModelName() == UnauthorizedError::s_getModelName()) + * if(error->GetModelName() == UnauthorizedError::MODEL_NAME) * UnauthorizedError *unauthorizedError = static_cast(error); */ if (error->GetMessage().has_value()) From ee21b1875f19e9ecf421a4b32060b5d832c6f2d2 Mon Sep 17 00:00:00 2001 From: Oscar Abrina Date: Fri, 9 Jul 2021 16:04:03 -0700 Subject: [PATCH 17/17] Update aws-crt-cpp to latest release to support millisecond precision in datetime --- crt/aws-crt-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index a40d8831b..19c3710f7 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit a40d8831be6bd4b411264ca52168a776b5c05b9b +Subproject commit 19c3710f7e56542ef4240b41be967c1b513d430c