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

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

-- |
-- Module      : Amazonka.KinesisAnalytics.Types.CloudWatchLoggingOptionUpdate
-- 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)
module Amazonka.KinesisAnalytics.Types.CloudWatchLoggingOptionUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes CloudWatch logging option updates.
--
-- /See:/ 'newCloudWatchLoggingOptionUpdate' smart constructor.
data CloudWatchLoggingOptionUpdate = CloudWatchLoggingOptionUpdate'
  { -- | IAM ARN of the role to use to send application messages. Note: To write
    -- application messages to CloudWatch, the IAM role used must have the
    -- @PutLogEvents@ policy action enabled.
    CloudWatchLoggingOptionUpdate -> Maybe Text
roleARNUpdate :: Prelude.Maybe Prelude.Text,
    -- | ARN of the CloudWatch log to receive application messages.
    CloudWatchLoggingOptionUpdate -> Maybe Text
logStreamARNUpdate :: Prelude.Maybe Prelude.Text,
    -- | ID of the CloudWatch logging option to update
    CloudWatchLoggingOptionUpdate -> Text
cloudWatchLoggingOptionId :: Prelude.Text
  }
  deriving (CloudWatchLoggingOptionUpdate
-> CloudWatchLoggingOptionUpdate -> Bool
(CloudWatchLoggingOptionUpdate
 -> CloudWatchLoggingOptionUpdate -> Bool)
-> (CloudWatchLoggingOptionUpdate
    -> CloudWatchLoggingOptionUpdate -> Bool)
-> Eq CloudWatchLoggingOptionUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLoggingOptionUpdate
-> CloudWatchLoggingOptionUpdate -> Bool
$c/= :: CloudWatchLoggingOptionUpdate
-> CloudWatchLoggingOptionUpdate -> Bool
== :: CloudWatchLoggingOptionUpdate
-> CloudWatchLoggingOptionUpdate -> Bool
$c== :: CloudWatchLoggingOptionUpdate
-> CloudWatchLoggingOptionUpdate -> Bool
Prelude.Eq, ReadPrec [CloudWatchLoggingOptionUpdate]
ReadPrec CloudWatchLoggingOptionUpdate
Int -> ReadS CloudWatchLoggingOptionUpdate
ReadS [CloudWatchLoggingOptionUpdate]
(Int -> ReadS CloudWatchLoggingOptionUpdate)
-> ReadS [CloudWatchLoggingOptionUpdate]
-> ReadPrec CloudWatchLoggingOptionUpdate
-> ReadPrec [CloudWatchLoggingOptionUpdate]
-> Read CloudWatchLoggingOptionUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLoggingOptionUpdate]
$creadListPrec :: ReadPrec [CloudWatchLoggingOptionUpdate]
readPrec :: ReadPrec CloudWatchLoggingOptionUpdate
$creadPrec :: ReadPrec CloudWatchLoggingOptionUpdate
readList :: ReadS [CloudWatchLoggingOptionUpdate]
$creadList :: ReadS [CloudWatchLoggingOptionUpdate]
readsPrec :: Int -> ReadS CloudWatchLoggingOptionUpdate
$creadsPrec :: Int -> ReadS CloudWatchLoggingOptionUpdate
Prelude.Read, Int -> CloudWatchLoggingOptionUpdate -> ShowS
[CloudWatchLoggingOptionUpdate] -> ShowS
CloudWatchLoggingOptionUpdate -> String
(Int -> CloudWatchLoggingOptionUpdate -> ShowS)
-> (CloudWatchLoggingOptionUpdate -> String)
-> ([CloudWatchLoggingOptionUpdate] -> ShowS)
-> Show CloudWatchLoggingOptionUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLoggingOptionUpdate] -> ShowS
$cshowList :: [CloudWatchLoggingOptionUpdate] -> ShowS
show :: CloudWatchLoggingOptionUpdate -> String
$cshow :: CloudWatchLoggingOptionUpdate -> String
showsPrec :: Int -> CloudWatchLoggingOptionUpdate -> ShowS
$cshowsPrec :: Int -> CloudWatchLoggingOptionUpdate -> ShowS
Prelude.Show, (forall x.
 CloudWatchLoggingOptionUpdate
 -> Rep CloudWatchLoggingOptionUpdate x)
-> (forall x.
    Rep CloudWatchLoggingOptionUpdate x
    -> CloudWatchLoggingOptionUpdate)
-> Generic CloudWatchLoggingOptionUpdate
forall x.
Rep CloudWatchLoggingOptionUpdate x
-> CloudWatchLoggingOptionUpdate
forall x.
CloudWatchLoggingOptionUpdate
-> Rep CloudWatchLoggingOptionUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchLoggingOptionUpdate x
-> CloudWatchLoggingOptionUpdate
$cfrom :: forall x.
CloudWatchLoggingOptionUpdate
-> Rep CloudWatchLoggingOptionUpdate x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchLoggingOptionUpdate' 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:
--
-- 'roleARNUpdate', 'cloudWatchLoggingOptionUpdate_roleARNUpdate' - IAM ARN of the role to use to send application messages. Note: To write
-- application messages to CloudWatch, the IAM role used must have the
-- @PutLogEvents@ policy action enabled.
--
-- 'logStreamARNUpdate', 'cloudWatchLoggingOptionUpdate_logStreamARNUpdate' - ARN of the CloudWatch log to receive application messages.
--
-- 'cloudWatchLoggingOptionId', 'cloudWatchLoggingOptionUpdate_cloudWatchLoggingOptionId' - ID of the CloudWatch logging option to update
newCloudWatchLoggingOptionUpdate ::
  -- | 'cloudWatchLoggingOptionId'
  Prelude.Text ->
  CloudWatchLoggingOptionUpdate
newCloudWatchLoggingOptionUpdate :: Text -> CloudWatchLoggingOptionUpdate
newCloudWatchLoggingOptionUpdate
  Text
pCloudWatchLoggingOptionId_ =
    CloudWatchLoggingOptionUpdate' :: Maybe Text -> Maybe Text -> Text -> CloudWatchLoggingOptionUpdate
CloudWatchLoggingOptionUpdate'
      { $sel:roleARNUpdate:CloudWatchLoggingOptionUpdate' :: Maybe Text
roleARNUpdate =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:logStreamARNUpdate:CloudWatchLoggingOptionUpdate' :: Maybe Text
logStreamARNUpdate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionUpdate' :: Text
cloudWatchLoggingOptionId =
          Text
pCloudWatchLoggingOptionId_
      }

-- | IAM ARN of the role to use to send application messages. Note: To write
-- application messages to CloudWatch, the IAM role used must have the
-- @PutLogEvents@ policy action enabled.
cloudWatchLoggingOptionUpdate_roleARNUpdate :: Lens.Lens' CloudWatchLoggingOptionUpdate (Prelude.Maybe Prelude.Text)
cloudWatchLoggingOptionUpdate_roleARNUpdate :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLoggingOptionUpdate -> f CloudWatchLoggingOptionUpdate
cloudWatchLoggingOptionUpdate_roleARNUpdate = (CloudWatchLoggingOptionUpdate -> Maybe Text)
-> (CloudWatchLoggingOptionUpdate
    -> Maybe Text -> CloudWatchLoggingOptionUpdate)
-> Lens
     CloudWatchLoggingOptionUpdate
     CloudWatchLoggingOptionUpdate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLoggingOptionUpdate' {Maybe Text
roleARNUpdate :: Maybe Text
$sel:roleARNUpdate:CloudWatchLoggingOptionUpdate' :: CloudWatchLoggingOptionUpdate -> Maybe Text
roleARNUpdate} -> Maybe Text
roleARNUpdate) (\s :: CloudWatchLoggingOptionUpdate
s@CloudWatchLoggingOptionUpdate' {} Maybe Text
a -> CloudWatchLoggingOptionUpdate
s {$sel:roleARNUpdate:CloudWatchLoggingOptionUpdate' :: Maybe Text
roleARNUpdate = Maybe Text
a} :: CloudWatchLoggingOptionUpdate)

