cloudwatch_logs_facade.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #pragma once
17 
18 #include <aws/core/Aws.h>
19 #include <aws/logs/CloudWatchLogsClient.h>
20 #include <aws/logs/model/InputLogEvent.h>
21 #include <aws/logs/model/PutLogEventsRequest.h>
24 
25 namespace Aws {
26 namespace CloudWatchLogs {
27 namespace Utils {
28 
39 {
40 public:
46  // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
47  CloudWatchLogsFacade(const Aws::Client::ClientConfiguration & client_config);
48 
54  // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
55  CloudWatchLogsFacade(const std::shared_ptr<Aws::CloudWatchLogs::CloudWatchLogsClient>& cw_client);
56 
57  virtual ~CloudWatchLogsFacade() = default;
58 
74  Aws::String & next_token, const std::string & log_group, const std::string & log_stream,
75  LogCollection & logs);
76 
85  const std::string & log_group);
86 
94  const std::string & log_group);
95 
105  const std::string & log_group, const std::string & log_stream);
106 
116  const std::string & log_group, const std::string & log_stream,
117  Aws::CloudWatchLogs::Model::LogStream * log_stream_object);
118 
129  const std::string & log_group, const std::string & log_stream, Aws::String & next_token);
130 
131 protected:
132 
133  CloudWatchLogsFacade() = default;
134  std::shared_ptr<Aws::CloudWatchLogs::CloudWatchLogsClient> cw_client_;
135 
136 private:
138  const Aws::CloudWatchLogs::Model::PutLogEventsRequest & request, Aws::String & next_token);
139 
140  // The last time PutLogEvents was called, used to track rate limiting
141  std::chrono::milliseconds last_put_time_{0};
142 
143 };
144 
145 } // namespace Utils
146 } // namespace CloudWatchLogs
147 } // namespace Aws
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.
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.
std::shared_ptr< Aws::CloudWatchLogs::CloudWatchLogsClient > cw_client_
This class is a simple Facade over the CloudWatch client. This class is a very small abstraction over...
Aws::CloudWatchLogs::ROSCloudWatchLogsErrors SendLogsRequest(const Aws::CloudWatchLogs::Model::PutLogEventsRequest &request, Aws::String &next_token)
std::list< LogType > LogCollection
Definition: definitions.h:29
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.
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors CreateLogStream(const std::string &log_group, const std::string &log_stream)
Creates a log stream in the specified log group.
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors CheckLogGroupExists(const std::string &log_group)
Check if a log group exists.
Contains Error handling functionality for ROS AWS CloudWatch Logs libraries.
virtual Aws::CloudWatchLogs::ROSCloudWatchLogsErrors CreateLogGroup(const std::string &log_group)
Creates a log group.
ROSCloudWatchLogsErrors
Defines error return codes for functions This enum defines standard error codes that will be returned...


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