{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.KinesisAnalyticsV2.AddApplicationCloudWatchLoggingOption
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Adds an Amazon CloudWatch log stream to monitor application
-- configuration errors.
module Amazonka.KinesisAnalyticsV2.AddApplicationCloudWatchLoggingOption
  ( -- * Creating a Request
    AddApplicationCloudWatchLoggingOption (..),
    newAddApplicationCloudWatchLoggingOption,

    -- * Request Lenses
    addApplicationCloudWatchLoggingOption_currentApplicationVersionId,
    addApplicationCloudWatchLoggingOption_conditionalToken,
    addApplicationCloudWatchLoggingOption_applicationName,
    addApplicationCloudWatchLoggingOption_cloudWatchLoggingOption,

    -- * Destructuring the Response
    AddApplicationCloudWatchLoggingOptionResponse (..),
    newAddApplicationCloudWatchLoggingOptionResponse,

    -- * Response Lenses
    addApplicationCloudWatchLoggingOptionResponse_applicationARN,
    addApplicationCloudWatchLoggingOptionResponse_applicationVersionId,
    addApplicationCloudWatchLoggingOptionResponse_cloudWatchLoggingOptionDescriptions,
    addApplicationCloudWatchLoggingOptionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newAddApplicationCloudWatchLoggingOption' smart constructor.
data AddApplicationCloudWatchLoggingOption = AddApplicationCloudWatchLoggingOption'
  { -- | The version ID of the Kinesis Data Analytics application. You must
    -- provide the @CurrentApplicationVersionId@ or the @ConditionalToken@.You
    -- can retrieve the application version ID using DescribeApplication. For
    -- better concurrency support, use the @ConditionalToken@ parameter instead
    -- of @CurrentApplicationVersionId@.
    AddApplicationCloudWatchLoggingOption -> Maybe Natural
currentApplicationVersionId :: Prelude.Maybe Prelude.Natural,
    -- | A value you use to implement strong concurrency for application updates.
    -- You must provide the @CurrentApplicationVersionId@ or the
    -- @ConditionalToken@. You get the application\'s current
    -- @ConditionalToken@ using DescribeApplication. For better concurrency
    -- support, use the @ConditionalToken@ parameter instead of
    -- @CurrentApplicationVersionId@.
    AddApplicationCloudWatchLoggingOption -> Maybe Text
conditionalToken :: Prelude.Maybe Prelude.Text,
    -- | The Kinesis Data Analytics application name.
    AddApplicationCloudWatchLoggingOption -> Text
applicationName :: Prelude.Text,
    -- | Provides the Amazon CloudWatch log stream Amazon Resource Name (ARN).
    AddApplicationCloudWatchLoggingOption -> CloudWatchLoggingOption
cloudWatchLoggingOption :: CloudWatchLoggingOption
  }
  deriving (AddApplicationCloudWatchLoggingOption
-> AddApplicationCloudWatchLoggingOption -> Bool
(AddApplicationCloudWatchLoggingOption
 -> AddApplicationCloudWatchLoggingOption -> Bool)
-> (AddApplicationCloudWatchLoggingOption
    -> AddApplicationCloudWatchLoggingOption -> Bool)
-> Eq AddApplicationCloudWatchLoggingOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddApplicationCloudWatchLoggingOption
-> AddApplicationCloudWatchLoggingOption -> Bool
$c/= :: AddApplicationCloudWatchLoggingOption
-> AddApplicationCloudWatchLoggingOption -> Bool
== :: AddApplicationCloudWatchLoggingOption
-> AddApplicationCloudWatchLoggingOption -> Bool
$c== :: AddApplicationCloudWatchLoggingOption
-> AddApplicationCloudWatchLoggingOption -> Bool
Prelude.Eq, ReadPrec [AddApplicationCloudWatchLoggingOption]
ReadPrec AddApplicationCloudWatchLoggingOption
Int -> ReadS AddApplicationCloudWatchLoggingOption
ReadS [AddApplicationCloudWatchLoggingOption]
(Int -> ReadS AddApplicationCloudWatchLoggingOption)
-> ReadS [AddApplicationCloudWatchLoggingOption]
-> ReadPrec AddApplicationCloudWatchLoggingOption
-> ReadPrec [AddApplicationCloudWatchLoggingOption]
-> Read AddApplicationCloudWatchLoggingOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddApplicationCloudWatchLoggingOption]
$creadListPrec :: ReadPrec [AddApplicationCloudWatchLoggingOption]
readPrec :: ReadPrec AddApplicationCloudWatchLoggingOption
$creadPrec :: ReadPrec AddApplicationCloudWatchLoggingOption
readList :: ReadS [AddApplicationCloudWatchLoggingOption]
$creadList :: ReadS [AddApplicationCloudWatchLoggingOption]
readsPrec :: Int -> ReadS AddApplicationCloudWatchLoggingOption
$creadsPrec :: Int -> ReadS AddApplicationCloudWatchLoggingOption
Prelude.Read, Int -> AddApplicationCloudWatchLoggingOption -> ShowS
[AddApplicationCloudWatchLoggingOption] -> ShowS
AddApplicationCloudWatchLoggingOption -> String
(Int -> AddApplicationCloudWatchLoggingOption -> ShowS)
-> (AddApplicationCloudWatchLoggingOption -> String)
-> ([AddApplicationCloudWatchLoggingOption] -> ShowS)
-> Show AddApplicationCloudWatchLoggingOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddApplicationCloudWatchLoggingOption] -> ShowS
$cshowList :: [AddApplicationCloudWatchLoggingOption] -> ShowS
show :: AddApplicationCloudWatchLoggingOption -> String
$cshow :: AddApplicationCloudWatchLoggingOption -> String
showsPrec :: Int -> AddApplicationCloudWatchLoggingOption -> ShowS
$cshowsPrec :: Int -> AddApplicationCloudWatchLoggingOption -> ShowS
Prelude.Show, (forall x.
 AddApplicationCloudWatchLoggingOption
 -> Rep AddApplicationCloudWatchLoggingOption x)
-> (forall x.
    Rep AddApplicationCloudWatchLoggingOption x
    -> AddApplicationCloudWatchLoggingOption)
-> Generic AddApplicationCloudWatchLoggingOption
forall x.
Rep AddApplicationCloudWatchLoggingOption x
-> AddApplicationCloudWatchLoggingOption
forall x.
AddApplicationCloudWatchLoggingOption
-> Rep AddApplicationCloudWatchLoggingOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddApplicationCloudWatchLoggingOption x
-> AddApplicationCloudWatchLoggingOption
$cfrom :: forall x.
AddApplicationCloudWatchLoggingOption
-> Rep AddApplicationCloudWatchLoggingOption x
Prelude.Generic)

