cloudwatch_metrics_facade.hpp
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/monitoring/CloudWatchClient.h>
20 #include <aws/monitoring/model/MetricDatum.h>
23 
24 namespace Aws {
25 namespace CloudWatchMetrics {
26 namespace Utils {
27 
33  SUCCESS, // the CloudWatch API call was successful
34  FAILURE, // the CloudWatch API call failed for some reason
35  NETWORK_FAILURE, // the CloudWatch API call returned a timeout / not connected error
36  INVALID_DATA // invalid data was attempted to be published
37 };
38 
49 {
50 public:
55  // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
56  CloudWatchMetricsFacade(const Aws::Client::ClientConfiguration & client_config);
61  // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
62  CloudWatchMetricsFacade(const std::shared_ptr<Aws::CloudWatch::CloudWatchClient>& cw_client);
63 
64  virtual ~CloudWatchMetricsFacade() = default;
65 
77  const std::string & metric_namespace, MetricDatumCollection & metrics);
78 
79 protected:
80  CloudWatchMetricsFacade() = default;
81 
82 private:
83 
84  std::shared_ptr<Aws::CloudWatch::CloudWatchClient> cw_client_;
85  CloudWatchMetricsStatus SendMetricsRequest(const Aws::CloudWatch::Model::PutMetricDataRequest & request);
86 };
87 
88 } // namespace Utils
89 } // namespace CloudWatchMetrics
90 } // namespace Aws
std::list< Aws::CloudWatch::Model::MetricDatum > MetricDatumCollection
Definition: definitions.h:23
CloudWatchMetricsStatus SendMetricsRequest(const Aws::CloudWatch::Model::PutMetricDataRequest &request)
This class is a simple Facade over the CloudWatch client. This class is a very small abstraction over...
std::shared_ptr< Aws::CloudWatch::CloudWatchClient > cw_client_
virtual CloudWatchMetricsStatus SendMetricsToCloudWatch(const std::string &metric_namespace, MetricDatumCollection &metrics)
Sends a list of metrics to CloudWatch Used to send a list of metrics to CloudWatch.


cloudwatch_metrics_common
Author(s): AWS RoboMaker
autogenerated on Fri May 7 2021 02:18:25