{-# 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.ElasticTranscoder.Types.PipelineOutputConfig
-- 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.ElasticTranscoder.Types.PipelineOutputConfig where

import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.Types.Permission
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The @PipelineOutputConfig@ structure.
--
-- /See:/ 'newPipelineOutputConfig' smart constructor.
data PipelineOutputConfig = PipelineOutputConfig'
  { -- | The Amazon S3 bucket in which you want Elastic Transcoder to save the
    -- transcoded files. Specify this value when all of the following are true:
    --
    -- -   You want to save transcoded files, thumbnails (if any), and
    --     playlists (if any) together in one bucket.
    --
    -- -   You do not want to specify the users or groups who have access to
    --     the transcoded files, thumbnails, and playlists.
    --
    -- -   You do not want to specify the permissions that Elastic Transcoder
    --     grants to the files.
    --
    -- -   You want to associate the transcoded files and thumbnails with the
    --     Amazon S3 Standard storage class.
    --
    -- If you want to save transcoded files and playlists in one bucket and
    -- thumbnails in another bucket, specify which users can access the
    -- transcoded files or the permissions the users have, or change the Amazon
    -- S3 storage class, omit OutputBucket and specify values for
    -- @ContentConfig@ and @ThumbnailConfig@ instead.
    PipelineOutputConfig -> Maybe Text
bucket :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 storage class, @Standard@ or @ReducedRedundancy@, that you
    -- want Elastic Transcoder to assign to the video files and playlists that
    -- it stores in your Amazon S3 bucket.
    PipelineOutputConfig -> Maybe Text
storageClass :: Prelude.Maybe Prelude.Text,
    -- | Optional. The @Permissions@ object specifies which users and\/or
    -- predefined Amazon S3 groups you want to have access to transcoded files
    -- and playlists, and the type of access you want them to have. You can
    -- grant permissions to a maximum of 30 users and\/or predefined Amazon S3
    -- groups.
    --
    -- If you include @Permissions@, Elastic Transcoder grants only the
    -- permissions that you specify. It does not grant full permissions to the
    -- owner of the role specified by @Role@. If you want that user to have
    -- full control, you must explicitly grant full control to the user.
    --
    -- If you omit @Permissions@, Elastic Transcoder grants full control over
    -- the transcoded files and playlists to the owner of the role specified by
    -- @Role@, and grants no other permissions to any other user or group.
    PipelineOutputConfig -> Maybe [Permission]
permissions :: Prelude.Maybe [Permission]
  }
  deriving (PipelineOutputConfig -> PipelineOutputConfig -> Bool
(PipelineOutputConfig -> PipelineOutputConfig -> Bool)
-> (PipelineOutputConfig -> PipelineOutputConfig -> Bool)
-> Eq PipelineOutputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineOutputConfig -> PipelineOutputConfig -> Bool
$c/= :: PipelineOutputConfig -> PipelineOutputConfig -> Bool
== :: PipelineOutputConfig -> PipelineOutputConfig -> Bool
$c== :: PipelineOutputConfig -> PipelineOutputConfig -> Bool
Prelude.Eq, ReadPrec [PipelineOutputConfig]
ReadPrec PipelineOutputConfig
Int -> ReadS PipelineOutputConfig
ReadS [PipelineOutputConfig]
(Int -> ReadS PipelineOutputConfig)
-> ReadS [PipelineOutputConfig]
-> ReadPrec PipelineOutputConfig
-> ReadPrec [PipelineOutputConfig]
-> Read PipelineOutputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineOutputConfig]
$creadListPrec :: ReadPrec [PipelineOutputConfig]
readPrec :: ReadPrec PipelineOutputConfig
$creadPrec :: ReadPrec PipelineOutputConfig
readList :: ReadS [PipelineOutputConfig]
$creadList :: ReadS [PipelineOutputConfig]
readsPrec :: Int -> ReadS PipelineOutputConfig
$creadsPrec :: Int -> ReadS PipelineOutputConfig
Prelude.Read, Int -> PipelineOutputConfig -> ShowS
[PipelineOutputConfig] -> ShowS
PipelineOutputConfig -> String
(Int -> PipelineOutputConfig -> ShowS)
-> (PipelineOutputConfig -> String)
-> ([PipelineOutputConfig] -> ShowS)
-> Show PipelineOutputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineOutputConfig] -> ShowS
$cshowList :: [PipelineOutputConfig] -> ShowS
show :: PipelineOutputConfig -> String
$cshow :: PipelineOutputConfig -> String
showsPrec :: Int -> PipelineOutputConfig -> ShowS
$cshowsPrec :: Int -> PipelineOutputConfig -> ShowS
Prelude.Show, (forall x. PipelineOutputConfig -> Rep PipelineOutputConfig x)
-> (forall x. Rep PipelineOutputConfig x -> PipelineOutputConfig)
-> Generic PipelineOutputConfig
forall x. Rep PipelineOutputConfig x -> PipelineOutputConfig
forall x. PipelineOutputConfig -> Rep PipelineOutputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineOutputConfig x -> PipelineOutputConfig
$cfrom :: forall x. PipelineOutputConfig -> Rep PipelineOutputConfig x
Prelude.Generic)