-- |
-- Create a value of 'AddApplicationCloudWatchLoggingOption' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'currentApplicationVersionId', 'addApplicationCloudWatchLoggingOption_currentApplicationVersionId' - The version ID of the Kinesis Data Analytics application. You must
-- provide the @CurrentApplicationVersionId@ or the @ConditionalToken@.You
-- can retrieve the application version ID using DescribeApplication. For
-- better concurrency support, use the @ConditionalToken@ parameter instead
-- of @CurrentApplicationVersionId@.
--
-- 'conditionalToken', 'addApplicationCloudWatchLoggingOption_conditionalToken' - A value you use to implement strong concurrency for application updates.
-- You must provide the @CurrentApplicationVersionId@ or the
-- @ConditionalToken@. You get the application\'s current
-- @ConditionalToken@ using DescribeApplication. For better concurrency
-- support, use the @ConditionalToken@ parameter instead of
-- @CurrentApplicationVersionId@.
--
-- 'applicationName', 'addApplicationCloudWatchLoggingOption_applicationName' - The Kinesis Data Analytics application name.
--
-- 'cloudWatchLoggingOption', 'addApplicationCloudWatchLoggingOption_cloudWatchLoggingOption' - Provides the Amazon CloudWatch log stream Amazon Resource Name (ARN).
newAddApplicationCloudWatchLoggingOption ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'cloudWatchLoggingOption'
  CloudWatchLoggingOption ->
  AddApplicationCloudWatchLoggingOption
newAddApplicationCloudWatchLoggingOption :: Text
-> CloudWatchLoggingOption -> AddApplicationCloudWatchLoggingOption
newAddApplicationCloudWatchLoggingOption
  Text
pApplicationName_
  CloudWatchLoggingOption
pCloudWatchLoggingOption_ =
    AddApplicationCloudWatchLoggingOption' :: Maybe Natural
-> Maybe Text
-> Text
-> CloudWatchLoggingOption
-> AddApplicationCloudWatchLoggingOption
AddApplicationCloudWatchLoggingOption'
      { $sel:currentApplicationVersionId:AddApplicationCloudWatchLoggingOption' :: Maybe Natural
currentApplicationVersionId =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:conditionalToken:AddApplicationCloudWatchLoggingOption' :: Maybe Text
conditionalToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationName:AddApplicationCloudWatchLoggingOption' :: Text
applicationName = Text
pApplicationName_,
        $sel:cloudWatchLoggingOption:AddApplicationCloudWatchLoggingOption' :: CloudWatchLoggingOption
cloudWatchLoggingOption =
          CloudWatchLoggingOption
pCloudWatchLoggingOption_
      }

