stream_subscription_installer.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 #pragma once
17 #include <kinesis_manager/common.h>
18 
19 #include <boost/function.hpp>
20 #include <map>
21 
22 namespace Aws {
23 namespace Kinesis {
24 
26 {
28  std::string topic_name;
29  std::string stream_name;
33 };
34 
35 typedef std::function<bool(const StreamSubscriptionDescriptor & descriptor)> SubscriberSetupFn;
36 
42 {
43 public:
44  StreamSubscriptionInstaller() = default;
45  virtual ~StreamSubscriptionInstaller() = default;
56  virtual KinesisManagerStatus Install(const StreamSubscriptionDescriptor & descriptor) const
57  {
58  if (descriptor.topic_name.empty() || descriptor.stream_name.empty()) {
60  }
61  if (0 == installers_.count(descriptor.input_type)) {
63  }
64 
65  bool result = installers_.at(descriptor.input_type)(descriptor);
66  return result ? KINESIS_MANAGER_STATUS_SUCCESS
68  }
73  virtual void Uninstall(const std::string & topic_name) = 0;
74 
75 protected:
79  std::map<KinesisStreamInputType, SubscriberSetupFn> installers_;
80 };
81 
82 } // namespace Kinesis
83 } // namespace Aws
enum Aws::Kinesis::kinesis_manager_status_e KinesisManagerStatus
std::map< KinesisStreamInputType, SubscriberSetupFn > installers_
std::function< bool(const StreamSubscriptionDescriptor &descriptor)> SubscriberSetupFn
virtual KinesisManagerStatus Install(const StreamSubscriptionDescriptor &descriptor) const
int KinesisStreamInputType
Definition: common.h:57


kinesis_manager
Author(s): AWS RoboMaker
autogenerated on Thu Mar 4 2021 03:28:41