This class is a simple Facade over the CloudWatch client. This class is a very small abstraction over the CloudWatch client. It allows us to change the details of how we're communicating with CloudWatch without the need to expose this in the rest of our code. It also provides a shim for us to be able to Mock to unit test the rest of the code. More...
#include <cloudwatch_logs_facade.h>
Public Member Functions | |
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | CheckLogGroupExists (const std::string &log_group) |
Check if a log group exists. More... | |
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | CheckLogStreamExists (const std::string &log_group, const std::string &log_stream, Aws::CloudWatchLogs::Model::LogStream *log_stream_object) |
Check if a log stream in a log group exists. More... | |
CloudWatchLogsFacade (const Aws::Client::ClientConfiguration &client_config) | |
Creates a new CloudWatchLogsFacade. More... | |
CloudWatchLogsFacade (const std::shared_ptr< Aws::CloudWatchLogs::CloudWatchLogsClient > &cw_client) | |
Creates a new CloudWatchLogsFacade with an existing client. More... | |
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | CreateLogGroup (const std::string &log_group) |
Creates a log group. More... | |
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | CreateLogStream (const std::string &log_group, const std::string &log_stream) |
Creates a log stream in the specified log group. More... | |
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | GetLogStreamToken (const std::string &log_group, const std::string &log_stream, Aws::String &next_token) |
Gets the next sequence token to use for sending logs to cloudwatch. More... | |
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | SendLogsToCloudWatch (Aws::String &next_token, const std::string &log_group, const std::string &log_stream, LogCollection &logs) |
Sends a list of logs to CloudWatch. More... | |
virtual | ~CloudWatchLogsFacade ()=default |
Protected Member Functions | |
CloudWatchLogsFacade ()=default | |
Protected Attributes | |
std::shared_ptr< Aws::CloudWatchLogs::CloudWatchLogsClient > | cw_client_ |
Private Member Functions | |
Aws::CloudWatchLogs::ROSCloudWatchLogsErrors | SendLogsRequest (const Aws::CloudWatchLogs::Model::PutLogEventsRequest &request, Aws::String &next_token) |
Private Attributes | |
std::chrono::milliseconds | last_put_time_ {0} |
This class is a simple Facade over the CloudWatch client. This class is a very small abstraction over the CloudWatch client. It allows us to change the details of how we're communicating with CloudWatch without the need to expose this in the rest of our code. It also provides a shim for us to be able to Mock to unit test the rest of the code.
This class expects Aws::InitAPI() to have already been called before an instance is constructed
Definition at line 38 of file cloudwatch_logs_facade.h.
Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CloudWatchLogsFacade | ( | const Aws::Client::ClientConfiguration & | client_config | ) |
Creates a new CloudWatchLogsFacade.
client_config | The configuration for the cloudwatch client |
Definition at line 52 of file cloudwatch_logs_facade.cpp.
Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CloudWatchLogsFacade | ( | const std::shared_ptr< Aws::CloudWatchLogs::CloudWatchLogsClient > & | cw_client | ) |
Creates a new CloudWatchLogsFacade with an existing client.
cw_client | The client for interacting with cloudwatch |
Definition at line 57 of file cloudwatch_logs_facade.cpp.
|
virtualdefault |
|
protecteddefault |
|
virtual |
Check if a log group exists.
log_group | Name of the log group |
Reimplemented in MockCloudWatchFacade.
Definition at line 195 of file cloudwatch_logs_facade.cpp.
|
virtual |
Check if a log stream in a log group exists.
log_group | Name of the log group |
log_stream | Name of the stream |
log_stream_object | A log stream object that contains information about the log stream |
Reimplemented in MockCloudWatchFacade.
Definition at line 274 of file cloudwatch_logs_facade.cpp.
|
virtual |
Creates a log group.
log_group | Name of the log group |
Reimplemented in MockCloudWatchFacade.
Definition at line 165 of file cloudwatch_logs_facade.cpp.
|
virtual |
Creates a log stream in the specified log group.
log_group | Name of the log group |
log_stream | Name of the stream |
Reimplemented in MockCloudWatchFacade.
Definition at line 245 of file cloudwatch_logs_facade.cpp.
|
virtual |
Gets the next sequence token to use for sending logs to cloudwatch.
log_group | Name of the log group |
log_stream | Name of the stream |
Reimplemented in MockCloudWatchFacade.
Definition at line 332 of file cloudwatch_logs_facade.cpp.
|
private |
Definition at line 62 of file cloudwatch_logs_facade.cpp.
|
virtual |
Sends a list of logs to CloudWatch.
This operation may block for a bounded amount of time to rate limit calls to the CloudWatch Logs API. It is expected that tasks dispatched to this facade occur on worker threads so that main loop program processing is not affected by this delay.
next_token | The next sequence token to use for sending logs to cloudwatch |
log_group | A reference to a string with the log group name for all the logs being posted |
log_stream | A reference to a string with the log stream name for all the logs being posted |
logs | A reference to a list of logs that you want sent to CloudWatch |
Definition at line 106 of file cloudwatch_logs_facade.cpp.
|
protected |
Definition at line 134 of file cloudwatch_logs_facade.h.
|
private |
Definition at line 141 of file cloudwatch_logs_facade.h.