-- | The version ID of the Kinesis Data Analytics application. You must
-- provide the @CurrentApplicationVersionId@ or the @ConditionalToken@.You
-- can retrieve the application version ID using DescribeApplication. For
-- better concurrency support, use the @ConditionalToken@ parameter instead
-- of @CurrentApplicationVersionId@.
addApplicationCloudWatchLoggingOption_currentApplicationVersionId :: Lens.Lens' AddApplicationCloudWatchLoggingOption (Prelude.Maybe Prelude.Natural)
addApplicationCloudWatchLoggingOption_currentApplicationVersionId :: (Maybe Natural -> f (Maybe Natural))
-> AddApplicationCloudWatchLoggingOption
-> f AddApplicationCloudWatchLoggingOption
addApplicationCloudWatchLoggingOption_currentApplicationVersionId = (AddApplicationCloudWatchLoggingOption -> Maybe Natural)
-> (AddApplicationCloudWatchLoggingOption
    -> Maybe Natural -> AddApplicationCloudWatchLoggingOption)
-> Lens
     AddApplicationCloudWatchLoggingOption
     AddApplicationCloudWatchLoggingOption
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOption' {Maybe Natural
currentApplicationVersionId :: Maybe Natural
$sel:currentApplicationVersionId:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> Maybe Natural
currentApplicationVersionId} -> Maybe Natural
currentApplicationVersionId) (\s :: AddApplicationCloudWatchLoggingOption
s@AddApplicationCloudWatchLoggingOption' {} Maybe Natural
a -> AddApplicationCloudWatchLoggingOption
s {$sel:currentApplicationVersionId:AddApplicationCloudWatchLoggingOption' :: Maybe Natural
currentApplicationVersionId = Maybe Natural
a} :: AddApplicationCloudWatchLoggingOption)

-- | A value you use to implement strong concurrency for application updates.
-- You must provide the @CurrentApplicationVersionId@ or the
-- @ConditionalToken@. You get the application\'s current
-- @ConditionalToken@ using DescribeApplication. For better concurrency
-- support, use the @ConditionalToken@ parameter instead of
-- @CurrentApplicationVersionId@.
addApplicationCloudWatchLoggingOption_conditionalToken :: Lens.Lens' AddApplicationCloudWatchLoggingOption (Prelude.Maybe Prelude.Text)
addApplicationCloudWatchLoggingOption_conditionalToken :: (Maybe Text -> f (Maybe Text))
-> AddApplicationCloudWatchLoggingOption
-> f AddApplicationCloudWatchLoggingOption
addApplicationCloudWatchLoggingOption_conditionalToken = (AddApplicationCloudWatchLoggingOption -> Maybe Text)
-> (AddApplicationCloudWatchLoggingOption
    -> Maybe Text -> AddApplicationCloudWatchLoggingOption)
-> Lens
     AddApplicationCloudWatchLoggingOption
     AddApplicationCloudWatchLoggingOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOption' {Maybe Text
conditionalToken :: Maybe Text
$sel:conditionalToken:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> Maybe Text
conditionalToken} -> Maybe Text
conditionalToken) (\s :: AddApplicationCloudWatchLoggingOption
s@AddApplicationCloudWatchLoggingOption' {} Maybe Text
a -> AddApplicationCloudWatchLoggingOption
s {$sel:conditionalToken:AddApplicationCloudWatchLoggingOption' :: Maybe Text
conditionalToken = Maybe Text
a} :: AddApplicationCloudWatchLoggingOption)

-- | The Kinesis Data Analytics application name.
addApplicationCloudWatchLoggingOption_applicationName :: Lens.Lens' AddApplicationCloudWatchLoggingOption Prelude.Text
addApplicationCloudWatchLoggingOption_applicationName :: (Text -> f Text)
-> AddApplicationCloudWatchLoggingOption
-> f AddApplicationCloudWatchLoggingOption
addApplicationCloudWatchLoggingOption_applicationName = (AddApplicationCloudWatchLoggingOption -> Text)
-> (AddApplicationCloudWatchLoggingOption
    -> Text -> AddApplicationCloudWatchLoggingOption)
-> Lens
     AddApplicationCloudWatchLoggingOption
     AddApplicationCloudWatchLoggingOption
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOption' {Text
applicationName :: Text
$sel:applicationName:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> Text
applicationName} -> Text
applicationName) (\s :: AddApplicationCloudWatchLoggingOption
s@AddApplicationCloudWatchLoggingOption' {} Text
a -> AddApplicationCloudWatchLoggingOption
s {$sel:applicationName:AddApplicationCloudWatchLoggingOption' :: Text
applicationName = Text
a} :: AddApplicationCloudWatchLoggingOption)

-- | Provides the Amazon CloudWatch log stream Amazon Resource Name (ARN).
addApplicationCloudWatchLoggingOption_cloudWatchLoggingOption :: Lens.Lens' AddApplicationCloudWatchLoggingOption CloudWatchLoggingOption
addApplicationCloudWatchLoggingOption_cloudWatchLoggingOption :: (CloudWatchLoggingOption -> f CloudWatchLoggingOption)
-> AddApplicationCloudWatchLoggingOption
-> f AddApplicationCloudWatchLoggingOption
addApplicationCloudWatchLoggingOption_cloudWatchLoggingOption = (AddApplicationCloudWatchLoggingOption -> CloudWatchLoggingOption)
-> (AddApplicationCloudWatchLoggingOption
    -> CloudWatchLoggingOption
    -> AddApplicationCloudWatchLoggingOption)
-> Lens
     AddApplicationCloudWatchLoggingOption
     AddApplicationCloudWatchLoggingOption
     CloudWatchLoggingOption
     CloudWatchLoggingOption
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOption' {CloudWatchLoggingOption
cloudWatchLoggingOption :: CloudWatchLoggingOption
$sel:cloudWatchLoggingOption:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> CloudWatchLoggingOption
cloudWatchLoggingOption} -> CloudWatchLoggingOption
cloudWatchLoggingOption) (\s :: AddApplicationCloudWatchLoggingOption
s@AddApplicationCloudWatchLoggingOption' {} CloudWatchLoggingOption
a -> AddApplicationCloudWatchLoggingOption
s {$sel:cloudWatchLoggingOption:AddApplicationCloudWatchLoggingOption' :: CloudWatchLoggingOption
cloudWatchLoggingOption = CloudWatchLoggingOption
a} :: AddApplicationCloudWatchLoggingOption)

instance
  Core.AWSRequest
    AddApplicationCloudWatchLoggingOption
  where
  type
    AWSResponse
      AddApplicationCloudWatchLoggingOption =
      AddApplicationCloudWatchLoggingOptionResponse
  request :: AddApplicationCloudWatchLoggingOption
