Skip to content

Commit

Permalink
Update Greengrass V2 IPC models (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDombo authored Jun 23, 2022
1 parent 14d264d commit b90ff7d
Show file tree
Hide file tree
Showing 6 changed files with 2,737 additions and 686 deletions.
10 changes: 4 additions & 6 deletions eventstream_rpc/tests/include/awstest/EchoTestRpcClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ namespace Awstest
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.
* @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<RpcError> Connect(
ConnectionLifecycleHandler &lifecycleHandler,
Expand Down
105 changes: 35 additions & 70 deletions eventstream_rpc/tests/include/awstest/EchoTestRpcModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ namespace Awstest
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.
*/
/* This needs to be defined so that `Customer` can be used as a key in maps. */
bool operator<(const Customer &) const noexcept;
static const char *MODEL_NAME;

Expand Down Expand Up @@ -159,8 +158,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `MessageData` can be used as a key in maps. */
bool operator<(const MessageData &) const noexcept;
static const char *MODEL_NAME;

Expand Down Expand Up @@ -223,8 +221,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `EchoStreamingMessage` can be used as a key in maps. */
bool operator<(const EchoStreamingMessage &) const noexcept;
static const char *MODEL_NAME;

Expand Down Expand Up @@ -254,8 +251,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `GetAllProductsResponse` can be used as a key in maps. */
bool operator<(const GetAllProductsResponse &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -277,8 +273,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `GetAllProductsRequest` can be used as a key in maps. */
bool operator<(const GetAllProductsRequest &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -301,8 +296,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `GetAllCustomersResponse` can be used as a key in maps. */
bool operator<(const GetAllCustomersResponse &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -324,8 +318,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `GetAllCustomersRequest` can be used as a key in maps. */
bool operator<(const GetAllCustomersRequest &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -348,8 +341,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `EchoMessageResponse` can be used as a key in maps. */
bool operator<(const EchoMessageResponse &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -373,8 +365,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `EchoMessageRequest` can be used as a key in maps. */
bool operator<(const EchoMessageRequest &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -396,8 +387,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `EchoStreamingResponse` can be used as a key in maps. */
bool operator<(const EchoStreamingResponse &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -418,8 +408,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `EchoStreamingRequest` can be used as a key in maps. */
bool operator<(const EchoStreamingRequest &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -444,8 +433,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `ServiceError` can be used as a key in maps. */
bool operator<(const ServiceError &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -468,8 +456,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `CauseServiceErrorResponse` can be used as a key in maps. */
bool operator<(const CauseServiceErrorResponse &) const noexcept;
static const char *MODEL_NAME;

Expand All @@ -490,8 +477,7 @@ namespace Awstest
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. */
/* This needs to be defined so that `CauseServiceErrorRequest` can be used as a key in maps. */
bool operator<(const CauseServiceErrorRequest &) const noexcept;
static const char *MODEL_NAME;

Expand Down Expand Up @@ -549,10 +535,8 @@ namespace Awstest
/**
* 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.
* @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<RpcError> Activate(
const GetAllProductsRequest &request,
Expand Down Expand Up @@ -614,10 +598,8 @@ namespace Awstest
/**
* 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.
* @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<RpcError> Activate(
const CauseServiceErrorRequest &request,
Expand All @@ -637,10 +619,8 @@ namespace Awstest
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.
* 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)
{
Expand All @@ -659,8 +639,7 @@ namespace Awstest
}

/**
* A callback that is invoked upon receiving ANY 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)
Expand All @@ -675,8 +654,7 @@ namespace Awstest
*/
void OnStreamEvent(Aws::Crt::ScopedResource<AbstractShapeBase> response) override;
/**
* Invoked when a message is received on this continuation but results in an
* error.
* 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.
*/
Expand Down Expand Up @@ -732,12 +710,9 @@ namespace Awstest
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.
* @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<RpcError> Activate(
const EchoStreamingRequest &request,
Expand All @@ -757,10 +732,8 @@ namespace Awstest
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.
* 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)
{
Expand All @@ -769,8 +742,7 @@ namespace Awstest
}

/**
* A callback that is invoked upon receiving ANY 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)
Expand All @@ -785,8 +757,7 @@ namespace Awstest
*/
void OnStreamEvent(Aws::Crt::ScopedResource<AbstractShapeBase> response) override;
/**
* Invoked when a message is received on this continuation but results in an
* error.
* 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.
*/
Expand Down Expand Up @@ -841,10 +812,8 @@ namespace Awstest
/**
* 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.
* @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<RpcError> Activate(
const EchoStreamingRequest &request,
Expand Down Expand Up @@ -906,10 +875,8 @@ namespace Awstest
/**
* 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.
* @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<RpcError> Activate(
const EchoMessageRequest &request,
Expand Down Expand Up @@ -971,10 +938,8 @@ namespace Awstest
/**
* 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.
* @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<RpcError> Activate(
const GetAllCustomersRequest &request,
Expand Down
19 changes: 13 additions & 6 deletions greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ namespace Aws
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.
* @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<RpcError> Connect(
ConnectionLifecycleHandler &lifecycleHandler,
Expand Down Expand Up @@ -67,8 +65,17 @@ namespace Aws

std::shared_ptr<GetComponentDetailsOperation> NewGetComponentDetails() noexcept;

std::shared_ptr<GetClientDeviceAuthTokenOperation> NewGetClientDeviceAuthToken() noexcept;

std::shared_ptr<PublishToTopicOperation> NewPublishToTopic() noexcept;

std::shared_ptr<SubscribeToCertificateUpdatesOperation> NewSubscribeToCertificateUpdates(
std::shared_ptr<SubscribeToCertificateUpdatesStreamHandler> streamHandler) noexcept;

std::shared_ptr<VerifyClientDeviceIdentityOperation> NewVerifyClientDeviceIdentity() noexcept;

std::shared_ptr<AuthorizeClientDeviceActionOperation> NewAuthorizeClientDeviceAction() noexcept;

std::shared_ptr<ListComponentsOperation> NewListComponents() noexcept;

std::shared_ptr<CreateDebugPasswordOperation> NewCreateDebugPassword() noexcept;
Expand Down
Loading

0 comments on commit b90ff7d

Please sign in to comment.