{-# 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.EC2.Types.VerifiedAccessLogS3Destination
-- 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.EC2.Types.VerifiedAccessLogS3Destination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.VerifiedAccessLogDeliveryStatus
import qualified Amazonka.Prelude as Prelude

-- | Options for Amazon S3 as a logging destination.
--
-- /See:/ 'newVerifiedAccessLogS3Destination' smart constructor.
data VerifiedAccessLogS3Destination = VerifiedAccessLogS3Destination'
  { -- | The bucket name.
    VerifiedAccessLogS3Destination -> Maybe Text
bucketName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account number that owns the bucket.
    VerifiedAccessLogS3Destination -> Maybe Text
bucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The delivery status.
    VerifiedAccessLogS3Destination
-> Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus :: Prelude.Maybe VerifiedAccessLogDeliveryStatus,
    -- | Indicates whether logging is enabled.
    VerifiedAccessLogS3Destination -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The bucket prefix.
    VerifiedAccessLogS3Destination -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text
  }
  deriving (VerifiedAccessLogS3Destination
-> VerifiedAccessLogS3Destination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VerifiedAccessLogS3Destination
-> VerifiedAccessLogS3Destination -> Bool
$c/= :: VerifiedAccessLogS3Destination
-> VerifiedAccessLogS3Destination -> Bool
== :: VerifiedAccessLogS3Destination
-> VerifiedAccessLogS3Destination -> Bool
$c== :: VerifiedAccessLogS3Destination
-> VerifiedAccessLogS3Destination -> Bool
Prelude.Eq, ReadPrec [VerifiedAccessLogS3Destination]
ReadPrec VerifiedAccessLogS3Destination
Int -> ReadS VerifiedAccessLogS3Destination
ReadS [VerifiedAccessLogS3Destination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VerifiedAccessLogS3Destination]
$creadListPrec :: ReadPrec [VerifiedAccessLogS3Destination]
readPrec :: ReadPrec VerifiedAccessLogS3Destination
$creadPrec :: ReadPrec VerifiedAccessLogS3Destination
readList :: ReadS [VerifiedAccessLogS3Destination]
$creadList :: ReadS [VerifiedAccessLogS3Destination]
readsPrec :: Int -> ReadS VerifiedAccessLogS3Destination
$creadsPrec :: Int -> ReadS VerifiedAccessLogS3Destination
Prelude.Read, Int -> VerifiedAccessLogS3Destination -> ShowS
[VerifiedAccessLogS3Destination] -> ShowS
VerifiedAccessLogS3Destination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VerifiedAccessLogS3Destination] -> ShowS
$cshowList :: [VerifiedAccessLogS3Destination] -> ShowS
show :: VerifiedAccessLogS3Destination -> String
$cshow :: VerifiedAccessLogS3Destination -> String
showsPrec :: Int -> VerifiedAccessLogS3Destination -> ShowS
$cshowsPrec :: Int -> VerifiedAccessLogS3Destination -> ShowS
Prelude.Show, forall x.
Rep VerifiedAccessLogS3Destination x
-> VerifiedAccessLogS3Destination
forall x.
VerifiedAccessLogS3Destination
-> Rep VerifiedAccessLogS3Destination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VerifiedAccessLogS3Destination x
-> VerifiedAccessLogS3Destination
$cfrom :: forall x.
VerifiedAccessLogS3Destination
-> Rep VerifiedAccessLogS3Destination x
Prelude.Generic)

-- |
-- Create a value of 'VerifiedAccessLogS3Destination' 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:
--
-- 'bucketName', 'verifiedAccessLogS3Destination_bucketName' - The bucket name.
--
-- 'bucketOwner', 'verifiedAccessLogS3Destination_bucketOwner' - The Amazon Web Services account number that owns the bucket.
--
-- 'deliveryStatus', 'verifiedAccessLogS3Destination_deliveryStatus' - The delivery status.
--
-- 'enabled', 'verifiedAccessLogS3Destination_enabled' - Indicates whether logging is enabled.
--
-- 'prefix', 'verifiedAccessLogS3Destination_prefix' - The bucket prefix.
newVerifiedAccessLogS3Destination ::
  VerifiedAccessLogS3Destination
newVerifiedAccessLogS3Destination :: VerifiedAccessLogS3Destination
newVerifiedAccessLogS3Destination =
  VerifiedAccessLogS3Destination'
    { $sel:bucketName:VerifiedAccessLogS3Destination' :: Maybe Text
bucketName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:bucketOwner:VerifiedAccessLogS3Destination' :: Maybe Text
bucketOwner = forall a. Maybe a
Prelude.Nothing,
      $sel:deliveryStatus:VerifiedAccessLogS3Destination' :: Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:VerifiedAccessLogS3Destination' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:VerifiedAccessLogS3Destination' :: Maybe Text
prefix = forall a. Maybe a
Prelude.Nothing
    }

-- | The bucket name.
verifiedAccessLogS3Destination_bucketName :: Lens.Lens' VerifiedAccessLogS3Destination (Prelude.Maybe Prelude.Text)
verifiedAccessLogS3Destination_bucketName :: Lens' VerifiedAccessLogS3Destination (Maybe Text)
verifiedAccessLogS3Destination_bucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifiedAccessLogS3Destination' {Maybe Text
bucketName :: Maybe Text
$sel:bucketName:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
bucketName} -> Maybe Text
bucketName) (\s :: VerifiedAccessLogS3Destination
s@VerifiedAccessLogS3Destination' {} Maybe Text
a -> VerifiedAccessLogS3Destination
s {$sel:bucketName:VerifiedAccessLogS3Destination' :: Maybe Text
bucketName = Maybe Text
a} :: VerifiedAccessLogS3Destination)

