{-# 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.KafkaConnect.Types.S3LogDeliveryDescription
-- 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.KafkaConnect.Types.S3LogDeliveryDescription where

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

-- | The description of the details about delivering logs to Amazon S3.
--
-- /See:/ 'newS3LogDeliveryDescription' smart constructor.
data S3LogDeliveryDescription = S3LogDeliveryDescription'
  { -- | Specifies whether connector logs get sent to the specified Amazon S3
    -- destination.
    S3LogDeliveryDescription -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The S3 prefix that is the destination for log delivery.
    S3LogDeliveryDescription -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | The name of the S3 bucket that is the destination for log delivery.
    S3LogDeliveryDescription -> Maybe Text
bucket :: Prelude.Maybe Prelude.Text
  }
  deriving (S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool
(S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool)
-> (S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool)
-> Eq S3LogDeliveryDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool
$c/= :: S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool
== :: S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool
$c== :: S3LogDeliveryDescription -> S3LogDeliveryDescription -> Bool
Prelude.Eq, ReadPrec [S3LogDeliveryDescription]
ReadPrec S3LogDeliveryDescription
Int -> ReadS S3LogDeliveryDescription
ReadS [S3LogDeliveryDescription]
(Int -> ReadS S3LogDeliveryDescription)
-> ReadS [S3LogDeliveryDescription]
-> ReadPrec S3LogDeliveryDescription
-> ReadPrec [S3LogDeliveryDescription]
-> Read S3LogDeliveryDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3LogDeliveryDescription]
$creadListPrec :: ReadPrec [S3LogDeliveryDescription]
readPrec :: ReadPrec S3LogDeliveryDescription
$creadPrec :: ReadPrec S3LogDeliveryDescription
readList :: ReadS [S3LogDeliveryDescription]
$creadList :: ReadS [S3LogDeliveryDescription]
readsPrec :: Int -> ReadS S3LogDeliveryDescription
$creadsPrec :: Int -> ReadS S3LogDeliveryDescription
Prelude.Read, Int -> S3LogDeliveryDescription -> ShowS
[S3LogDeliveryDescription] -> ShowS
S3LogDeliveryDescription -> String
(Int -> S3LogDeliveryDescription -> ShowS)
-> (S3LogDeliveryDescription -> String)
-> ([S3LogDeliveryDescription] -> ShowS)
-> Show S3LogDeliveryDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3LogDeliveryDescription] -> ShowS
$cshowList :: [S3LogDeliveryDescription] -> ShowS
show :: S3LogDeliveryDescription -> String
$cshow :: S3LogDeliveryDescription -> String
showsPrec :: Int -> S3LogDeliveryDescription -> ShowS
$cshowsPrec :: Int -> S3LogDeliveryDescription -> ShowS
Prelude.Show, (forall x.
 S3LogDeliveryDescription -> Rep S3LogDeliveryDescription x)
-> (forall x.
    Rep S3LogDeliveryDescription x -> S3LogDeliveryDescription)
-> Generic S3LogDeliveryDescription
forall x.
Rep S3LogDeliveryDescription x -> S3LogDeliveryDescription
forall x.
S3LogDeliveryDescription -> Rep S3LogDeliveryDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3LogDeliveryDescription x -> S3LogDeliveryDescription
$cfrom :: forall x.
S3LogDeliveryDescription -> Rep S3LogDeliveryDescription x
Prelude.Generic)

-- |
-- Create a value of 'S3LogDeliveryDescription' 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:
--
-- 'enabled', 's3LogDeliveryDescription_enabled' - Specifies whether connector logs get sent to the specified Amazon S3
-- destination.
--
-- 'prefix', 's3LogDeliveryDescription_prefix' - The S3 prefix that is the destination for log delivery.
--
-- 'bucket', 's3LogDeliveryDescription_bucket' - The name of the S3 bucket that is the destination for log delivery.
newS3LogDeliveryDescription ::
  S3LogDeliveryDescription
newS3LogDeliveryDescription :: S3LogDeliveryDescription
newS3LogDeliveryDescription =
  S3LogDeliveryDescription' :: Maybe Bool -> Maybe Text -> Maybe Text -> S3LogDeliveryDescription
S3LogDeliveryDescription'
    { $sel:enabled:S3LogDeliveryDescription' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:S3LogDeliveryDescription' :: Maybe Text
prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:S3LogDeliveryDescription' :: Maybe Text
bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether connector logs get sent to the specified Amazon S3
-- destination.
s3LogDeliveryDescription_enabled :: Lens.Lens' S3LogDeliveryDescription (Prelude.Maybe Prelude.Bool)
s3LogDeliveryDescription_enabled :: (Maybe Bool -> f (Maybe Bool))
-> S3LogDeliveryDescription -> f S3LogDeliveryDescription
s3LogDeliveryDescription_enabled = (S3LogDeliveryDescription -> Maybe Bool)
-> (S3LogDeliveryDescription
    -> Maybe Bool -> S3LogDeliveryDescription)
-> Lens
     S3LogDeliveryDescription
     S3LogDeliveryDescription
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3LogDeliveryDescription' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:S3LogDeliveryDescription' :: S3LogDeliveryDescription -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: S3LogDeliveryDescription
s@S3LogDeliveryDescription' {} Maybe Bool
a -> S3LogDeliveryDescription
s {$sel:enabled:S3LogDeliveryDescription' :: Maybe Bool
enabled = Maybe Bool
a} :: S3LogDeliveryDescription)

-- | The S3 prefix that is the destination for log delivery.
s3LogDeliveryDescription_prefix :: Lens.Lens' S3LogDeliveryDescription (Prelude.Maybe Prelude.Text)
s3LogDeliveryDescription_prefix :: (Maybe Text -> f (Maybe Text))
-> S3LogDeliveryDescription -> f S3LogDeliveryDescription
s3LogDeliveryDescription_prefix = (S3LogDeliveryDescription -> Maybe Text)
-> (S3LogDeliveryDescription
    -> Maybe Text -> S3LogDeliveryDescription)
-> Lens
     S3LogDeliveryDescription
     S3LogDeliveryDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3LogDeliveryDescription' {Maybe Text
prefix :: Maybe Text
$sel:prefix:S3LogDeliveryDescription' :: S3LogDeliveryDescription -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: S3LogDeliveryDescription
s@S3LogDeliveryDescription' {} Maybe Text
a -> S3LogDeliveryDescription
s {$sel:prefix:S3LogDeliveryDescription' :: Maybe Text
prefix = Maybe Text
a} :: S3LogDeliveryDescription)

-- | The name of the S3 bucket that is the destination for log delivery.
s3LogDeliveryDescription_bucket :: Lens.Lens' S3LogDeliveryDescription (Prelude.Maybe Prelude.Text)
s3LogDeliveryDescription_bucket :: (Maybe Text -> f (Maybe Text))
-> S3LogDeliveryDescription -> f S3LogDeliveryDescription
s3LogDeliveryDescription_bucket = (S3LogDeliveryDescription -> Maybe Text)
-> (S3LogDeliveryDescription
    -> Maybe Text -> S3LogDeliveryDescription)
-> Lens
     S3LogDeliveryDescription
     S3LogDeliveryDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3LogDeliveryDescription' {Maybe Text
bucket :: Maybe Text
$sel:bucket:S3LogDeliveryDescription' :: S3LogDeliveryDescription -> Maybe Text
bucket} -> Maybe Text
bucket) (\s :: S3LogDeliveryDescription
s@S3LogDeliveryDescription' {} Maybe Text
a -> S3LogDeliveryDescription
s {$sel:bucket:S3LogDeliveryDescription' :: Maybe Text
bucket = Maybe Text
a} :: S3LogDeliveryDescription)

instance Core.FromJSON S3LogDeliveryDescription where
  parseJSON :: Value -> Parser S3LogDeliveryDescription
parseJSON =
    String
-> (Object -> Parser S3LogDeliveryDescription)
-> Value
-> Parser S3LogDeliveryDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3LogDeliveryDescription"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Maybe Text -> S3LogDeliveryDescription
S3LogDeliveryDescription'
            (Maybe Bool
 -> Maybe Text -> Maybe Text -> S3LogDeliveryDescription)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> S3LogDeliveryDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"enabled")
            Parser (Maybe Text -> Maybe Text -> S3LogDeliveryDescription)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> S3LogDeliveryDescription)
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
"prefix")
            Parser (Maybe Text -> S3LogDeliveryDescription)
-> Parser (Maybe Text) -> Parser S3LogDeliveryDescription
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
"bucket")
      )

instance Prelude.Hashable S3LogDeliveryDescription

instance Prelude.NFData S3LogDeliveryDescription