{-# 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.Lens as Lens
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
(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 ::
PresetSettings ->
Prelude.Text ->
CreatePreset
newCreatePreset :: PresetSettings -> Text -> CreatePreset
newCreatePreset PresetSettings
pSettings_ Text
pName_ =
CreatePreset' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> PresetSettings
-> Text
-> CreatePreset
CreatePreset'
{ $sel:category:CreatePreset' :: Maybe Text
category = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreatePreset' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreatePreset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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 :: (Maybe Text -> f (Maybe Text)) -> CreatePreset -> f CreatePreset
createPreset_category = (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
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 :: (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_tags :: Lens.Lens' CreatePreset (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createPreset_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePreset -> f CreatePreset
createPreset_tags = (CreatePreset -> Maybe (HashMap Text Text))
-> (CreatePreset -> Maybe (HashMap Text Text) -> CreatePreset)
-> Lens
CreatePreset
CreatePreset
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePreset -> f CreatePreset)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePreset
-> f CreatePreset
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
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 :: (PresetSettings -> f PresetSettings)
-> CreatePreset -> f CreatePreset
createPreset_settings = (CreatePreset -> PresetSettings)
-> (CreatePreset -> PresetSettings -> CreatePreset)
-> Lens CreatePreset CreatePreset PresetSettings PresetSettings
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 :: (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)
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 Preset -> Int -> CreatePresetResponse
CreatePresetResponse'
(Maybe Preset -> Int -> CreatePresetResponse)
-> Either String (Maybe Preset)
-> Either String (Int -> CreatePresetResponse)
forall (f :: * -> *) a b. Functor 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] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"category" 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
category,
(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
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"settings" Text -> PresetSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PresetSettings
settings),
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)
]
)
instance Core.ToPath CreatePreset where
toPath :: CreatePreset -> ByteString
toPath = ByteString -> CreatePreset -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2017-08-29/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 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 Preset -> Int -> CreatePresetResponse
CreatePresetResponse'
{ $sel:preset:CreatePresetResponse' :: Maybe Preset
preset = Maybe Preset
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePresetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
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