{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.ElasticTranscoder.CreatePreset
(
CreatePreset (..),
newCreatePreset,
createPreset_video,
createPreset_thumbnails,
createPreset_description,
createPreset_audio,
createPreset_name,
createPreset_container,
CreatePresetResponse (..),
newCreatePresetResponse,
createPresetResponse_warning,
createPresetResponse_preset,
createPresetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreatePreset = CreatePreset'
{
CreatePreset -> Maybe VideoParameters
video :: Prelude.Maybe VideoParameters,
CreatePreset -> Maybe Thumbnails
thumbnails :: Prelude.Maybe Thumbnails,
CreatePreset -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreatePreset -> Maybe AudioParameters
audio :: Prelude.Maybe AudioParameters,
CreatePreset -> Text
name :: Prelude.Text,
CreatePreset -> Text
container :: Prelude.Text
}
deriving (CreatePreset -> CreatePreset -> Bool
(CreatePreset -> CreatePreset -> Bool)
-> (CreatePreset -> CreatePreset -> Bool) -> Eq CreatePreset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePreset -> CreatePreset -> Bool
$c/= :: CreatePreset -> CreatePreset -> Bool
== :: CreatePreset -> CreatePreset -> Bool
$c== :: CreatePreset -> CreatePreset -> Bool
Prelude.Eq, ReadPrec [CreatePreset]
ReadPrec CreatePreset
Int -> ReadS CreatePreset
ReadS [CreatePreset]
(Int -> ReadS CreatePreset)
-> ReadS [CreatePreset]
-> ReadPrec CreatePreset
-> ReadPrec [CreatePreset]
-> Read CreatePreset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePreset]
$creadListPrec :: ReadPrec [CreatePreset]
readPrec :: ReadPrec CreatePreset
$creadPrec :: ReadPrec CreatePreset
readList :: ReadS [CreatePreset]
$creadList :: ReadS [CreatePreset]
readsPrec :: Int -> ReadS CreatePreset
$creadsPrec :: Int -> ReadS CreatePreset
Prelude.Read, Int -> CreatePreset -> ShowS
[CreatePreset] -> ShowS
CreatePreset -> String
(Int -> CreatePreset -> ShowS)
-> (CreatePreset -> String)
-> ([CreatePreset] -> ShowS)
-> Show CreatePreset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePreset] -> ShowS
$cshowList :: [CreatePreset] -> ShowS
show :: CreatePreset -> String
$cshow :: CreatePreset -> String
showsPrec :: Int -> CreatePreset -> ShowS
$cshowsPrec :: Int -> CreatePreset -> ShowS
Prelude.Show, (forall x. CreatePreset -> Rep CreatePreset x)
-> (forall x. Rep CreatePreset x -> CreatePreset)
-> Generic CreatePreset
forall x. Rep CreatePreset x -> CreatePreset
forall x. CreatePreset -> Rep CreatePreset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePreset x -> CreatePreset
$cfrom :: forall x. CreatePreset -> Rep CreatePreset x
Prelude.Generic)
newCreatePreset ::
Prelude.Text ->
Prelude.Text ->
CreatePreset
newCreatePreset :: Text -> Text -> CreatePreset
newCreatePreset Text
pName_ Text
pContainer_ =
CreatePreset' :: Maybe VideoParameters
-> Maybe Thumbnails
-> Maybe Text
-> Maybe AudioParameters
-> Text
-> Text
-> CreatePreset
CreatePreset'
{ $sel:video:CreatePreset' :: Maybe VideoParameters
video = Maybe VideoParameters
forall a. Maybe a
Prelude.Nothing,
$sel:thumbnails:CreatePreset' :: Maybe Thumbnails
thumbnails = Maybe Thumbnails
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreatePreset' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:audio:CreatePreset' :: Maybe AudioParameters
audio = Maybe AudioParameters
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreatePreset' :: Text
name = Text
pName_,
$sel:container:CreatePreset' :: Text
container = Text
pContainer_
}
createPreset_video :: Lens.Lens' CreatePreset (Prelude.Maybe VideoParameters)
createPreset_video :: (Maybe VideoParameters -> f (Maybe VideoParameters))
-> CreatePreset -> f CreatePreset
createPreset_video = (CreatePreset -> Maybe VideoParameters)
-> (CreatePreset -> Maybe VideoParameters -> CreatePreset)
-> Lens
CreatePreset
CreatePreset
(Maybe VideoParameters)
(Maybe VideoParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Maybe VideoParameters
video :: Maybe VideoParameters
$sel:video:CreatePreset' :: CreatePreset -> Maybe VideoParameters
video} -> Maybe VideoParameters
video) (\s :: CreatePreset
s@CreatePreset' {} Maybe VideoParameters
a -> CreatePreset
s {$sel:video:CreatePreset' :: Maybe VideoParameters
video = Maybe VideoParameters
a} :: CreatePreset)
createPreset_thumbnails :: Lens.Lens' CreatePreset (Prelude.Maybe Thumbnails)
createPreset_thumbnails :: (Maybe Thumbnails -> f (Maybe Thumbnails))
-> CreatePreset -> f CreatePreset
createPreset_thumbnails = (CreatePreset -> Maybe Thumbnails)
-> (CreatePreset -> Maybe Thumbnails -> CreatePreset)
-> Lens
CreatePreset CreatePreset (Maybe Thumbnails) (Maybe Thumbnails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Maybe Thumbnails
thumbnails :: Maybe Thumbnails
$sel:thumbnails:CreatePreset' :: CreatePreset -> Maybe Thumbnails
thumbnails} -> Maybe Thumbnails
thumbnails) (\s :: CreatePreset
s@CreatePreset' {} Maybe Thumbnails
a -> CreatePreset
s {$sel:thumbnails:CreatePreset' :: Maybe Thumbnails
thumbnails = Maybe Thumbnails
a} :: CreatePreset)
createPreset_description :: Lens.Lens' CreatePreset (Prelude.Maybe Prelude.Text)
createPreset_description :: (Maybe Text -> f (Maybe Text)) -> CreatePreset -> f CreatePreset
createPreset_description = (CreatePreset -> Maybe Text)
-> (CreatePreset -> Maybe Text -> CreatePreset)
-> Lens CreatePreset CreatePreset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Maybe Text
description :: Maybe Text
$sel:description:CreatePreset' :: CreatePreset -> Maybe Text
description} -> Maybe Text
description) (\s :: CreatePreset
s@CreatePreset' {} Maybe Text
a -> CreatePreset
s {$sel:description:CreatePreset' :: Maybe Text
description = Maybe Text
a} :: CreatePreset)
createPreset_audio :: Lens.Lens' CreatePreset (Prelude.Maybe AudioParameters)
createPreset_audio :: (Maybe AudioParameters -> f (Maybe AudioParameters))
-> CreatePreset -> f CreatePreset
createPreset_audio = (CreatePreset -> Maybe AudioParameters)
-> (CreatePreset -> Maybe AudioParameters -> CreatePreset)
-> Lens
CreatePreset
CreatePreset
(Maybe AudioParameters)
(Maybe AudioParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Maybe AudioParameters
audio :: Maybe AudioParameters
$sel:audio:CreatePreset' :: CreatePreset -> Maybe AudioParameters
audio} -> Maybe AudioParameters
audio) (\s :: CreatePreset
s@CreatePreset' {} Maybe AudioParameters
a -> CreatePreset
s {$sel:audio:CreatePreset' :: Maybe AudioParameters
audio = Maybe AudioParameters
a} :: CreatePreset)
createPreset_name :: Lens.Lens' CreatePreset Prelude.Text
createPreset_name :: (Text -> f Text) -> CreatePreset -> f CreatePreset
createPreset_name = (CreatePreset -> Text)
-> (CreatePreset -> Text -> CreatePreset)
-> Lens CreatePreset CreatePreset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Text
name :: Text
$sel:name:CreatePreset' :: CreatePreset -> Text
name} -> Text
name) (\s :: CreatePreset
s@CreatePreset' {} Text
a -> CreatePreset
s {$sel:name:CreatePreset' :: Text
name = Text
a} :: CreatePreset)
createPreset_container :: Lens.Lens' CreatePreset Prelude.Text
createPreset_container :: (Text -> f Text) -> CreatePreset -> f CreatePreset
createPreset_container = (CreatePreset -> Text)
-> (CreatePreset -> Text -> CreatePreset)
-> Lens CreatePreset CreatePreset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Text
container :: Text
$sel:container:CreatePreset' :: CreatePreset -> Text
container} -> Text
container) (\s :: CreatePreset
s@CreatePreset' {} Text
a -> CreatePreset
s {$sel:container:CreatePreset' :: Text
container = Text
a} :: CreatePreset)
instance Core.AWSRequest CreatePreset where
type AWSResponse CreatePreset = CreatePresetResponse
request :: CreatePreset -> Request CreatePreset
request = Service -> CreatePreset -> Request CreatePreset
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePreset)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePreset))
-> Logger
-> Service
-> Proxy CreatePreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePreset)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Maybe Preset -> Int -> CreatePresetResponse
CreatePresetResponse'
(Maybe Text -> Maybe Preset -> Int -> CreatePresetResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Preset -> Int -> CreatePresetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Warning")
Either String (Maybe Preset -> Int -> CreatePresetResponse)
-> Either String (Maybe Preset)
-> Either String (Int -> CreatePresetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Preset)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Preset")
Either String (Int -> CreatePresetResponse)
-> Either String Int -> Either String CreatePresetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreatePreset
instance Prelude.NFData CreatePreset
instance Core.ToHeaders CreatePreset where
toHeaders :: CreatePreset -> ResponseHeaders
toHeaders = ResponseHeaders -> CreatePreset -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreatePreset where
toJSON :: CreatePreset -> Value
toJSON CreatePreset' {Maybe Text
Maybe AudioParameters
Maybe Thumbnails
Maybe VideoParameters
Text
container :: Text
name :: Text
audio :: Maybe AudioParameters
description :: Maybe Text
thumbnails :: Maybe Thumbnails
video :: Maybe VideoParameters
$sel:container:CreatePreset' :: CreatePreset -> Text
$sel:name:CreatePreset' :: CreatePreset -> Text
$sel:audio:CreatePreset' :: CreatePreset -> Maybe AudioParameters
$sel:description:CreatePreset' :: CreatePreset -> Maybe Text
$sel:thumbnails:CreatePreset' :: CreatePreset -> Maybe Thumbnails
$sel:video:CreatePreset' :: CreatePreset -> Maybe VideoParameters
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Video" Text -> VideoParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VideoParameters -> Pair) -> Maybe VideoParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VideoParameters
video,
(Text
"Thumbnails" Text -> Thumbnails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Thumbnails -> Pair) -> Maybe Thumbnails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Thumbnails
thumbnails,
(Text
"Description" 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
description,
(Text
"Audio" Text -> AudioParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AudioParameters -> Pair) -> Maybe AudioParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioParameters
audio,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Container" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
container)
]
)
instance Core.ToPath CreatePreset where
toPath :: CreatePreset -> ByteString
toPath = ByteString -> CreatePreset -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2012-09-25/presets"
instance Core.ToQuery CreatePreset where
toQuery :: CreatePreset -> QueryString
toQuery = QueryString -> CreatePreset -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePresetResponse = CreatePresetResponse'
{
CreatePresetResponse -> Maybe Text
warning :: Prelude.Maybe Prelude.Text,
CreatePresetResponse -> Maybe Preset
preset :: Prelude.Maybe Preset,
CreatePresetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePresetResponse -> CreatePresetResponse -> Bool
(CreatePresetResponse -> CreatePresetResponse -> Bool)
-> (CreatePresetResponse -> CreatePresetResponse -> Bool)
-> Eq CreatePresetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePresetResponse -> CreatePresetResponse -> Bool
$c/= :: CreatePresetResponse -> CreatePresetResponse -> Bool
== :: CreatePresetResponse -> CreatePresetResponse -> Bool
$c== :: CreatePresetResponse -> CreatePresetResponse -> Bool
Prelude.Eq, ReadPrec [CreatePresetResponse]
ReadPrec CreatePresetResponse
Int -> ReadS CreatePresetResponse
ReadS [CreatePresetResponse]
(Int -> ReadS CreatePresetResponse)
-> ReadS [CreatePresetResponse]
-> ReadPrec CreatePresetResponse
-> ReadPrec [CreatePresetResponse]
-> Read CreatePresetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePresetResponse]
$creadListPrec :: ReadPrec [CreatePresetResponse]
readPrec :: ReadPrec CreatePresetResponse
$creadPrec :: ReadPrec CreatePresetResponse
readList :: ReadS [CreatePresetResponse]
$creadList :: ReadS [CreatePresetResponse]
readsPrec :: Int -> ReadS CreatePresetResponse
$creadsPrec :: Int -> ReadS CreatePresetResponse
Prelude.Read, Int -> CreatePresetResponse -> ShowS
[CreatePresetResponse] -> ShowS
CreatePresetResponse -> String
(Int -> CreatePresetResponse -> ShowS)
-> (CreatePresetResponse -> String)
-> ([CreatePresetResponse] -> ShowS)
-> Show CreatePresetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePresetResponse] -> ShowS
$cshowList :: [CreatePresetResponse] -> ShowS
show :: CreatePresetResponse -> String
$cshow :: CreatePresetResponse -> String
showsPrec :: Int -> CreatePresetResponse -> ShowS
$cshowsPrec :: Int -> CreatePresetResponse -> ShowS
Prelude.Show, (forall x. CreatePresetResponse -> Rep CreatePresetResponse x)
-> (forall x. Rep CreatePresetResponse x -> CreatePresetResponse)
-> Generic CreatePresetResponse
forall x. Rep CreatePresetResponse x -> CreatePresetResponse
forall x. CreatePresetResponse -> Rep CreatePresetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePresetResponse x -> CreatePresetResponse
$cfrom :: forall x. CreatePresetResponse -> Rep CreatePresetResponse x
Prelude.Generic)
newCreatePresetResponse ::
Prelude.Int ->
CreatePresetResponse
newCreatePresetResponse :: Int -> CreatePresetResponse
newCreatePresetResponse Int
pHttpStatus_ =
CreatePresetResponse' :: Maybe Text -> Maybe Preset -> Int -> CreatePresetResponse
CreatePresetResponse'
{ $sel:warning:CreatePresetResponse' :: Maybe Text
warning = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:preset:CreatePresetResponse' :: Maybe Preset
preset = Maybe Preset
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePresetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPresetResponse_warning :: Lens.Lens' CreatePresetResponse (Prelude.Maybe Prelude.Text)
createPresetResponse_warning :: (Maybe Text -> f (Maybe Text))
-> CreatePresetResponse -> f CreatePresetResponse
createPresetResponse_warning = (CreatePresetResponse -> Maybe Text)
-> (CreatePresetResponse -> Maybe Text -> CreatePresetResponse)
-> Lens
CreatePresetResponse CreatePresetResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePresetResponse' {Maybe Text
warning :: Maybe Text
$sel:warning:CreatePresetResponse' :: CreatePresetResponse -> Maybe Text
warning} -> Maybe Text
warning) (\s :: CreatePresetResponse
s@CreatePresetResponse' {} Maybe Text
a -> CreatePresetResponse
s {$sel:warning:CreatePresetResponse' :: Maybe Text
warning = Maybe Text
a} :: CreatePresetResponse)
createPresetResponse_preset :: Lens.Lens' CreatePresetResponse (Prelude.Maybe Preset)
createPresetResponse_preset :: (Maybe Preset -> f (Maybe Preset))
-> CreatePresetResponse -> f CreatePresetResponse
createPresetResponse_preset = (CreatePresetResponse -> Maybe Preset)
-> (CreatePresetResponse -> Maybe Preset -> CreatePresetResponse)
-> Lens
CreatePresetResponse
CreatePresetResponse
(Maybe Preset)
(Maybe Preset)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePresetResponse' {Maybe Preset
preset :: Maybe Preset
$sel:preset:CreatePresetResponse' :: CreatePresetResponse -> Maybe Preset
preset} -> Maybe Preset
preset) (\s :: CreatePresetResponse
s@CreatePresetResponse' {} Maybe Preset
a -> CreatePresetResponse
s {$sel:preset:CreatePresetResponse' :: Maybe Preset
preset = Maybe Preset
a} :: CreatePresetResponse)
createPresetResponse_httpStatus :: Lens.Lens' CreatePresetResponse Prelude.Int
createPresetResponse_httpStatus :: (Int -> f Int) -> CreatePresetResponse -> f CreatePresetResponse
createPresetResponse_httpStatus = (CreatePresetResponse -> Int)
-> (CreatePresetResponse -> Int -> CreatePresetResponse)
-> Lens CreatePresetResponse CreatePresetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePresetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePresetResponse' :: CreatePresetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePresetResponse
s@CreatePresetResponse' {} Int
a -> CreatePresetResponse
s {$sel:httpStatus:CreatePresetResponse' :: Int
httpStatus = Int
a} :: CreatePresetResponse)
instance Prelude.NFData CreatePresetResponse