Skip to content

Commit e80089c

Browse files
committed
feat: add gg apis for resource management
1 parent 83c0c04 commit e80089c

File tree

8 files changed

+15047
-13885
lines changed

8 files changed

+15047
-13885
lines changed
Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,63 @@
11
#include <aws/crt/io/Bootstrap.h>
22
#include <awstest/EchoTestRpcClient.h>
33

4-
namespace Awstest
5-
{
6-
EchoTestRpcClient::EchoTestRpcClient(
7-
Aws::Crt::Io::ClientBootstrap &clientBootstrap,
8-
Aws::Crt::Allocator *allocator) noexcept
9-
: m_connection(allocator), m_clientBootstrap(clientBootstrap), m_allocator(allocator)
10-
{
11-
m_echoTestRpcServiceModel.AssignModelNameToErrorResponse(
12-
Aws::Crt::String("awstest#ServiceError"), ServiceError::s_allocateFromPayload);
13-
}
4+
namespace Awstest {
5+
EchoTestRpcClient::EchoTestRpcClient(
6+
Aws::Crt::Io::ClientBootstrap &clientBootstrap,
7+
Aws::Crt::Allocator *allocator) noexcept
8+
: m_connection(allocator), m_clientBootstrap(clientBootstrap),
9+
m_allocator(allocator) {
10+
m_echoTestRpcServiceModel.AssignModelNameToErrorResponse(
11+
Aws::Crt::String("awstest#ServiceError"),
12+
ServiceError::s_allocateFromPayload);
13+
}
1414

15-
std::future<RpcError> EchoTestRpcClient::Connect(
16-
ConnectionLifecycleHandler &lifecycleHandler,
17-
const ConnectionConfig &connectionConfig) noexcept
18-
{
19-
return m_connection.Connect(connectionConfig, &lifecycleHandler, m_clientBootstrap);
20-
}
15+
std::future<RpcError>
16+
EchoTestRpcClient::Connect(ConnectionLifecycleHandler &lifecycleHandler,
17+
const ConnectionConfig &connectionConfig) noexcept {
18+
return m_connection.Connect(connectionConfig, &lifecycleHandler,
19+
m_clientBootstrap);
20+
}
2121

22-
void EchoTestRpcClient::Close() noexcept { m_connection.Close(); }
22+
void EchoTestRpcClient::Close() noexcept { m_connection.Close(); }
2323

24-
EchoTestRpcClient::~EchoTestRpcClient() noexcept { Close(); }
24+
EchoTestRpcClient::~EchoTestRpcClient() noexcept { Close(); }
2525

26-
GetAllProductsOperation EchoTestRpcClient::NewGetAllProducts() noexcept
27-
{
28-
return GetAllProductsOperation(
29-
m_connection, m_echoTestRpcServiceModel.m_getAllProductsOperationContext, m_allocator);
30-
}
31-
CauseServiceErrorOperation EchoTestRpcClient::NewCauseServiceError() noexcept
32-
{
33-
return CauseServiceErrorOperation(
34-
m_connection, m_echoTestRpcServiceModel.m_causeServiceErrorOperationContext, m_allocator);
35-
}
36-
CauseStreamServiceToErrorOperation EchoTestRpcClient::NewCauseStreamServiceToError(
37-
CauseStreamServiceToErrorStreamHandler &streamHandler) noexcept
38-
{
39-
return CauseStreamServiceToErrorOperation(
40-
m_connection,
41-
&streamHandler,
42-
m_echoTestRpcServiceModel.m_causeStreamServiceToErrorOperationContext,
43-
m_allocator);
44-
}
45-
EchoStreamMessagesOperation EchoTestRpcClient::NewEchoStreamMessages(
46-
EchoStreamMessagesStreamHandler &streamHandler) noexcept
47-
{
48-
return EchoStreamMessagesOperation(
49-
m_connection, &streamHandler, m_echoTestRpcServiceModel.m_echoStreamMessagesOperationContext, m_allocator);
50-
}
51-
EchoMessageOperation EchoTestRpcClient::NewEchoMessage() noexcept
52-
{
53-
return EchoMessageOperation(m_connection, m_echoTestRpcServiceModel.m_echoMessageOperationContext, m_allocator);
54-
}
55-
GetAllCustomersOperation EchoTestRpcClient::NewGetAllCustomers() noexcept
56-
{
57-
return GetAllCustomersOperation(
58-
m_connection, m_echoTestRpcServiceModel.m_getAllCustomersOperationContext, m_allocator);
59-
}
26+
GetAllProductsOperation EchoTestRpcClient::NewGetAllProducts() noexcept {
27+
return GetAllProductsOperation(
28+
m_connection, m_echoTestRpcServiceModel.m_getAllProductsOperationContext,
29+
m_allocator);
30+
}
31+
CauseServiceErrorOperation EchoTestRpcClient::NewCauseServiceError() noexcept {
32+
return CauseServiceErrorOperation(
33+
m_connection,
34+
m_echoTestRpcServiceModel.m_causeServiceErrorOperationContext,
35+
m_allocator);
36+
}
37+
CauseStreamServiceToErrorOperation
38+
EchoTestRpcClient::NewCauseStreamServiceToError(
39+
CauseStreamServiceToErrorStreamHandler &streamHandler) noexcept {
40+
return CauseStreamServiceToErrorOperation(
41+
m_connection, &streamHandler,
42+
m_echoTestRpcServiceModel.m_causeStreamServiceToErrorOperationContext,
43+
m_allocator);
44+
}
45+
EchoStreamMessagesOperation EchoTestRpcClient::NewEchoStreamMessages(
46+
EchoStreamMessagesStreamHandler &streamHandler) noexcept {
47+
return EchoStreamMessagesOperation(
48+
m_connection, &streamHandler,
49+
m_echoTestRpcServiceModel.m_echoStreamMessagesOperationContext,
50+
m_allocator);
51+
}
52+
EchoMessageOperation EchoTestRpcClient::NewEchoMessage() noexcept {
53+
return EchoMessageOperation(
54+
m_connection, m_echoTestRpcServiceModel.m_echoMessageOperationContext,
55+
m_allocator);
56+
}
57+
GetAllCustomersOperation EchoTestRpcClient::NewGetAllCustomers() noexcept {
58+
return GetAllCustomersOperation(
59+
m_connection, m_echoTestRpcServiceModel.m_getAllCustomersOperationContext,
60+
m_allocator);
61+
}
6062

6163
} // namespace Awstest

0 commit comments

Comments
 (0)