{-# 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.CloudWatchLoggingOptionDescription
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisAnalytics.Types.CloudWatchLoggingOptionDescription where

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

-- | Description of the CloudWatch logging option.
--
-- /See:/ 'newCloudWatchLoggingOptionDescription' smart constructor.
data CloudWatchLoggingOptionDescription = CloudWatchLoggingOptionDescription'
  { -- | ID of the CloudWatch logging option description.
    CloudWatchLoggingOptionDescription -> Maybe Text
cloudWatchLoggingOptionId :: Prelude.Maybe Prelude.Text,
    -- | ARN of the CloudWatch log to receive application messages.
    CloudWatchLoggingOptionDescription -> Text
logStreamARN :: Prelude.Text,
    -- | 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.
    CloudWatchLoggingOptionDescription -> Text
roleARN :: Prelude.Text
  }
  deriving (CloudWatchLoggingOptionDescription
-> CloudWatchLoggingOptionDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLoggingOptionDescription
-> CloudWatchLoggingOptionDescription -> Bool
$c/= :: CloudWatchLoggingOptionDescription
-> CloudWatchLoggingOptionDescription -> Bool
== :: CloudWatchLoggingOptionDescription
-> CloudWatchLoggingOptionDescription -> Bool
$c== :: CloudWatchLoggingOptionDescription
-> CloudWatchLoggingOptionDescription -> Bool
Prelude.Eq, ReadPrec [CloudWatchLoggingOptionDescription]
ReadPrec CloudWatchLoggingOptionDescription
Int -> ReadS CloudWatchLoggingOptionDescription
ReadS [CloudWatchLoggingOptionDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLoggingOptionDescription]
$creadListPrec :: ReadPrec [CloudWatchLoggingOptionDescription]
readPrec :: ReadPrec CloudWatchLoggingOptionDescription
$creadPrec :: ReadPrec CloudWatchLoggingOptionDescription
readList :: ReadS [CloudWatchLoggingOptionDescription]
$creadList :: ReadS [CloudWatchLoggingOptionDescription]
readsPrec :: Int -> ReadS CloudWatchLoggingOptionDescription
$creadsPrec :: Int -> ReadS CloudWatchLoggingOptionDescription
Prelude.Read, Int -> CloudWatchLoggingOptionDescription -> ShowS
[CloudWatchLoggingOptionDescription] -> ShowS
CloudWatchLoggingOptionDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLoggingOptionDescription] -> ShowS
$cshowList :: [CloudWatchLoggingOptionDescription] -> ShowS
show :: CloudWatchLoggingOptionDescription -> String
$cshow :: CloudWatchLoggingOptionDescription -> String
showsPrec :: Int -> CloudWatchLoggingOptionDescription -> ShowS
$cshowsPrec :: Int -> CloudWatchLoggingOptionDescription -> ShowS
Prelude.Show, forall x.
Rep CloudWatchLoggingOptionDescription x
-> CloudWatchLoggingOptionDescription
forall x.
CloudWatchLoggingOptionDescription
-> Rep CloudWatchLoggingOptionDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchLoggingOptionDescription x
-> CloudWatchLoggingOptionDescription
$cfrom :: forall x.
CloudWatchLoggingOptionDescription
-> Rep CloudWatchLoggingOptionDescription x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchLoggingOptionDescription' 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:
--
-- 'cloudWatchLoggingOptionId', 'cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId' - ID of the CloudWatch logging option description.
--
-- 'logStreamARN', 'cloudWatchLoggingOptionDescription_logStreamARN' - ARN of the CloudWatch log to receive application messages.
--
-- 'roleARN', 'cloudWatchLoggingOptionDescription_roleARN' - 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.
newCloudWatchLoggingOptionDescription ::
  -- | 'logStreamARN'
  Prelude.Text ->
  -- | 'roleARN'
  Prelude.Text ->
  CloudWatchLoggingOptionDescription
newCloudWatchLoggingOptionDescription :: Text -> Text -> CloudWatchLoggingOptionDescription
newCloudWatchLoggingOptionDescription
  Text
pLogStreamARN_
  Text
pRoleARN_ =
    CloudWatchLoggingOptionDescription'
      { $sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionDescription' :: Maybe Text
cloudWatchLoggingOptionId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:logStreamARN:CloudWatchLoggingOptionDescription' :: Text
logStreamARN = Text
pLogStreamARN_,
        $sel:roleARN:CloudWatchLoggingOptionDescription' :: Text
roleARN = Text
pRoleARN_
      }

-- | ID of the CloudWatch logging option description.
cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId :: Lens.Lens' CloudWatchLoggingOptionDescription (Prelude.Maybe Prelude.Text)
cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId :: Lens' CloudWatchLoggingOptionDescription (Maybe Text)
cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLoggingOptionDescription' {Maybe Text
cloudWatchLoggingOptionId :: Maybe Text
$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Maybe Text
cloudWatchLoggingOptionId} -> Maybe Text
cloudWatchLoggingOptionId) (\s :: CloudWatchLoggingOptionDescription
s@CloudWatchLoggingOptionDescription' {} Maybe Text
a -> CloudWatchLoggingOptionDescription
s {$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionDescription' :: Maybe Text
cloudWatchLoggingOptionId = Maybe Text
a} :: CloudWatchLoggingOptionDescription)

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

-- | 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.
cloudWatchLoggingOptionDescription_roleARN :: Lens.Lens' CloudWatchLoggingOptionDescription Prelude.Text
cloudWatchLoggingOptionDescription_roleARN :: Lens' CloudWatchLoggingOptionDescription Text
cloudWatchLoggingOptionDescription_roleARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLoggingOptionDescription' {Text
roleARN :: Text
$sel:roleARN:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Text
roleARN} -> Text
roleARN) (\s :: CloudWatchLoggingOptionDescription
s@CloudWatchLoggingOptionDescription' {} Text
a -> CloudWatchLoggingOptionDescription
s {$sel:roleARN:CloudWatchLoggingOptionDescription' :: Text
roleARN = Text
a} :: CloudWatchLoggingOptionDescription)

instance
  Data.FromJSON
    CloudWatchLoggingOptionDescription
  where
  parseJSON :: Value -> Parser CloudWatchLoggingOptionDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudWatchLoggingOptionDescription"
      ( \Object
x ->
          Maybe Text -> Text -> Text -> CloudWatchLoggingOptionDescription
CloudWatchLoggingOptionDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CloudWatchLoggingOptionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LogStreamARN")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RoleARN")
      )

instance
  Prelude.Hashable
    CloudWatchLoggingOptionDescription
  where
  hashWithSalt :: Int -> CloudWatchLoggingOptionDescription -> Int
hashWithSalt
    Int
_salt
    CloudWatchLoggingOptionDescription' {Maybe Text
Text
roleARN :: Text
logStreamARN :: Text
cloudWatchLoggingOptionId :: Maybe Text
$sel:roleARN:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Text
$sel:logStreamARN:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Text
$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudWatchLoggingOptionId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logStreamARN
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleARN

instance
  Prelude.NFData
    CloudWatchLoggingOptionDescription
  where
  rnf :: CloudWatchLoggingOptionDescription -> ()
rnf CloudWatchLoggingOptionDescription' {Maybe Text
Text
roleARN :: Text
logStreamARN :: Text
cloudWatchLoggingOptionId :: Maybe Text
$sel:roleARN:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Text
$sel:logStreamARN:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Text
$sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudWatchLoggingOptionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
logStreamARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleARN