/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include #include #include namespace Aws { namespace CloudWatchLogs { namespace Model { enum class StartLiveTailEventType { INITIAL_RESPONSE, SESSIONSTART, SESSIONUPDATE, UNKNOWN }; class StartLiveTailHandler : public Aws::Utils::Event::EventStreamHandler { typedef std::function StartLiveTailInitialResponseCallback; typedef std::function LiveTailSessionStartCallback; typedef std::function LiveTailSessionUpdateCallback; typedef std::function& error)> ErrorCallback; public: AWS_CLOUDWATCHLOGS_API StartLiveTailHandler(); AWS_CLOUDWATCHLOGS_API StartLiveTailHandler& operator=(const StartLiveTailHandler&) = default; AWS_CLOUDWATCHLOGS_API virtual void OnEvent() override; inline void SetInitialResponseCallback(const StartLiveTailInitialResponseCallback& callback) { m_onInitialResponse = callback; } inline void SetLiveTailSessionStartCallback(const LiveTailSessionStartCallback& callback) { m_onLiveTailSessionStart = callback; } inline void SetLiveTailSessionUpdateCallback(const LiveTailSessionUpdateCallback& callback) { m_onLiveTailSessionUpdate = callback; } inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; } private: AWS_CLOUDWATCHLOGS_API void HandleEventInMessage(); AWS_CLOUDWATCHLOGS_API void HandleErrorInMessage(); AWS_CLOUDWATCHLOGS_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage); StartLiveTailInitialResponseCallback m_onInitialResponse; LiveTailSessionStartCallback m_onLiveTailSessionStart; LiveTailSessionUpdateCallback m_onLiveTailSessionUpdate; ErrorCallback m_onError; }; namespace StartLiveTailEventMapper { AWS_CLOUDWATCHLOGS_API StartLiveTailEventType GetStartLiveTailEventTypeForName(const Aws::String& name); AWS_CLOUDWATCHLOGS_API Aws::String GetNameForStartLiveTailEventType(StartLiveTailEventType value); } // namespace StartLiveTailEventMapper } // namespace Model } // namespace CloudWatchLogs } // namespace Aws