-> Request AddApplicationCloudWatchLoggingOption
request = Service
-> AddApplicationCloudWatchLoggingOption
-> Request AddApplicationCloudWatchLoggingOption
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AddApplicationCloudWatchLoggingOption
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse AddApplicationCloudWatchLoggingOption)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse AddApplicationCloudWatchLoggingOption))
-> Logger
-> Service
-> Proxy AddApplicationCloudWatchLoggingOption
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse AddApplicationCloudWatchLoggingOption)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Natural
-> Maybe [CloudWatchLoggingOptionDescription]
-> Int
-> AddApplicationCloudWatchLoggingOptionResponse
AddApplicationCloudWatchLoggingOptionResponse'
            (Maybe Text
 -> Maybe Natural
 -> Maybe [CloudWatchLoggingOptionDescription]
 -> Int
 -> AddApplicationCloudWatchLoggingOptionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Natural
      -> Maybe [CloudWatchLoggingOptionDescription]
      -> Int
      -> AddApplicationCloudWatchLoggingOptionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ApplicationARN")
              Either
  String
  (Maybe Natural
   -> Maybe [CloudWatchLoggingOptionDescription]
   -> Int
   -> AddApplicationCloudWatchLoggingOptionResponse)
-> Either String (Maybe Natural)
-> Either
     String
     (Maybe [CloudWatchLoggingOptionDescription]
      -> Int -> AddApplicationCloudWatchLoggingOptionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ApplicationVersionId")
              Either
  String
  (Maybe [CloudWatchLoggingOptionDescription]
   -> Int -> AddApplicationCloudWatchLoggingOptionResponse)
-> Either String (Maybe [CloudWatchLoggingOptionDescription])
-> Either
     String (Int -> AddApplicationCloudWatchLoggingOptionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either
     String (Maybe (Maybe [CloudWatchLoggingOptionDescription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CloudWatchLoggingOptionDescriptions"
                              Either String (Maybe (Maybe [CloudWatchLoggingOptionDescription]))
-> Maybe [CloudWatchLoggingOptionDescription]
-> Either String (Maybe [CloudWatchLoggingOptionDescription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CloudWatchLoggingOptionDescription]
forall a. Monoid a => a
Prelude.mempty
                          )
              Either
  String (Int -> AddApplicationCloudWatchLoggingOptionResponse)
-> Either String Int
-> Either String AddApplicationCloudWatchLoggingOptionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    AddApplicationCloudWatchLoggingOption

instance
  Prelude.NFData
    AddApplicationCloudWatchLoggingOption

instance
  Core.ToHeaders
    AddApplicationCloudWatchLoggingOption
  where
  toHeaders :: AddApplicationCloudWatchLoggingOption -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> AddApplicationCloudWatchLoggingOption -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"KinesisAnalytics_20180523.AddApplicationCloudWatchLoggingOption" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    AddApplicationCloudWatchLoggingOption
  where
  toJSON :: AddApplicationCloudWatchLoggingOption -> Value
toJSON AddApplicationCloudWatchLoggingOption' {Maybe Natural
Maybe Text
Text
CloudWatchLoggingOption
cloudWatchLoggingOption :: CloudWatchLoggingOption
applicationName :: Text
conditionalToken :: Maybe Text
currentApplicationVersionId :: Maybe Natural
$sel:cloudWatchLoggingOption:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> CloudWatchLoggingOption
$sel:applicationName:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> Text
$sel:conditionalToken:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> Maybe Text
$sel:currentApplicationVersionId:AddApplicationCloudWatchLoggingOption' :: AddApplicationCloudWatchLoggingOption -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CurrentApplicationVersionId" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
currentApplicationVersionId,
            (Text
"ConditionalToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
conditionalToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ApplicationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"CloudWatchLoggingOption"
                  Text -> CloudWatchLoggingOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CloudWatchLoggingOption
cloudWatchLoggingOption
              )
          ]
      )

instance
  Core.ToPath
    AddApplicationCloudWatchLoggingOption
  where
  toPath :: AddApplicationCloudWatchLoggingOption -> ByteString
toPath = ByteString -> AddApplicationCloudWatchLoggingOption -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    AddApplicationCloudWatchLoggingOption
  where
  toQuery :: AddApplicationCloudWatchLoggingOption -> QueryString
toQuery = QueryString -> AddApplicationCloudWatchLoggingOption -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newAddApplicationCloudWatchLoggingOptionResponse' smart constructor.
data AddApplicationCloudWatchLoggingOptionResponse = AddApplicationCloudWatchLoggingOptionResponse'
  { -- | The application\'s ARN.
    AddApplicationCloudWatchLoggingOptionResponse -> Maybe Text
applicationARN :: Prelude.Maybe Prelude.Text,
    -- | The new version ID of the Kinesis Data Analytics application. Kinesis
    -- Data Analytics updates the @ApplicationVersionId@ each time you change
    -- the CloudWatch logging options.
    AddApplicationCloudWatchLoggingOptionResponse -> Maybe Natural
applicationVersionId :: Prelude.Maybe Prelude.Natural,
    -- | The descriptions of the current CloudWatch logging options for the
    -- Kinesis Data Analytics application.
    AddApplicationCloudWatchLoggingOptionResponse
-> Maybe [CloudWatchLoggingOptionDescription]
cloudWatchLoggingOptionDescriptions :: Prelude.Maybe [CloudWatchLoggingOptionDescription],
    -- | The response's http status code.
    AddApplicationCloudWatchLoggingOptionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AddApplicationCloudWatchLoggingOptionResponse
-> AddApplicationCloudWatchLoggingOptionResponse -> Bool
(AddApplicationCloudWatchLoggingOptionResponse
 -> AddApplicationCloudWatchLoggingOptionResponse -> Bool)
-> (AddApplicationCloudWatchLoggingOptionResponse
    -> AddApplicationCloudWatchLoggingOptionResponse -> Bool)
-> Eq AddApplicationCloudWatchLoggingOptionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddApplicationCloudWatchLoggingOptionResponse
-> AddApplicationCloudWatchLoggingOptionResponse -> Bool
$c/= :: AddApplicationCloudWatchLoggingOptionResponse
-> AddApplicationCloudWatchLoggingOptionResponse -> Bool
== :: AddApplicationCloudWatchLoggingOptionResponse
-> AddApplicationCloudWatchLoggingOptionResponse -> Bool
$c== :: AddApplicationCloudWatchLoggingOptionResponse
-> AddApplicationCloudWatchLoggingOptionResponse -> Bool
Prelude.Eq, ReadPrec [AddApplicationCloudWatchLoggingOptionResponse]
ReadPrec AddApplicationCloudWatchLoggingOptionResponse
Int -> ReadS AddApplicationCloudWatchLoggingOptionResponse
ReadS [AddApplicationCloudWatchLoggingOptionResponse]
(Int -> ReadS AddApplicationCloudWatchLoggingOptionResponse)
-> ReadS [AddApplicationCloudWatchLoggingOptionResponse]
-> ReadPrec AddApplicationCloudWatchLoggingOptionResponse
-> ReadPrec [AddApplicationCloudWatchLoggingOptionResponse]
-> Read AddApplicationCloudWatchLoggingOptionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddApplicationCloudWatchLoggingOptionResponse]
$creadListPrec :: ReadPrec [AddApplicationCloudWatchLoggingOptionResponse]
readPrec :: ReadPrec AddApplicationCloudWatchLoggingOptionResponse
$creadPrec :: ReadPrec AddApplicationCloudWatchLoggingOptionResponse
readList :: ReadS [AddApplicationCloudWatchLoggingOptionResponse]
$creadList :: ReadS [AddApplicationCloudWatchLoggingOptionResponse]
readsPrec :: Int -> ReadS AddApplicationCloudWatchLoggingOptionResponse
$creadsPrec :: Int -> ReadS AddApplicationCloudWatchLoggingOptionResponse
Prelude.Read, Int -> AddApplicationCloudWatchLoggingOptionResponse -> ShowS
[AddApplicationCloudWatchLoggingOptionResponse] -> ShowS
AddApplicationCloudWatchLoggingOptionResponse -> String
(Int -> AddApplicationCloudWatchLoggingOptionResponse -> ShowS)
-> (AddApplicationCloudWatchLoggingOptionResponse -> String)
-> ([AddApplicationCloudWatchLoggingOptionResponse] -> ShowS)
-> Show AddApplicationCloudWatchLoggingOptionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddApplicationCloudWatchLoggingOptionResponse] -> ShowS
$cshowList :: [AddApplicationCloudWatchLoggingOptionResponse] -> ShowS
show :: AddApplicationCloudWatchLoggingOptionResponse -> String
$cshow :: AddApplicationCloudWatchLoggingOptionResponse -> String
showsPrec :: Int -> AddApplicationCloudWatchLoggingOptionResponse -> ShowS
$cshowsPrec :: Int -> AddApplicationCloudWatchLoggingOptionResponse -> ShowS
Prelude.Show, (forall x.
 AddApplicationCloudWatchLoggingOptionResponse
 -> Rep AddApplicationCloudWatchLoggingOptionResponse x)
-> (forall x.
    Rep AddApplicationCloudWatchLoggingOptionResponse x
    -> AddApplicationCloudWatchLoggingOptionResponse)
-> Generic AddApplicationCloudWatchLoggingOptionResponse
forall x.
Rep AddApplicationCloudWatchLoggingOptionResponse x
-> AddApplicationCloudWatchLoggingOptionResponse
forall x.
AddApplicationCloudWatchLoggingOptionResponse
-> Rep AddApplicationCloudWatchLoggingOptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddApplicationCloudWatchLoggingOptionResponse x
-> AddApplicationCloudWatchLoggingOptionResponse
$cfrom :: forall x.
AddApplicationCloudWatchLoggingOptionResponse
-> Rep AddApplicationCloudWatchLoggingOptionResponse x
Prelude.Generic)

-- |
-- Create a value of 'AddApplicationCloudWatchLoggingOptionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'applicationARN', 'addApplicationCloudWatchLoggingOptionResponse_applicationARN' - The application\'s ARN.
--
-- 'applicationVersionId', 'addApplicationCloudWatchLoggingOptionResponse_applicationVersionId' - The new version ID of the Kinesis Data Analytics application. Kinesis
-- Data Analytics updates the @ApplicationVersionId@ each time you change
-- the CloudWatch logging options.
--
-- 'cloudWatchLoggingOptionDescriptions', 'addApplicationCloudWatchLoggingOptionResponse_cloudWatchLoggingOptionDescriptions' - The descriptions of the current CloudWatch logging options for the
-- Kinesis Data Analytics application.
--
-- 'httpStatus', 'addApplicationCloudWatchLoggingOptionResponse_httpStatus' - The response's http status code.
newAddApplicationCloudWatchLoggingOptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AddApplicationCloudWatchLoggingOptionResponse
newAddApplicationCloudWatchLoggingOptionResponse :: Int -> AddApplicationCloudWatchLoggingOptionResponse
newAddApplicationCloudWatchLoggingOptionResponse
  Int
pHttpStatus_ =
    AddApplicationCloudWatchLoggingOptionResponse' :: Maybe Text
-> Maybe Natural
-> Maybe [CloudWatchLoggingOptionDescription]
-> Int
-> AddApplicationCloudWatchLoggingOptionResponse
AddApplicationCloudWatchLoggingOptionResponse'
      { $sel:applicationARN:AddApplicationCloudWatchLoggingOptionResponse' :: Maybe Text
applicationARN =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationVersionId:AddApplicationCloudWatchLoggingOptionResponse' :: Maybe Natural
applicationVersionId =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:cloudWatchLoggingOptionDescriptions:AddApplicationCloudWatchLoggingOptionResponse' :: Maybe [CloudWatchLoggingOptionDescription]
cloudWatchLoggingOptionDescriptions =
          Maybe [CloudWatchLoggingOptionDescription]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:AddApplicationCloudWatchLoggingOptionResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The application\'s ARN.
addApplicationCloudWatchLoggingOptionResponse_applicationARN :: Lens.Lens' AddApplicationCloudWatchLoggingOptionResponse (Prelude.Maybe Prelude.Text)
addApplicationCloudWatchLoggingOptionResponse_applicationARN :: (Maybe Text -> f (Maybe Text))
-> AddApplicationCloudWatchLoggingOptionResponse
-> f AddApplicationCloudWatchLoggingOptionResponse
addApplicationCloudWatchLoggingOptionResponse_applicationARN = (AddApplicationCloudWatchLoggingOptionResponse -> Maybe Text)
-> (AddApplicationCloudWatchLoggingOptionResponse
    -> Maybe Text -> AddApplicationCloudWatchLoggingOptionResponse)
-> Lens
     AddApplicationCloudWatchLoggingOptionResponse
     AddApplicationCloudWatchLoggingOptionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOptionResponse' {Maybe Text
applicationARN :: Maybe Text
$sel:applicationARN:AddApplicationCloudWatchLoggingOptionResponse' :: AddApplicationCloudWatchLoggingOptionResponse -> Maybe Text
applicationARN} -> Maybe Text
applicationARN) (\s :: AddApplicationCloudWatchLoggingOptionResponse
s@AddApplicationCloudWatchLoggingOptionResponse' {} Maybe Text
a -> AddApplicationCloudWatchLoggingOptionResponse
s {$sel:applicationARN:AddApplicationCloudWatchLoggingOptionResponse' :: Maybe Text
applicationARN = Maybe Text
a} :: AddApplicationCloudWatchLoggingOptionResponse)

-- | The new version ID of the Kinesis Data Analytics application. Kinesis
-- Data Analytics updates the @ApplicationVersionId@ each time you change
-- the CloudWatch logging options.
addApplicationCloudWatchLoggingOptionResponse_applicationVersionId :: Lens.Lens' AddApplicationCloudWatchLoggingOptionResponse (Prelude.Maybe Prelude.Natural)
addApplicationCloudWatchLoggingOptionResponse_applicationVersionId :: (Maybe Natural -> f (Maybe Natural))
-> AddApplicationCloudWatchLoggingOptionResponse
-> f AddApplicationCloudWatchLoggingOptionResponse
addApplicationCloudWatchLoggingOptionResponse_applicationVersionId = (AddApplicationCloudWatchLoggingOptionResponse -> Maybe Natural)
-> (AddApplicationCloudWatchLoggingOptionResponse
    -> Maybe Natural -> AddApplicationCloudWatchLoggingOptionResponse)
-> Lens
     AddApplicationCloudWatchLoggingOptionResponse
     AddApplicationCloudWatchLoggingOptionResponse
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOptionResponse' {Maybe Natural
applicationVersionId :: Maybe Natural
$sel:applicationVersionId:AddApplicationCloudWatchLoggingOptionResponse' :: AddApplicationCloudWatchLoggingOptionResponse -> Maybe Natural
applicationVersionId} -> Maybe Natural
applicationVersionId) (\s :: AddApplicationCloudWatchLoggingOptionResponse
s@AddApplicationCloudWatchLoggingOptionResponse' {} Maybe Natural
a -> AddApplicationCloudWatchLoggingOptionResponse
s {$sel:applicationVersionId:AddApplicationCloudWatchLoggingOptionResponse' :: Maybe Natural
applicationVersionId = Maybe Natural
a} :: AddApplicationCloudWatchLoggingOptionResponse)

