{-# 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.MediaConvert.Types.S3DestinationAccessControl
-- 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.MediaConvert.Types.S3DestinationAccessControl where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.S3ObjectCannedAcl
import qualified Amazonka.Prelude as Prelude

-- | Optional. Have MediaConvert automatically apply Amazon S3 access control
-- for the outputs in this output group. When you don\'t use this setting,
-- S3 automatically applies the default access control list PRIVATE.
--
-- /See:/ 'newS3DestinationAccessControl' smart constructor.
data S3DestinationAccessControl = S3DestinationAccessControl'
  { -- | Choose an Amazon S3 canned ACL for MediaConvert to apply to this output.
    S3DestinationAccessControl -> Maybe S3ObjectCannedAcl
cannedAcl :: Prelude.Maybe S3ObjectCannedAcl
  }
  deriving (S3DestinationAccessControl -> S3DestinationAccessControl -> Bool
(S3DestinationAccessControl -> S3DestinationAccessControl -> Bool)
-> (S3DestinationAccessControl
    -> S3DestinationAccessControl -> Bool)
-> Eq S3DestinationAccessControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3DestinationAccessControl -> S3DestinationAccessControl -> Bool
$c/= :: S3DestinationAccessControl -> S3DestinationAccessControl -> Bool
== :: S3DestinationAccessControl -> S3DestinationAccessControl -> Bool
$c== :: S3DestinationAccessControl -> S3DestinationAccessControl -> Bool
Prelude.Eq, ReadPrec [S3DestinationAccessControl]
ReadPrec S3DestinationAccessControl
Int -> ReadS S3DestinationAccessControl
ReadS [S3DestinationAccessControl]
(Int -> ReadS S3DestinationAccessControl)
-> ReadS [S3DestinationAccessControl]
-> ReadPrec S3DestinationAccessControl
-> ReadPrec [S3DestinationAccessControl]
-> Read S3DestinationAccessControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3DestinationAccessControl]
$creadListPrec :: ReadPrec [S3DestinationAccessControl]
readPrec :: ReadPrec S3DestinationAccessControl
$creadPrec :: ReadPrec S3DestinationAccessControl
readList :: ReadS [S3DestinationAccessControl]
$creadList :: ReadS [S3DestinationAccessControl]
readsPrec :: Int -> ReadS S3DestinationAccessControl
$creadsPrec :: Int -> ReadS S3DestinationAccessControl
Prelude.Read, Int -> S3DestinationAccessControl -> ShowS
[S3DestinationAccessControl] -> ShowS
S3DestinationAccessControl -> String
(Int -> S3DestinationAccessControl -> ShowS)
-> (S3DestinationAccessControl -> String)
-> ([S3DestinationAccessControl] -> ShowS)
-> Show S3DestinationAccessControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3DestinationAccessControl] -> ShowS
$cshowList :: [S3DestinationAccessControl] -> ShowS
show :: S3DestinationAccessControl -> String
$cshow :: S3DestinationAccessControl -> String
showsPrec :: Int -> S3DestinationAccessControl -> ShowS
$cshowsPrec :: Int -> S3DestinationAccessControl -> ShowS
Prelude.Show, (forall x.
 S3DestinationAccessControl -> Rep S3DestinationAccessControl x)
-> (forall x.
    Rep S3DestinationAccessControl x -> S3DestinationAccessControl)
-> Generic S3DestinationAccessControl
forall x.
Rep S3DestinationAccessControl x -> S3DestinationAccessControl
forall x.
S3DestinationAccessControl -> Rep S3DestinationAccessControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3DestinationAccessControl x -> S3DestinationAccessControl
$cfrom :: forall x.
S3DestinationAccessControl -> Rep S3DestinationAccessControl x
Prelude.Generic)

-- |
-- Create a value of 'S3DestinationAccessControl' 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', 's3DestinationAccessControl_cannedAcl' - Choose an Amazon S3 canned ACL for MediaConvert to apply to this output.
newS3DestinationAccessControl ::
  S3DestinationAccessControl
newS3DestinationAccessControl :: S3DestinationAccessControl
newS3DestinationAccessControl =
  S3DestinationAccessControl' :: Maybe S3ObjectCannedAcl -> S3DestinationAccessControl
S3DestinationAccessControl'
    { $sel:cannedAcl:S3DestinationAccessControl' :: Maybe S3ObjectCannedAcl
cannedAcl =
        Maybe S3ObjectCannedAcl
forall a. Maybe a
Prelude.Nothing
    }

-- | Choose an Amazon S3 canned ACL for MediaConvert to apply to this output.
s3DestinationAccessControl_cannedAcl :: Lens.Lens' S3DestinationAccessControl (Prelude.Maybe S3ObjectCannedAcl)
s3DestinationAccessControl_cannedAcl :: (Maybe S3ObjectCannedAcl -> f (Maybe S3ObjectCannedAcl))
-> S3DestinationAccessControl -> f S3DestinationAccessControl
s3DestinationAccessControl_cannedAcl = (S3DestinationAccessControl -> Maybe S3ObjectCannedAcl)
-> (S3DestinationAccessControl
    -> Maybe S3ObjectCannedAcl -> S3DestinationAccessControl)
-> Lens
     S3DestinationAccessControl
     S3DestinationAccessControl
     (Maybe S3ObjectCannedAcl)
     (Maybe S3ObjectCannedAcl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationAccessControl' {Maybe S3ObjectCannedAcl
cannedAcl :: Maybe S3ObjectCannedAcl
$sel:cannedAcl:S3DestinationAccessControl' :: S3DestinationAccessControl -> Maybe S3ObjectCannedAcl
cannedAcl} -> Maybe S3ObjectCannedAcl
cannedAcl) (\s :: S3DestinationAccessControl
s@S3DestinationAccessControl' {} Maybe S3ObjectCannedAcl
a -> S3DestinationAccessControl
s {$sel:cannedAcl:S3DestinationAccessControl' :: Maybe S3ObjectCannedAcl
cannedAcl = Maybe S3ObjectCannedAcl
a} :: S3DestinationAccessControl)

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

instance Prelude.Hashable S3DestinationAccessControl

instance Prelude.NFData S3DestinationAccessControl

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