{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticTranscoder.Types.PipelineOutputConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticTranscoder.Types.Permission
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,
    -- | 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],
    -- | 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
  }
  deriving (PipelineOutputConfig -> PipelineOutputConfig -> Bool
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]
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
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. 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.
--
-- '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.
--
-- '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.
newPipelineOutputConfig ::
  PipelineOutputConfig
newPipelineOutputConfig :: PipelineOutputConfig
newPipelineOutputConfig =
  PipelineOutputConfig'
    { $sel:bucket:PipelineOutputConfig' :: Maybe Text
bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:PipelineOutputConfig' :: Maybe [Permission]
permissions = forall a. Maybe a
Prelude.Nothing,
      $sel:storageClass:PipelineOutputConfig' :: Maybe Text
storageClass = 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 :: Lens' PipelineOutputConfig (Maybe Text)
pipelineOutputConfig_bucket = 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)

-- | 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 :: Lens' PipelineOutputConfig (Maybe [Permission])
pipelineOutputConfig_permissions = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' PipelineOutputConfig (Maybe Text)
pipelineOutputConfig_storageClass = 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)

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

instance Prelude.Hashable PipelineOutputConfig where
  hashWithSalt :: Int -> PipelineOutputConfig -> Int
hashWithSalt Int
_salt PipelineOutputConfig' {Maybe [Permission]
Maybe Text
storageClass :: Maybe Text
permissions :: Maybe [Permission]
bucket :: Maybe Text
$sel:storageClass:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
$sel:permissions:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe [Permission]
$sel:bucket:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Permission]
permissions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
storageClass

instance Prelude.NFData PipelineOutputConfig where
  rnf :: PipelineOutputConfig -> ()
rnf PipelineOutputConfig' {Maybe [Permission]
Maybe Text
storageClass :: Maybe Text
permissions :: Maybe [Permission]
bucket :: Maybe Text
$sel:storageClass:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
$sel:permissions:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe [Permission]
$sel:bucket:PipelineOutputConfig' :: PipelineOutputConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Permission]
permissions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
storageClass

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