-- | The descriptions of the current CloudWatch logging options for the
-- Kinesis Data Analytics application.
addApplicationCloudWatchLoggingOptionResponse_cloudWatchLoggingOptionDescriptions :: Lens.Lens' AddApplicationCloudWatchLoggingOptionResponse (Prelude.Maybe [CloudWatchLoggingOptionDescription])
addApplicationCloudWatchLoggingOptionResponse_cloudWatchLoggingOptionDescriptions :: (Maybe [CloudWatchLoggingOptionDescription]
 -> f (Maybe [CloudWatchLoggingOptionDescription]))
-> AddApplicationCloudWatchLoggingOptionResponse
-> f AddApplicationCloudWatchLoggingOptionResponse
addApplicationCloudWatchLoggingOptionResponse_cloudWatchLoggingOptionDescriptions = (AddApplicationCloudWatchLoggingOptionResponse
 -> Maybe [CloudWatchLoggingOptionDescription])
-> (AddApplicationCloudWatchLoggingOptionResponse
    -> Maybe [CloudWatchLoggingOptionDescription]
    -> AddApplicationCloudWatchLoggingOptionResponse)
-> Lens
     AddApplicationCloudWatchLoggingOptionResponse
     AddApplicationCloudWatchLoggingOptionResponse
     (Maybe [CloudWatchLoggingOptionDescription])
     (Maybe [CloudWatchLoggingOptionDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOptionResponse' {Maybe [CloudWatchLoggingOptionDescription]
cloudWatchLoggingOptionDescriptions :: Maybe [CloudWatchLoggingOptionDescription]
$sel:cloudWatchLoggingOptionDescriptions:AddApplicationCloudWatchLoggingOptionResponse' :: AddApplicationCloudWatchLoggingOptionResponse
-> Maybe [CloudWatchLoggingOptionDescription]
cloudWatchLoggingOptionDescriptions} -> Maybe [CloudWatchLoggingOptionDescription]
cloudWatchLoggingOptionDescriptions) (\s :: AddApplicationCloudWatchLoggingOptionResponse
s@AddApplicationCloudWatchLoggingOptionResponse' {} Maybe [CloudWatchLoggingOptionDescription]
a -> AddApplicationCloudWatchLoggingOptionResponse
s {$sel:cloudWatchLoggingOptionDescriptions:AddApplicationCloudWatchLoggingOptionResponse' :: Maybe [CloudWatchLoggingOptionDescription]
cloudWatchLoggingOptionDescriptions = Maybe [CloudWatchLoggingOptionDescription]
a} :: AddApplicationCloudWatchLoggingOptionResponse) ((Maybe [CloudWatchLoggingOptionDescription]
  -> f (Maybe [CloudWatchLoggingOptionDescription]))
 -> AddApplicationCloudWatchLoggingOptionResponse
 -> f AddApplicationCloudWatchLoggingOptionResponse)
