{-# 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.KinesisAnalyticsV2.Types.CloudWatchLoggingOptionDescription
-- 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.KinesisAnalyticsV2.Types.CloudWatchLoggingOptionDescription where

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

-- | Describes the Amazon CloudWatch logging option.
--
-- /See:/ 'newCloudWatchLoggingOptionDescription' smart constructor.
data CloudWatchLoggingOptionDescription = CloudWatchLoggingOptionDescription'
  { -- | The ID of the CloudWatch logging option description.
    CloudWatchLoggingOptionDescription -> Maybe Text
cloudWatchLoggingOptionId :: Prelude.Maybe Prelude.Text,
    -- | The IAM ARN of the role to use to send application messages.
    --
    -- Provided for backward compatibility. Applications created with the
    -- current API version have an application-level service execution role
    -- rather than a resource-level role.
    CloudWatchLoggingOptionDescription -> Maybe Text
roleARN :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the CloudWatch log to receive
    -- application messages.
    CloudWatchLoggingOptionDescription -> Text
logStreamARN :: Prelude.Text
  }
  deriving (CloudWatchLoggingOptionDescription
-> CloudWatchLoggingOptionDescription -> Bool
(CloudWatchLoggingOptionDescription
 -> CloudWatchLoggingOptionDescription -> Bool)
-> (CloudWatchLoggingOptionDescription
    -> CloudWatchLoggingOptionDescription -> Bool)
-> Eq CloudWatchLoggingOptionDescription
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]
(Int -> ReadS CloudWatchLoggingOptionDescription)
-> ReadS [CloudWatchLoggingOptionDescription]
-> ReadPrec CloudWatchLoggingOptionDescription
-> ReadPrec [CloudWatchLoggingOptionDescription]
-> Read 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
(Int -> CloudWatchLoggingOptionDescription -> ShowS)
-> (CloudWatchLoggingOptionDescription -> String)
-> ([CloudWatchLoggingOptionDescription] -> ShowS)
-> Show CloudWatchLoggingOptionDescription
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.
 CloudWatchLoggingOptionDescription
 -> Rep CloudWatchLoggingOptionDescription x)
-> (forall x.
    Rep CloudWatchLoggingOptionDescription x
    -> CloudWatchLoggingOptionDescription)
-> Generic CloudWatchLoggingOptionDescription
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' - The ID of the CloudWatch logging option description.
--
-- 'roleARN', 'cloudWatchLoggingOptionDescription_roleARN' - The IAM ARN of the role to use to send application messages.
--
-- Provided for backward compatibility. Applications created with the
-- current API version have an application-level service execution role
-- rather than a resource-level role.
--
-- 'logStreamARN', 'cloudWatchLoggingOptionDescription_logStreamARN' - The Amazon Resource Name (ARN) of the CloudWatch log to receive
-- application messages.
newCloudWatchLoggingOptionDescription ::
  -- | 'logStreamARN'
  Prelude.Text ->
  CloudWatchLoggingOptionDescription
newCloudWatchLoggingOptionDescription :: Text -> CloudWatchLoggingOptionDescription
newCloudWatchLoggingOptionDescription Text
pLogStreamARN_ =
  CloudWatchLoggingOptionDescription' :: Maybe Text
-> Maybe Text -> Text -> CloudWatchLoggingOptionDescription
CloudWatchLoggingOptionDescription'
    { $sel:cloudWatchLoggingOptionId:CloudWatchLoggingOptionDescription' :: Maybe Text
cloudWatchLoggingOptionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleARN:CloudWatchLoggingOptionDescription' :: Maybe Text
roleARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:logStreamARN:CloudWatchLoggingOptionDescription' :: Text
logStreamARN = Text
pLogStreamARN_
    }

-- | The ID of the CloudWatch logging option description.
cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId :: Lens.Lens' CloudWatchLoggingOptionDescription (Prelude.Maybe Prelude.Text)
cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLoggingOptionDescription
-> f CloudWatchLoggingOptionDescription
cloudWatchLoggingOptionDescription_cloudWatchLoggingOptionId = (CloudWatchLoggingOptionDescription -> Maybe Text)
-> (CloudWatchLoggingOptionDescription
    -> Maybe Text -> CloudWatchLoggingOptionDescription)
-> Lens
     CloudWatchLoggingOptionDescription
     CloudWatchLoggingOptionDescription
     (Maybe Text)
     (Maybe Text)
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)

-- | The IAM ARN of the role to use to send application messages.
--
-- Provided for backward compatibility. Applications created with the
-- current API version have an application-level service execution role
-- rather than a resource-level role.
cloudWatchLoggingOptionDescription_roleARN :: Lens.Lens' CloudWatchLoggingOptionDescription (Prelude.Maybe Prelude.Text)
cloudWatchLoggingOptionDescription_roleARN :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLoggingOptionDescription
-> f CloudWatchLoggingOptionDescription
cloudWatchLoggingOptionDescription_roleARN = (CloudWatchLoggingOptionDescription -> Maybe Text)
-> (CloudWatchLoggingOptionDescription
    -> Maybe Text -> CloudWatchLoggingOptionDescription)
-> Lens
     CloudWatchLoggingOptionDescription
     CloudWatchLoggingOptionDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLoggingOptionDescription' {Maybe Text
roleARN :: Maybe Text
$sel:roleARN:CloudWatchLoggingOptionDescription' :: CloudWatchLoggingOptionDescription -> Maybe Text
roleARN} -> Maybe Text
roleARN) (\s :: CloudWatchLoggingOptionDescription
s@CloudWatchLoggingOptionDescription' {} Maybe Text
a -> CloudWatchLoggingOptionDescription
s {$sel:roleARN:CloudWatchLoggingOptionDescription' :: Maybe Text
roleARN = Maybe Text
a} :: CloudWatchLoggingOptionDescription)

-- | The Amazon Resource Name (ARN) of the CloudWatch log to receive
-- application messages.
cloudWatchLoggingOptionDescription_logStreamARN :: Lens.Lens' CloudWatchLoggingOptionDescription Prelude.Text
cloudWatchLoggingOptionDescription_logStreamARN :: (Text -> f Text)
-> CloudWatchLoggingOptionDescription
-> f CloudWatchLoggingOptionDescription
cloudWatchLoggingOptionDescription_logStreamARN = (CloudWatchLoggingOptionDescription -> Text)
-> (CloudWatchLoggingOptionDescription
    -> Text -> CloudWatchLoggingOptionDescription)
-> Lens
     CloudWatchLoggingOptionDescription
     CloudWatchLoggingOptionDescription
     Text
     Text
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)

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

instance
  Prelude.Hashable
    CloudWatchLoggingOptionDescription

instance
  Prelude.NFData
    CloudWatchLoggingOptionDescription