-- | The Amazon Web Services account number that owns the bucket.
verifiedAccessLogS3Destination_bucketOwner :: Lens.Lens' VerifiedAccessLogS3Destination (Prelude.Maybe Prelude.Text)
verifiedAccessLogS3Destination_bucketOwner :: Lens' VerifiedAccessLogS3Destination (Maybe Text)
verifiedAccessLogS3Destination_bucketOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifiedAccessLogS3Destination' {Maybe Text
bucketOwner :: Maybe Text
$sel:bucketOwner:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
bucketOwner} -> Maybe Text
bucketOwner) (\s :: VerifiedAccessLogS3Destination
s@VerifiedAccessLogS3Destination' {} Maybe Text
a -> VerifiedAccessLogS3Destination
s {$sel:bucketOwner:VerifiedAccessLogS3Destination' :: Maybe Text
bucketOwner = Maybe Text
a} :: VerifiedAccessLogS3Destination)

-- | The delivery status.
verifiedAccessLogS3Destination_deliveryStatus :: Lens.Lens' VerifiedAccessLogS3Destination (Prelude.Maybe VerifiedAccessLogDeliveryStatus)
verifiedAccessLogS3Destination_deliveryStatus :: Lens'
  VerifiedAccessLogS3Destination
  (Maybe VerifiedAccessLogDeliveryStatus)
verifiedAccessLogS3Destination_deliveryStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifiedAccessLogS3Destination' {Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus :: Maybe VerifiedAccessLogDeliveryStatus
$sel:deliveryStatus:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination
-> Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus} -> Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus) (\s :: VerifiedAccessLogS3Destination
s@VerifiedAccessLogS3Destination' {} Maybe VerifiedAccessLogDeliveryStatus
a -> VerifiedAccessLogS3Destination
s {$sel:deliveryStatus:VerifiedAccessLogS3Destination' :: Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus = Maybe VerifiedAccessLogDeliveryStatus
a} :: VerifiedAccessLogS3Destination)

-- | Indicates whether logging is enabled.
verifiedAccessLogS3Destination_enabled :: Lens.Lens' VerifiedAccessLogS3Destination (Prelude.Maybe Prelude.Bool)
verifiedAccessLogS3Destination_enabled :: Lens' VerifiedAccessLogS3Destination (Maybe Bool)
verifiedAccessLogS3Destination_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifiedAccessLogS3Destination' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: VerifiedAccessLogS3Destination
s@VerifiedAccessLogS3Destination' {} Maybe Bool
a -> VerifiedAccessLogS3Destination
s {$sel:enabled:VerifiedAccessLogS3Destination' :: Maybe Bool
enabled = Maybe Bool
a} :: VerifiedAccessLogS3Destination)

-- | The bucket prefix.
verifiedAccessLogS3Destination_prefix :: Lens.Lens' VerifiedAccessLogS3Destination (Prelude.Maybe Prelude.Text)
verifiedAccessLogS3Destination_prefix :: Lens' VerifiedAccessLogS3Destination (Maybe Text)
verifiedAccessLogS3Destination_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifiedAccessLogS3Destination' {Maybe Text
prefix :: Maybe Text
$sel:prefix:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: VerifiedAccessLogS3Destination
s@VerifiedAccessLogS3Destination' {} Maybe Text
a -> VerifiedAccessLogS3Destination
s {$sel:prefix:VerifiedAccessLogS3Destination' :: Maybe Text
prefix = Maybe Text
a} :: VerifiedAccessLogS3Destination)

instance Data.FromXML VerifiedAccessLogS3Destination where
  parseXML :: [Node] -> Either String VerifiedAccessLogS3Destination
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe VerifiedAccessLogDeliveryStatus
-> Maybe Bool
-> Maybe Text
-> VerifiedAccessLogS3Destination
VerifiedAccessLogS3Destination'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"bucketName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"bucketOwner")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"deliveryStatus")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"enabled")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"prefix")

instance
  Prelude.Hashable
    VerifiedAccessLogS3Destination
  where
  hashWithSalt :: Int -> VerifiedAccessLogS3Destination -> Int
hashWithSalt
    Int
_salt
    VerifiedAccessLogS3Destination' {Maybe Bool
Maybe Text
Maybe VerifiedAccessLogDeliveryStatus
prefix :: Maybe Text
enabled :: Maybe Bool
deliveryStatus :: Maybe VerifiedAccessLogDeliveryStatus
bucketOwner :: Maybe Text
bucketName :: Maybe Text
$sel:prefix:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
$sel:enabled:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Bool
$sel:deliveryStatus:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination
-> Maybe VerifiedAccessLogDeliveryStatus
$sel:bucketOwner:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
$sel:bucketName:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bucketName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bucketOwner
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefix

instance
  Prelude.NFData
    VerifiedAccessLogS3Destination
  where
  rnf :: VerifiedAccessLogS3Destination -> ()
rnf VerifiedAccessLogS3Destination' {Maybe Bool
Maybe Text
Maybe VerifiedAccessLogDeliveryStatus
prefix :: Maybe Text
enabled :: Maybe Bool
deliveryStatus :: Maybe VerifiedAccessLogDeliveryStatus
bucketOwner :: Maybe Text
bucketName :: Maybe Text
$sel:prefix:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
$sel:enabled:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Bool
$sel:deliveryStatus:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination
-> Maybe VerifiedAccessLogDeliveryStatus
$sel:bucketOwner:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
$sel:bucketName:VerifiedAccessLogS3Destination' :: VerifiedAccessLogS3Destination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bucketOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VerifiedAccessLogDeliveryStatus
deliveryStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prefix