{-# 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.MediaLive.Types.ArchiveS3Settings
-- 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.MediaLive.Types.ArchiveS3Settings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.S3CannedAcl
import qualified Amazonka.Prelude as Prelude

-- | Archive S3 Settings
--
-- /See:/ 'newArchiveS3Settings' smart constructor.
data ArchiveS3Settings = ArchiveS3Settings'
  { -- | Specify the canned ACL to apply to each S3 request. Defaults to none.
    ArchiveS3Settings -> Maybe S3CannedAcl
cannedAcl :: Prelude.Maybe S3CannedAcl
  }
  deriving (ArchiveS3Settings -> ArchiveS3Settings -> Bool
(ArchiveS3Settings -> ArchiveS3Settings -> Bool)
-> (ArchiveS3Settings -> ArchiveS3Settings -> Bool)
-> Eq ArchiveS3Settings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchiveS3Settings -> ArchiveS3Settings -> Bool
$c/= :: ArchiveS3Settings -> ArchiveS3Settings -> Bool
== :: ArchiveS3Settings -> ArchiveS3Settings -> Bool
$c== :: ArchiveS3Settings -> ArchiveS3Settings -> Bool
Prelude.Eq, ReadPrec [ArchiveS3Settings]
ReadPrec ArchiveS3Settings
Int -> ReadS ArchiveS3Settings
ReadS [ArchiveS3Settings]
(Int -> ReadS ArchiveS3Settings)
-> ReadS [ArchiveS3Settings]
-> ReadPrec ArchiveS3Settings
-> ReadPrec [ArchiveS3Settings]
-> Read ArchiveS3Settings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchiveS3Settings]
$creadListPrec :: ReadPrec [ArchiveS3Settings]
readPrec :: ReadPrec ArchiveS3Settings
$creadPrec :: ReadPrec ArchiveS3Settings
readList :: ReadS [ArchiveS3Settings]
$creadList :: ReadS [ArchiveS3Settings]
readsPrec :: Int -> ReadS ArchiveS3Settings
$creadsPrec :: Int -> ReadS ArchiveS3Settings
Prelude.Read, Int -> ArchiveS3Settings -> ShowS
[ArchiveS3Settings] -> ShowS
ArchiveS3Settings -> String
(Int -> ArchiveS3Settings -> ShowS)
-> (ArchiveS3Settings -> String)
-> ([ArchiveS3Settings] -> ShowS)
-> Show ArchiveS3Settings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchiveS3Settings] -> ShowS
$cshowList :: [ArchiveS3Settings] -> ShowS
show :: ArchiveS3Settings -> String
$cshow :: ArchiveS3Settings -> String
showsPrec :: Int -> ArchiveS3Settings -> ShowS
$cshowsPrec :: Int -> ArchiveS3Settings -> ShowS
Prelude.Show, (forall x. ArchiveS3Settings -> Rep ArchiveS3Settings x)
-> (forall x. Rep ArchiveS3Settings x -> ArchiveS3Settings)
-> Generic ArchiveS3Settings
forall x. Rep ArchiveS3Settings x -> ArchiveS3Settings
forall x. ArchiveS3Settings -> Rep ArchiveS3Settings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArchiveS3Settings x -> ArchiveS3Settings
$cfrom :: forall x. ArchiveS3Settings -> Rep ArchiveS3Settings x
Prelude.Generic)

-- |
-- Create a value of 'ArchiveS3Settings' 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:
--
-- 'cannedAcl', 'archiveS3Settings_cannedAcl' - Specify the canned ACL to apply to each S3 request. Defaults to none.
newArchiveS3Settings ::
  ArchiveS3Settings
newArchiveS3Settings :: ArchiveS3Settings
newArchiveS3Settings =
  ArchiveS3Settings' :: Maybe S3CannedAcl -> ArchiveS3Settings
ArchiveS3Settings' {$sel:cannedAcl:ArchiveS3Settings' :: Maybe S3CannedAcl
cannedAcl = Maybe S3CannedAcl
forall a. Maybe a
Prelude.Nothing}

-- | Specify the canned ACL to apply to each S3 request. Defaults to none.
archiveS3Settings_cannedAcl :: Lens.Lens' ArchiveS3Settings (Prelude.Maybe S3CannedAcl)
archiveS3Settings_cannedAcl :: (Maybe S3CannedAcl -> f (Maybe S3CannedAcl))
-> ArchiveS3Settings -> f ArchiveS3Settings
archiveS3Settings_cannedAcl = (ArchiveS3Settings -> Maybe S3CannedAcl)
-> (ArchiveS3Settings -> Maybe S3CannedAcl -> ArchiveS3Settings)
-> Lens
     ArchiveS3Settings
     ArchiveS3Settings
     (Maybe S3CannedAcl)
     (Maybe S3CannedAcl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveS3Settings' {Maybe S3CannedAcl
cannedAcl :: Maybe S3CannedAcl
$sel:cannedAcl:ArchiveS3Settings' :: ArchiveS3Settings -> Maybe S3CannedAcl
cannedAcl} -> Maybe S3CannedAcl
cannedAcl) (\s :: ArchiveS3Settings
s@ArchiveS3Settings' {} Maybe S3CannedAcl
a -> ArchiveS3Settings
s {$sel:cannedAcl:ArchiveS3Settings' :: Maybe S3CannedAcl
cannedAcl = Maybe S3CannedAcl
a} :: ArchiveS3Settings)

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

instance Prelude.Hashable ArchiveS3Settings

instance Prelude.NFData ArchiveS3Settings

instance Core.ToJSON ArchiveS3Settings where
  toJSON :: ArchiveS3Settings -> Value
toJSON ArchiveS3Settings' {Maybe S3CannedAcl
cannedAcl :: Maybe S3CannedAcl
$sel:cannedAcl:ArchiveS3Settings' :: ArchiveS3Settings -> Maybe S3CannedAcl
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"cannedAcl" Text -> S3CannedAcl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3CannedAcl -> Pair) -> Maybe S3CannedAcl -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3CannedAcl
cannedAcl]
      )