-> ((Maybe [CloudWatchLoggingOptionDescription]
     -> f (Maybe [CloudWatchLoggingOptionDescription]))
    -> Maybe [CloudWatchLoggingOptionDescription]
    -> f (Maybe [CloudWatchLoggingOptionDescription]))
-> (Maybe [CloudWatchLoggingOptionDescription]
    -> f (Maybe [CloudWatchLoggingOptionDescription]))
-> AddApplicationCloudWatchLoggingOptionResponse
-> f AddApplicationCloudWatchLoggingOptionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CloudWatchLoggingOptionDescription]
  [CloudWatchLoggingOptionDescription]
  [CloudWatchLoggingOptionDescription]
  [CloudWatchLoggingOptionDescription]
-> Iso
     (Maybe [CloudWatchLoggingOptionDescription])
     (Maybe [CloudWatchLoggingOptionDescription])
     (Maybe [CloudWatchLoggingOptionDescription])
     (Maybe [CloudWatchLoggingOptionDescription])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [CloudWatchLoggingOptionDescription]
  [CloudWatchLoggingOptionDescription]
  [CloudWatchLoggingOptionDescription]
  [CloudWatchLoggingOptionDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
addApplicationCloudWatchLoggingOptionResponse_httpStatus :: Lens.Lens' AddApplicationCloudWatchLoggingOptionResponse Prelude.Int
addApplicationCloudWatchLoggingOptionResponse_httpStatus :: (Int -> f Int)
-> AddApplicationCloudWatchLoggingOptionResponse
-> f AddApplicationCloudWatchLoggingOptionResponse
addApplicationCloudWatchLoggingOptionResponse_httpStatus = (AddApplicationCloudWatchLoggingOptionResponse -> Int)
-> (AddApplicationCloudWatchLoggingOptionResponse
    -> Int -> AddApplicationCloudWatchLoggingOptionResponse)
-> Lens
     AddApplicationCloudWatchLoggingOptionResponse
     AddApplicationCloudWatchLoggingOptionResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationCloudWatchLoggingOptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddApplicationCloudWatchLoggingOptionResponse' :: AddApplicationCloudWatchLoggingOptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddApplicationCloudWatchLoggingOptionResponse
s@AddApplicationCloudWatchLoggingOptionResponse' {} Int
a -> AddApplicationCloudWatchLoggingOptionResponse
s {$sel:httpStatus:AddApplicationCloudWatchLoggingOptionResponse' :: Int
httpStatus = Int
a} :: AddApplicationCloudWatchLoggingOptionResponse)

instance
  Prelude.NFData
    AddApplicationCloudWatchLoggingOptionResponse