-- |
-- Create a value of 'PipelineOutputConfig' 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:
--
-- 'bucket', 'pipelineOutputConfig_bucket' - The Amazon S3 bucket in which you want Elastic Transcoder to save the
-- transcoded files. Specify this value when all of the following are true:
--
-- -   You want to save transcoded files, thumbnails (if any), and
--     playlists (if any) together in one bucket.
--
-- -   You do not want to specify the users or groups who have access to
--     the transcoded files, thumbnails, and playlists.
--
-- -   You do not want to specify the permissions that Elastic Transcoder
--     grants to the files.
--
-- -   You want to associate the transcoded files and thumbnails with the
--     Amazon S3 Standard storage class.
--
-- If you want to save transcoded files and playlists in one bucket and
-- thumbnails in another bucket, specify which users can access the
-- transcoded files or the permissions the users have, or change the Amazon
-- S3 storage class, omit OutputBucket and specify values for
-- @ContentConfig@ and @ThumbnailConfig@ instead.
--
-- 'storageClass', 'pipelineOutputConfig_storageClass' - The Amazon S3 storage class, @Standard@ or @ReducedRedundancy@, that you
-- want Elastic Transcoder to assign to the video files and playlists that
-- it stores in your Amazon S3 bucket.
--
-- 'permissions', 'pipelineOutputConfig_permissions' - Optional. The @Permissions@ object specifies which users and\/or
-- predefined Amazon S3 groups you want to have access to transcoded files
-- and playlists, and the type of access you want them to have. You can
-- grant permissions to a maximum of 30 users and\/or predefined Amazon S3
-- groups.
--
-- If you include @Permissions@, Elastic Transcoder grants only the
-- permissions that you specify. It does not grant full permissions to the
-- owner of the role specified by @Role@. If you want that user to have
-- full control, you must explicitly grant full control to the user.
--
-- If you omit @Permissions@, Elastic Transcoder grants full control over
-- the transcoded files and playlists to the owner of the role specified by
-- @Role@, and grants no other permissions to any other user or group.
newPipelineOutputConfig ::
  PipelineOutputConfig
newPipelineOutputConfig :: PipelineOutputConfig
newPipelineOutputConfig =
  PipelineOutputConfig' :: Maybe Text
-> Maybe Text -> Maybe [Permission] -> PipelineOutputConfig
PipelineOutputConfig'
    { $sel:bucket:PipelineOutputConfig' :: Maybe Text
bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:storageClass:PipelineOutputConfig' :: Maybe Text
storageClass = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:PipelineOutputConfig' :: Maybe [Permission]
permissions = Maybe [Permission]
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon S3 bucket in which you want Elastic Transcoder to save the
-- transcoded files. Specify this value when all of the following are true:
--
-- -   You want to save transcoded files, thumbnails (if any), and
--     playlists (if any) together in one bucket.
--
-- -   You do not want to specify the users or groups who have access to
--     the transcoded files, thumbnails, and playlists.
--
-- -   You do not want to specify the permissions that Elastic Transcoder
--     grants to the files.
--
-- -   You want to associate the transcoded files and thumbnails with the
--     Amazon S3 Standard storage class.
--
-- If you want to save transcoded files and playlists in one bucket and
-- thumbnails in another bucket, specify which users can access the
-- transcoded files or the permissions the users have, or change the Amazon
-- S3 storage class, omit OutputBucket and specify values for
-- @ContentConfig@ and @ThumbnailConfig@ instead.
pipelineOutputConfig_bucket :: Lens.Lens' PipelineOutputConfig (Prelude.Maybe Prelude.Text)
pipelineOutputConfig_bucket :: (Maybe Text -> f (Maybe Text))
-> PipelineOutputConfig -> f PipelineOutputConfig
pipelineOutputConfig_bucket = (PipelineOutputConfig -> Maybe Text)
-> (PipelineOutputConfig -> Maybe Text -> PipelineOutputConfig)
-> Lens
     PipelineOutputConfig PipelineOutputConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineOutputConfig' {Maybe Text
bucket :: Maybe Text
$sel:bucket:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
bucket} -> Maybe Text
bucket) (\s :: PipelineOutputConfig
s@PipelineOutputConfig' {} Maybe Text
a -> PipelineOutputConfig
s {$sel:bucket:PipelineOutputConfig' :: Maybe Text
bucket = Maybe Text
a} :: PipelineOutputConfig)

