AWS IoT Device SDK C++ v2
1.39.0
AWS IoT Device SDK C++ v2
|
Go to the documentation of this file.
16 #include <aws/event-stream/event_stream_rpc_client.h>
27 class ClientBootstrap;
30 namespace Eventstreamrpc
63 const struct aws_event_stream_header_value_pair &header,
76 bool GetValueAsString(
Crt::String &)
const noexcept;
78 const struct aws_event_stream_header_value_pair *GetUnderlyingHandle()
const;
83 struct aws_event_stream_header_value_pair m_underlyingHandle;
162 ConnectionConfig() noexcept : m_clientBootstrap(
nullptr), m_connectRequestCallback(
nullptr) {}
169 return m_tlsConnectionOptions;
179 void SetPort(uint32_t port) noexcept { m_port = port; }
182 m_socketOptions = socketOptions;
186 m_connectAmendment = connectAmendment;
190 m_tlsConnectionOptions = std::move(tlsConnectionOptions);
194 m_clientBootstrap = clientBootstrap;
198 m_connectRequestCallback = std::move(connectRequestCallback);
205 Crt::Optional<uint32_t> m_port;
206 Crt::Optional<Crt::Io::SocketOptions> m_socketOptions;
207 Crt::Optional<Crt::Io::TlsConnectionOptions> m_tlsConnectionOptions;
208 Crt::Io::ClientBootstrap *m_clientBootstrap;
235 virtual
void OnConnectCallback();
242 virtual
void OnDisconnectCallback(
RpcError status);
249 virtual
bool OnErrorCallback(
RpcError status);
255 virtual
void OnPingCallback(
257 const Crt::Optional<Crt::
ByteBuf> &payload);
278 std::future<RpcError> Connect(
286 std::shared_ptr<ClientContinuationImpl> NewStream() noexcept;
291 void Close() noexcept;
297 bool IsOpen()
const noexcept;
300 std::shared_ptr<ClientConnectionImpl> m_impl;
322 virtual
void SerializeToJsonObject(Crt::JsonObject &payloadObject) const = 0;
323 virtual Crt::
String GetModelName() const noexcept = 0;
337 void SerializeToJsonObject(Crt::JsonObject &payloadObject) const override;
338 virtual Crt::Optional<Crt::
String> GetMessage() const noexcept = 0;
354 virtual
void OnStreamClosed();
421 const Crt::
String &modelName) const noexcept = 0;
423 const Crt::
String &modelName) const noexcept = 0;
425 const Crt::
String &modelName) const noexcept = 0;
433 const Crt::
String &errorModelName,
435 Crt::
Allocator *allocator) const noexcept = 0;
456 Crt::
Allocator *allocator) const noexcept = 0;
466 Crt::
Allocator *allocator) const noexcept = 0;
472 virtual Crt::
String GetInitialResponseModelName() const noexcept = 0;
478 virtual Crt::
String GetRequestModelName() const noexcept = 0;
484 virtual Crt::Optional<Crt::
String> GetStreamingResponseModelName() const noexcept = 0;
492 virtual Crt::
String GetOperationName() const noexcept = 0;
502 const Crt::
String &errorModelName,
504 Crt::
Allocator *allocator) const noexcept
506 return m_serviceModel.AllocateOperationErrorFromPayload(errorModelName, stringView, allocator);
521 std::shared_ptr<StreamResponseHandler> streamHandler,
522 const std::shared_ptr<OperationModelContext> &operationModelContext,
547 void WithLaunchMode(
std::launch mode) noexcept;
579 virtual Crt::
String GetModelName() const noexcept;
@ EVENT_STREAM_RPC_CONTINUATION_CLOSED
Definition: EventStreamClient.h:148
Crt::Io::ClientBootstrap * GetClientBootstrap() const noexcept
Definition: EventStreamClient.h:171
Definition: EventStreamClient.h:214
~EventstreamResultVariantType()=default
void SetSocketOptions(const Crt::Io::SocketOptions &socketOptions) noexcept
Definition: EventStreamClient.h:180
@ EVENT_STREAM_RPC_CRT_ERROR
Definition: EventStreamClient.h:152
Definition: EventStreamClient.h:226
Definition: EventStreamClient.h:333
@ RPC_ERROR
Definition: EventStreamClient.h:375
@ NONE
Definition: EventStreamClient.h:372
@ EVENT_STREAM_RPC_ALLOCATION_ERROR
Definition: EventStreamClient.h:143
ResultType GetType() const
Definition: EventStreamClient.h:390
std::function< ExpectedResponseFactory(const Crt::String &modelName)> LoneResponseRetriever
Definition: EventStreamClient.h:411
std::unique_ptr< T, std::function< void(T *)> > ScopedResource
Definition: Types.h:163
@ EVENT_STREAM_RPC_CONNECTION_CLOSED
Definition: EventStreamClient.h:147
EventStreamRpcStatusCode
Definition: EventStreamClient.h:139
int crtError
Definition: EventStreamClient.h:219
OnMessageFlushCallback GetConnectRequestCallback() const noexcept
Definition: EventStreamClient.h:172
bool operator=(const ClientOperation &clientOperation) noexcept=delete
aws_event_stream_header_value_type HeaderValueType
Definition: EventStreamClient.h:38
void SetConnectAmendment(const MessageAmendment &connectAmendment) noexcept
Definition: EventStreamClient.h:184
std::list< T, StlAllocator< T > > List
Definition: Types.h:54
std::function< ExpectedResponseFactory(const Crt::String &modelName)> StreamingResponseRetriever
Definition: EventStreamClient.h:412
Definition: TlsOptions.h:293
@ OPERATION_ERROR
Definition: EventStreamClient.h:374
Definition: EventStreamClient.h:267
ClientOperation(ClientOperation &&clientOperation) noexcept=delete
virtual ~ServiceModel() noexcept=default
@ EVENT_STREAM_RPC_UNMAPPED_DATA
Definition: EventStreamClient.h:150
@ EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED
Definition: EventStreamClient.h:146
Definition: EventStreamClient.cpp:697
bool operator=(ClientOperation &&clientOperation) noexcept=delete
Definition: EventStreamClient.h:308
Definition: EventStreamClient.h:160
Definition: EventStreamClient.h:347
@ EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED
Definition: EventStreamClient.h:144
virtual ~ClientContinuationHandler() noexcept=default
EventStreamRpcStatusCode baseStatus
Definition: EventStreamClient.h:218
ClientOperation(const ClientOperation &clientOperation) noexcept=delete
ConnectMessageAmender GetConnectMessageAmender() const noexcept
Definition: EventStreamClient.h:173
virtual ~OperationModelContext() noexcept=default
virtual ~AbstractShapeBase() noexcept=default
Definition: EventStreamClient.h:416
Crt::Optional< Crt::Io::TlsConnectionOptions > GetTlsConnectionOptions() const noexcept
Definition: EventStreamClient.h:167
std::function< const MessageAmendment &(void)> ConnectMessageAmender
Definition: EventStreamClient.h:52
ConnectionConfig() noexcept
Definition: EventStreamClient.h:162
void SetPort(uint32_t port) noexcept
Definition: EventStreamClient.h:179
std::function< Crt::ScopedResource< OperationError >(const Crt::StringView &payload, Crt::Allocator *allocator)> ErrorResponseFactory
Definition: EventStreamClient.h:409
AWS_CRT_CPP_API Allocator * g_allocator
Definition: Allocator.cpp:22
Definition: EventStreamClient.h:517
std::function< Crt::ScopedResource< AbstractShapeBase >(const Crt::StringView &payload, Crt::Allocator *allocator)> ExpectedResponseFactory
Definition: EventStreamClient.h:407
std::function< ErrorResponseFactory(const Crt::String &modelName)> ErrorResponseRetriever
Definition: EventStreamClient.h:413
@ OPERATION_RESPONSE
Definition: EventStreamClient.h:373
Crt::Optional< MessageAmendment > GetConnectAmendment() const noexcept
Definition: EventStreamClient.h:166
ResultType
Definition: EventStreamClient.h:371
@ EVENT_STREAM_RPC_SUCCESS
Definition: EventStreamClient.h:140
Definition: EventStreamClient.h:429
void SetConnectRequestCallback(OnMessageFlushCallback connectRequestCallback) noexcept
Definition: EventStreamClient.h:196
@ EVENT_STREAM_RPC_UNINITIALIZED
Definition: EventStreamClient.h:142
OperationError() noexcept=default
@ EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE
Definition: EventStreamClient.h:149
std::function< void(int errorCode)> OnMessageFlushCallback
Definition: EventStreamClient.h:45
string_view StringView
Definition: StringView.h:856
Definition: SocketOptions.h:48
void SetTlsConnectionOptions(Crt::Io::TlsConnectionOptions tlsConnectionOptions) noexcept
Definition: EventStreamClient.h:188
Definition: StringView.h:33
aws_byte_buf ByteBuf
Definition: Types.h:30
Definition: StringView.h:862
@ EVENT_STREAM_RPC_CONTINUATION_NOT_YET_OPENED
Definition: EventStreamClient.h:153
@ EVENT_STREAM_RPC_NULL_PARAMETER
Definition: EventStreamClient.h:141
Definition: Allocator.h:11
virtual ~ConnectionLifecycleHandler() noexcept=default
Definition: EventStreamClient.h:379
virtual ~StreamResponseHandler() noexcept=default
aws_allocator Allocator
Definition: Allocator.h:14
@ EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED
Definition: EventStreamClient.h:145
void SetClientBootstrap(Crt::Io::ClientBootstrap *clientBootstrap) noexcept
Definition: EventStreamClient.h:192
#define AWS_EVENTSTREAMRPC_API
Definition: Exports.h:19
virtual ~ResponseRetriever() noexcept=default
Definition: Bootstrap.h:35
Definition: EventStreamClient.h:442
Definition: EventStreamClient.h:317
Crt::Optional< Crt::Io::SocketOptions > GetSocketOptions() const noexcept
Definition: EventStreamClient.h:165
@ EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE
Definition: EventStreamClient.h:151
Definition: EventStreamClient.h:92
aws_event_stream_rpc_message_type MessageType
Definition: EventStreamClient.h:39
void SetHostName(Crt::String hostName) noexcept
Definition: EventStreamClient.h:178
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition: Types.h:45
Crt::Optional< Crt::String > GetHostName() const noexcept
Definition: EventStreamClient.h:163
Crt::Optional< uint32_t > GetPort() const noexcept
Definition: EventStreamClient.h:164
Definition: EventStreamClient.cpp:1418