{-# 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.MediaConvert.CreatePreset
(
CreatePreset (..),
newCreatePreset,
createPreset_category,
createPreset_description,
createPreset_tags,
createPreset_settings,
createPreset_name,
CreatePresetResponse (..),
newCreatePresetResponse,
createPresetResponse_preset,
createPresetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConvert.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreatePreset = CreatePreset'
{
CreatePreset -> Maybe Text
category :: Prelude.Maybe Prelude.Text,
CreatePreset -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreatePreset -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreatePreset -> PresetSettings
settings :: PresetSettings,
CreatePreset -> Text
name :: Prelude.Text
}
deriving (CreatePreset -> CreatePreset -> Bool
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]
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
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. 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 ::
PresetSettings ->
Prelude.Text ->
CreatePreset
newCreatePreset :: PresetSettings -> Text -> CreatePreset
newCreatePreset PresetSettings
pSettings_ Text
pName_ =
CreatePreset'
{ $sel:category:CreatePreset' :: Maybe Text
category = forall a. Maybe a
Prelude.Nothing,
$sel:description:CreatePreset' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreatePreset' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:settings:CreatePreset' :: PresetSettings
settings = PresetSettings
pSettings_,
$sel:name:CreatePreset' :: Text
name = Text
pName_
}
createPreset_category :: Lens.Lens' CreatePreset (Prelude.Maybe Prelude.Text)
createPreset_category :: Lens' CreatePreset (Maybe Text)
createPreset_category = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Maybe Text
category :: Maybe Text
$sel:category:CreatePreset' :: CreatePreset -> Maybe Text
category} -> Maybe Text
category) (\s :: CreatePreset
s@CreatePreset' {} Maybe Text
a -> CreatePreset
s {$sel:category:CreatePreset' :: Maybe Text
category = Maybe Text
a} :: CreatePreset)
createPreset_description :: Lens.Lens' CreatePreset (Prelude.Maybe Prelude.Text)
createPreset_description :: Lens' CreatePreset (Maybe Text)
createPreset_description = 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_tags :: Lens.Lens' CreatePreset (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createPreset_tags :: Lens' CreatePreset (Maybe (HashMap Text Text))
createPreset_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreatePreset' :: CreatePreset -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreatePreset
s@CreatePreset' {} Maybe (HashMap Text Text)
a -> CreatePreset
s {$sel:tags:CreatePreset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreatePreset) 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
createPreset_settings :: Lens.Lens' CreatePreset PresetSettings
createPreset_settings :: Lens' CreatePreset PresetSettings
createPreset_settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreset' {PresetSettings
settings :: PresetSettings
$sel:settings:CreatePreset' :: CreatePreset -> PresetSettings
settings} -> PresetSettings
settings) (\s :: CreatePreset
s@CreatePreset' {} PresetSettings
a -> CreatePreset
s {$sel:settings:CreatePreset' :: PresetSettings
settings = PresetSettings
a} :: CreatePreset)
createPreset_name :: Lens.Lens' CreatePreset Prelude.Text
createPreset_name :: Lens' CreatePreset Text
createPreset_name = 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)
instance Core.AWSRequest CreatePreset where
type AWSResponse CreatePreset = CreatePresetResponse
request :: (Service -> Service) -> CreatePreset -> Request CreatePreset
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreatePreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePreset)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Preset -> Int -> CreatePresetResponse
CreatePresetResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"preset")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreatePreset where
hashWithSalt :: Int -> CreatePreset -> Int
hashWithSalt Int
_salt CreatePreset' {Maybe Text
Maybe (HashMap Text Text)
Text
PresetSettings
name :: Text
settings :: PresetSettings
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
category :: Maybe Text
$sel:name:CreatePreset' :: CreatePreset -> Text
$sel:settings:CreatePreset' :: CreatePreset -> PresetSettings
$sel:tags:CreatePreset' :: CreatePreset -> Maybe (HashMap Text Text)
$sel:description:CreatePreset' :: CreatePreset -> Maybe Text
$sel:category:CreatePreset' :: CreatePreset -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
category
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PresetSettings
settings
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData CreatePreset where
rnf :: CreatePreset -> ()
rnf CreatePreset' {Maybe Text
Maybe (HashMap Text Text)
Text
PresetSettings
name :: Text
settings :: PresetSettings
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
category :: Maybe Text
$sel:name:CreatePreset' :: CreatePreset -> Text
$sel:settings:CreatePreset' :: CreatePreset -> PresetSettings
$sel:tags:CreatePreset' :: CreatePreset -> Maybe (HashMap Text Text)
$sel:description:CreatePreset' :: CreatePreset -> Maybe Text
$sel:category:CreatePreset' :: CreatePreset -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
category
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PresetSettings
settings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders CreatePreset where
toHeaders :: CreatePreset -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreatePreset where
toJSON :: CreatePreset -> Value
toJSON CreatePreset' {Maybe Text
Maybe (HashMap Text Text)
Text
PresetSettings
name :: Text
settings :: PresetSettings
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
category :: Maybe Text
$sel:name:CreatePreset' :: CreatePreset -> Text
$sel:settings:CreatePreset' :: CreatePreset -> PresetSettings
$sel:tags:CreatePreset' :: CreatePreset -> Maybe (HashMap Text Text)
$sel:description:CreatePreset' :: CreatePreset -> Maybe Text
$sel:category:CreatePreset' :: CreatePreset -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"category" 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
category,
(Key
"description" 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
description,
(Key
"tags" 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 (HashMap Text Text)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"settings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PresetSettings
settings),
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath CreatePreset where
toPath :: CreatePreset -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/2017-08-29/presets"
instance Data.ToQuery CreatePreset where
toQuery :: CreatePreset -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreatePresetResponse = CreatePresetResponse'
{
CreatePresetResponse -> Maybe Preset
preset :: Prelude.Maybe Preset,
CreatePresetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePresetResponse -> CreatePresetResponse -> Bool
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]
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
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. 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'
{ $sel:preset:CreatePresetResponse' :: Maybe Preset
preset = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePresetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPresetResponse_preset :: Lens.Lens' CreatePresetResponse (Prelude.Maybe Preset)
createPresetResponse_preset :: Lens' CreatePresetResponse (Maybe Preset)
createPresetResponse_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 :: Lens' CreatePresetResponse Int
createPresetResponse_httpStatus = 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 where
rnf :: CreatePresetResponse -> ()
rnf CreatePresetResponse' {Int
Maybe Preset
httpStatus :: Int
preset :: Maybe Preset
$sel:httpStatus:CreatePresetResponse' :: CreatePresetResponse -> Int
$sel:preset:CreatePresetResponse' :: CreatePresetResponse -> Maybe Preset
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Preset
preset
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus