Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade Class Reference

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>

Inheritance diagram for Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade:
Inheritance graph
[legend]

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}
 

Detailed Description

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.

Constructor & Destructor Documentation

Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CloudWatchLogsFacade ( const Aws::Client::ClientConfiguration &  client_config)

Creates a new CloudWatchLogsFacade.

Parameters
client_configThe 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.

Parameters
cw_clientThe client for interacting with cloudwatch

Definition at line 57 of file cloudwatch_logs_facade.cpp.

virtual Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::~CloudWatchLogsFacade ( )
virtualdefault
Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CloudWatchLogsFacade ( )
protecteddefault

Member Function Documentation

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CheckLogGroupExists ( const std::string &  log_group)
virtual

Check if a log group exists.

Parameters
log_groupName of the log group
Returns
An error code that will be SUCCESS if log group is successfully found

Reimplemented in MockCloudWatchFacade.

Definition at line 195 of file cloudwatch_logs_facade.cpp.

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CheckLogStreamExists ( const std::string &  log_group,
const std::string &  log_stream,
Aws::CloudWatchLogs::Model::LogStream *  log_stream_object 
)
virtual

Check if a log stream in a log group exists.

Parameters
log_groupName of the log group
log_streamName of the stream
log_stream_objectA log stream object that contains information about the log stream
Returns
An error code that will be SUCCESS if log stream is successfully found

Reimplemented in MockCloudWatchFacade.

Definition at line 274 of file cloudwatch_logs_facade.cpp.

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CreateLogGroup ( const std::string &  log_group)
virtual

Creates a log group.

Parameters
log_groupName of the log group
Returns
An error code that will be SUCCESS if log group is successfully created or resource already exists

Reimplemented in MockCloudWatchFacade.

Definition at line 165 of file cloudwatch_logs_facade.cpp.

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::CreateLogStream ( const std::string &  log_group,
const std::string &  log_stream 
)
virtual

Creates a log stream in the specified log group.

Parameters
log_groupName of the log group
log_streamName of the stream
Returns
An error code that will be SUCCESS if log stream is successfully created or resource already exists

Reimplemented in MockCloudWatchFacade.

Definition at line 245 of file cloudwatch_logs_facade.cpp.

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::GetLogStreamToken ( const std::string &  log_group,
const std::string &  log_stream,
Aws::String &  next_token 
)
virtual

Gets the next sequence token to use for sending logs to cloudwatch.

Parameters
log_groupName of the log group
log_streamName of the stream
Returns
An error code of SUCCESS if the specified log stream in the log group can be found and has a next sequence token (a new stream will not have a sequence token)

Reimplemented in MockCloudWatchFacade.

Definition at line 332 of file cloudwatch_logs_facade.cpp.

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::SendLogsRequest ( const Aws::CloudWatchLogs::Model::PutLogEventsRequest &  request,
Aws::String &  next_token 
)
private

Definition at line 62 of file cloudwatch_logs_facade.cpp.

Aws::CloudWatchLogs::ROSCloudWatchLogsErrors Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::SendLogsToCloudWatch ( Aws::String &  next_token,
const std::string &  log_group,
const std::string &  log_stream,
LogCollection logs 
)
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.

Parameters
next_tokenThe next sequence token to use for sending logs to cloudwatch
log_groupA reference to a string with the log group name for all the logs being posted
log_streamA reference to a string with the log stream name for all the logs being posted
logsA reference to a list of logs that you want sent to CloudWatch
Returns
An error code that will be SUCCESS if all logs were sent successfully.

Definition at line 106 of file cloudwatch_logs_facade.cpp.

Member Data Documentation

std::shared_ptr<Aws::CloudWatchLogs::CloudWatchLogsClient> Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::cw_client_
protected

Definition at line 134 of file cloudwatch_logs_facade.h.

std::chrono::milliseconds Aws::CloudWatchLogs::Utils::CloudWatchLogsFacade::last_put_time_ {0}
private

Definition at line 141 of file cloudwatch_logs_facade.h.


The documentation for this class was generated from the following files:


cloudwatch_logs_common
Author(s): AWS RoboMaker
autogenerated on Fri May 7 2021 02:18:24