-- | ARN of the CloudWatch log to receive application messages.
cloudWatchLoggingOptionUpdate_logStreamARNUpdate :: Lens.Lens' CloudWatchLoggingOptionUpdate (Prelude.Maybe Prelude.Text)
cloudWatchLoggingOptionUpdate_logStreamARNUpdate :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLoggingOptionUpdate -> f CloudWatchLoggingOptionUpdate
cloudWatchLoggingOptionUpdate_logStreamARNUpdate = (CloudWatchLoggingOptionUpdate -> Maybe Text)
-> (CloudWatchLoggingOptionUpdate
    -> Maybe Text -> CloudWatchLoggingOptionUpdate)
-> Lens
     CloudWatchLoggingOptionUpdate
     CloudWatchLoggingOptionUpdate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLoggingOptionUpdate' {Maybe Text
logStreamARNUpdate :: Maybe Text
$sel:logStreamARNUpdate:CloudWatchLoggingOptionUpdate' :: CloudWatchLoggingOptionUpdate -> Maybe Text
logStreamARNUpdate} -> Maybe Text
logStreamARNUpdate) (\s :: CloudWatchLoggingOptionUpdate
s@CloudWatchLoggingOptionUpdate' {} Maybe Text
a -> CloudWatchLoggingOptionUpdate
s {$sel:logStreamARNUpdate:CloudWatchLoggingOptionUpdate' :: Maybe Text
logStreamARNUpdate = Maybe Text
a} :: CloudWatchLoggingOptionUpdate)

-- | ID of the CloudWatch logging option to update
cloudWatchLoggingOptionUpdate_cloudWatchLoggingOptionId :: Lens.Lens' CloudWatchLoggingOptionUpdate Prelude.Text
cloudWatchLoggingOptionUpdate_cloudWatchLoggingOptionId :: (Text -> f Text)
-> CloudWatchLoggingOptionUpdate -> f CloudWatchLoggingOptionUpdate
cloudWatchLoggingOptionUpdate_cloudWatchLoggingOptionId = (CloudWatchLoggingOptionUpdate -> Text)
-> (CloudWatchLoggingOptionUpdate
    -> Text -> CloudWatchLoggingOptionUpdate)
-> Lens
     CloudWatchLoggingOptionUpdate
     CloudWatchLoggingOptionUpdate
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLoggingOptionUpdate' {Text
cloudWatchLoggingOptionId :: Text
$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionUpdate' :: CloudWatchLoggingOptionUpdate -> Text
cloudWatchLoggingOptionId} -> Text
cloudWatchLoggingOptionId) (\s :: CloudWatchLoggingOptionUpdate
s@CloudWatchLoggingOptionUpdate' {} Text
a -> CloudWatchLoggingOptionUpdate
s {$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionUpdate' :: Text
cloudWatchLoggingOptionId = Text
a} :: CloudWatchLoggingOptionUpdate)

instance
  Prelude.Hashable
    CloudWatchLoggingOptionUpdate

instance Prelude.NFData CloudWatchLoggingOptionUpdate

instance Core.ToJSON CloudWatchLoggingOptionUpdate where
  toJSON :: CloudWatchLoggingOptionUpdate -> Value
toJSON CloudWatchLoggingOptionUpdate' {Maybe Text
Text
cloudWatchLoggingOptionId :: Text
logStreamARNUpdate :: Maybe Text
roleARNUpdate :: Maybe Text
$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionUpdate' :: CloudWatchLoggingOptionUpdate -> Text
$sel:logStreamARNUpdate:CloudWatchLoggingOptionUpdate' :: CloudWatchLoggingOptionUpdate -> Maybe Text
$sel:roleARNUpdate:CloudWatchLoggingOptionUpdate' :: CloudWatchLoggingOptionUpdate -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RoleARNUpdate" 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
roleARNUpdate,
            (Text
"LogStreamARNUpdate" 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
logStreamARNUpdate,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"CloudWatchLoggingOptionId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cloudWatchLoggingOptionId
              )
          ]
      )