-- | The Amazon S3 storage class, @Standard@ or @ReducedRedundancy@, that you
-- want Elastic Transcoder to assign to the video files and playlists that
-- it stores in your Amazon S3 bucket.
pipelineOutputConfig_storageClass :: Lens.Lens' PipelineOutputConfig (Prelude.Maybe Prelude.Text)
pipelineOutputConfig_storageClass :: (Maybe Text -> f (Maybe Text))
-> PipelineOutputConfig -> f PipelineOutputConfig
pipelineOutputConfig_storageClass = (PipelineOutputConfig -> Maybe Text)
-> (PipelineOutputConfig -> Maybe Text -> PipelineOutputConfig)
-> Lens
     PipelineOutputConfig PipelineOutputConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineOutputConfig' {Maybe Text
storageClass :: Maybe Text
$sel:storageClass:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
storageClass} -> Maybe Text
storageClass) (\s :: PipelineOutputConfig
s@PipelineOutputConfig' {} Maybe Text
a -> PipelineOutputConfig
s {$sel:storageClass:PipelineOutputConfig' :: Maybe Text
storageClass = Maybe Text
a} :: PipelineOutputConfig)

-- | Optional. The @Permissions@ object specifies which users and\/or
-- predefined Amazon S3 groups you want to have access to transcoded files
-- and playlists, and the type of access you want them to have. You can
-- grant permissions to a maximum of 30 users and\/or predefined Amazon S3
-- groups.
--
-- If you include @Permissions@, Elastic Transcoder grants only the
-- permissions that you specify. It does not grant full permissions to the
-- owner of the role specified by @Role@. If you want that user to have
-- full control, you must explicitly grant full control to the user.
--
-- If you omit @Permissions@, Elastic Transcoder grants full control over
-- the transcoded files and playlists to the owner of the role specified by
-- @Role@, and grants no other permissions to any other user or group.
pipelineOutputConfig_permissions :: Lens.Lens' PipelineOutputConfig (Prelude.Maybe [Permission])
pipelineOutputConfig_permissions :: (Maybe [Permission] -> f (Maybe [Permission]))
-> PipelineOutputConfig -> f PipelineOutputConfig
pipelineOutputConfig_permissions = (PipelineOutputConfig -> Maybe [Permission])
-> (PipelineOutputConfig
    -> Maybe [Permission] -> PipelineOutputConfig)
-> Lens
     PipelineOutputConfig
     PipelineOutputConfig
     (Maybe [Permission])
     (Maybe [Permission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineOutputConfig' {Maybe [Permission]
permissions :: Maybe [Permission]
$sel:permissions:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe [Permission]
permissions} -> Maybe [Permission]
permissions) (\s :: PipelineOutputConfig
s@PipelineOutputConfig' {} Maybe [Permission]
a -> PipelineOutputConfig
s {$sel:permissions:PipelineOutputConfig' :: Maybe [Permission]
permissions = Maybe [Permission]
a} :: PipelineOutputConfig) ((Maybe [Permission] -> f (Maybe [Permission]))
 -> PipelineOutputConfig -> f PipelineOutputConfig)
-> ((Maybe [Permission] -> f (Maybe [Permission]))
    -> Maybe [Permission] -> f (Maybe [Permission]))
-> (Maybe [Permission] -> f (Maybe [Permission]))
-> PipelineOutputConfig
-> f PipelineOutputConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Permission] [Permission] [Permission] [Permission]
-> Iso
     (Maybe [Permission])
     (Maybe [Permission])
     (Maybe [Permission])
     (Maybe [Permission])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Permission] [Permission] [Permission] [Permission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PipelineOutputConfig where
  parseJSON :: Value -> Parser PipelineOutputConfig
parseJSON =
    String
-> (Object -> Parser PipelineOutputConfig)
-> Value
-> Parser PipelineOutputConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PipelineOutputConfig"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe [Permission] -> PipelineOutputConfig
PipelineOutputConfig'
            (Maybe Text
 -> Maybe Text -> Maybe [Permission] -> PipelineOutputConfig)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe [Permission] -> PipelineOutputConfig)
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
"Bucket")
            Parser (Maybe Text -> Maybe [Permission] -> PipelineOutputConfig)
-> Parser (Maybe Text)
-> Parser (Maybe [Permission] -> PipelineOutputConfig)
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
"StorageClass")
            Parser (Maybe [Permission] -> PipelineOutputConfig)
-> Parser (Maybe [Permission]) -> Parser PipelineOutputConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Permission]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Permissions" Parser (Maybe (Maybe [Permission]))
-> Maybe [Permission] -> Parser (Maybe [Permission])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Permission]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable PipelineOutputConfig

instance Prelude.NFData PipelineOutputConfig

instance Core.ToJSON PipelineOutputConfig where
  toJSON :: PipelineOutputConfig -> Value
toJSON PipelineOutputConfig' {Maybe [Permission]
Maybe Text
permissions :: Maybe [Permission]
storageClass :: Maybe Text
bucket :: Maybe Text
$sel:permissions:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe [Permission]
$sel:storageClass:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
$sel:bucket:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
bucket,
            (Text
"StorageClass" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
storageClass,
            (Text
"Permissions" Text -> [Permission] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Permission] -> Pair) -> Maybe [Permission] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Permission]
permissions
          ]
      )