{-# 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.UpdatePreset
(
UpdatePreset (..),
newUpdatePreset,
updatePreset_settings,
updatePreset_category,
updatePreset_description,
updatePreset_name,
UpdatePresetResponse (..),
newUpdatePresetResponse,
updatePresetResponse_preset,
updatePresetResponse_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 UpdatePreset = UpdatePreset'
{
UpdatePreset -> Maybe PresetSettings
settings :: Prelude.Maybe PresetSettings,
UpdatePreset -> Maybe Text
category :: Prelude.Maybe Prelude.Text,
UpdatePreset -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdatePreset -> Text
name :: Prelude.Text
}
deriving (UpdatePreset -> UpdatePreset -> Bool
(UpdatePreset -> UpdatePreset -> Bool)
-> (UpdatePreset -> UpdatePreset -> Bool) -> Eq UpdatePreset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePreset -> UpdatePreset -> Bool
$c/= :: UpdatePreset -> UpdatePreset -> Bool
== :: UpdatePreset -> UpdatePreset -> Bool
$c== :: UpdatePreset -> UpdatePreset -> Bool
Prelude.Eq, ReadPrec [UpdatePreset]
ReadPrec UpdatePreset
Int -> ReadS UpdatePreset
ReadS [UpdatePreset]
(Int -> ReadS UpdatePreset)
-> ReadS [UpdatePreset]
-> ReadPrec UpdatePreset
-> ReadPrec [UpdatePreset]
-> Read UpdatePreset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePreset]
$creadListPrec :: ReadPrec [UpdatePreset]
readPrec :: ReadPrec UpdatePreset
$creadPrec :: ReadPrec UpdatePreset
readList :: ReadS [UpdatePreset]
$creadList :: ReadS [UpdatePreset]
readsPrec :: Int -> ReadS UpdatePreset
$creadsPrec :: Int -> ReadS UpdatePreset
Prelude.Read, Int -> UpdatePreset -> ShowS
[UpdatePreset] -> ShowS
UpdatePreset -> String
(Int -> UpdatePreset -> ShowS)
-> (UpdatePreset -> String)
-> ([UpdatePreset] -> ShowS)
-> Show UpdatePreset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePreset] -> ShowS
$cshowList :: [UpdatePreset] -> ShowS
show :: UpdatePreset -> String
$cshow :: UpdatePreset -> String
showsPrec :: Int -> UpdatePreset -> ShowS
$cshowsPrec :: Int -> UpdatePreset -> ShowS
Prelude.Show, (forall x. UpdatePreset -> Rep UpdatePreset x)
-> (forall x. Rep UpdatePreset x -> UpdatePreset)
-> Generic UpdatePreset
forall x. Rep UpdatePreset x -> UpdatePreset
forall x. UpdatePreset -> Rep UpdatePreset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePreset x -> UpdatePreset
$cfrom :: forall x. UpdatePreset -> Rep UpdatePreset x
Prelude.Generic)
newUpdatePreset ::
Prelude.Text ->
UpdatePreset
newUpdatePreset :: Text -> UpdatePreset
newUpdatePreset Text
pName_ =
UpdatePreset' :: Maybe PresetSettings
-> Maybe Text -> Maybe Text -> Text -> UpdatePreset
UpdatePreset'
{ $sel:settings:UpdatePreset' :: Maybe PresetSettings
settings = Maybe PresetSettings
forall a. Maybe a
Prelude.Nothing,
$sel:category:UpdatePreset' :: Maybe Text
category = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdatePreset' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdatePreset' :: Text
name = Text
pName_
}
updatePreset_settings :: Lens.Lens' UpdatePreset (Prelude.Maybe PresetSettings)
updatePreset_settings :: (Maybe PresetSettings -> f (Maybe PresetSettings))
-> UpdatePreset -> f UpdatePreset
updatePreset_settings = (UpdatePreset -> Maybe PresetSettings)
-> (UpdatePreset -> Maybe PresetSettings -> UpdatePreset)
-> Lens
UpdatePreset
UpdatePreset
(Maybe PresetSettings)
(Maybe PresetSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePreset' {Maybe PresetSettings
settings :: Maybe PresetSettings
$sel:settings:UpdatePreset' :: UpdatePreset -> Maybe PresetSettings
settings} -> Maybe PresetSettings
settings) (\s :: UpdatePreset
s@UpdatePreset' {} Maybe PresetSettings
a -> UpdatePreset
s {$sel:settings:UpdatePreset' :: Maybe PresetSettings
settings = Maybe PresetSettings
a} :: UpdatePreset)
updatePreset_category :: Lens.Lens' UpdatePreset (Prelude.Maybe Prelude.Text)
updatePreset_category :: (Maybe Text -> f (Maybe Text)) -> UpdatePreset -> f UpdatePreset
updatePreset_category = (UpdatePreset -> Maybe Text)
-> (UpdatePreset -> Maybe Text -> UpdatePreset)
-> Lens UpdatePreset UpdatePreset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePreset' {Maybe Text
category :: Maybe Text
$sel:category:UpdatePreset' :: UpdatePreset -> Maybe Text
category} -> Maybe Text
category) (\s :: UpdatePreset
s@UpdatePreset' {} Maybe Text
a -> UpdatePreset
s {$sel:category:UpdatePreset' :: Maybe Text
category = Maybe Text
a} :: UpdatePreset)
updatePreset_description :: Lens.Lens' UpdatePreset (Prelude.Maybe Prelude.Text)
updatePreset_description :: (Maybe Text -> f (Maybe Text)) -> UpdatePreset -> f UpdatePreset
updatePreset_description = (UpdatePreset -> Maybe Text)
-> (UpdatePreset -> Maybe Text -> UpdatePreset)
-> Lens UpdatePreset UpdatePreset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePreset' {Maybe Text
description :: Maybe Text
$sel:description:UpdatePreset' :: UpdatePreset -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdatePreset
s@UpdatePreset' {} Maybe Text
a -> UpdatePreset
s {$sel:description:UpdatePreset' :: Maybe Text
description = Maybe Text
a} :: UpdatePreset)
updatePreset_name :: Lens.Lens' UpdatePreset Prelude.Text
updatePreset_name :: (Text -> f Text) -> UpdatePreset -> f UpdatePreset
updatePreset_name = (UpdatePreset -> Text)
-> (UpdatePreset -> Text -> UpdatePreset)
-> Lens UpdatePreset UpdatePreset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePreset' {Text
name :: Text
$sel:name:UpdatePreset' :: UpdatePreset -> Text
name} -> Text
name) (\s :: UpdatePreset
s@UpdatePreset' {} Text
a -> UpdatePreset
s {$sel:name:UpdatePreset' :: Text
name = Text
a} :: UpdatePreset)
instance Core.AWSRequest UpdatePreset where
type AWSResponse UpdatePreset = UpdatePresetResponse
request :: UpdatePreset -> Request UpdatePreset
request = Service -> UpdatePreset -> Request UpdatePreset
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdatePreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePreset)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdatePreset))
-> Logger
-> Service
-> Proxy UpdatePreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePreset)))
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 -> UpdatePresetResponse
UpdatePresetResponse'
(Maybe Preset -> Int -> UpdatePresetResponse)
-> Either String (Maybe Preset)
-> Either String (Int -> UpdatePresetResponse)
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 -> UpdatePresetResponse)
-> Either String Int -> Either String UpdatePresetResponse
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 UpdatePreset
instance Prelude.NFData UpdatePreset
instance Core.ToHeaders UpdatePreset where
toHeaders :: UpdatePreset -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdatePreset -> 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 UpdatePreset where
toJSON :: UpdatePreset -> Value
toJSON UpdatePreset' {Maybe Text
Maybe PresetSettings
Text
name :: Text
description :: Maybe Text
category :: Maybe Text
settings :: Maybe PresetSettings
$sel:name:UpdatePreset' :: UpdatePreset -> Text
$sel:description:UpdatePreset' :: UpdatePreset -> Maybe Text
$sel:category:UpdatePreset' :: UpdatePreset -> Maybe Text
$sel:settings:UpdatePreset' :: UpdatePreset -> Maybe PresetSettings
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"settings" Text -> PresetSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PresetSettings -> Pair) -> Maybe PresetSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PresetSettings
settings,
(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
]
)
instance Core.ToPath UpdatePreset where
toPath :: UpdatePreset -> ByteString
toPath UpdatePreset' {Maybe Text
Maybe PresetSettings
Text
name :: Text
description :: Maybe Text
category :: Maybe Text
settings :: Maybe PresetSettings
$sel:name:UpdatePreset' :: UpdatePreset -> Text
$sel:description:UpdatePreset' :: UpdatePreset -> Maybe Text
$sel:category:UpdatePreset' :: UpdatePreset -> Maybe Text
$sel:settings:UpdatePreset' :: UpdatePreset -> Maybe PresetSettings
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2017-08-29/presets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]
instance Core.ToQuery UpdatePreset where
toQuery :: UpdatePreset -> QueryString
toQuery = QueryString -> UpdatePreset -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdatePresetResponse = UpdatePresetResponse'
{
UpdatePresetResponse -> Maybe Preset
preset :: Prelude.Maybe Preset,
UpdatePresetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdatePresetResponse -> UpdatePresetResponse -> Bool
(UpdatePresetResponse -> UpdatePresetResponse -> Bool)
-> (UpdatePresetResponse -> UpdatePresetResponse -> Bool)
-> Eq UpdatePresetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePresetResponse -> UpdatePresetResponse -> Bool
$c/= :: UpdatePresetResponse -> UpdatePresetResponse -> Bool
== :: UpdatePresetResponse -> UpdatePresetResponse -> Bool
$c== :: UpdatePresetResponse -> UpdatePresetResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePresetResponse]
ReadPrec UpdatePresetResponse
Int -> ReadS UpdatePresetResponse
ReadS [UpdatePresetResponse]
(Int -> ReadS UpdatePresetResponse)
-> ReadS [UpdatePresetResponse]
-> ReadPrec UpdatePresetResponse
-> ReadPrec [UpdatePresetResponse]
-> Read UpdatePresetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePresetResponse]
$creadListPrec :: ReadPrec [UpdatePresetResponse]
readPrec :: ReadPrec UpdatePresetResponse
$creadPrec :: ReadPrec UpdatePresetResponse
readList :: ReadS [UpdatePresetResponse]
$creadList :: ReadS [UpdatePresetResponse]
readsPrec :: Int -> ReadS UpdatePresetResponse
$creadsPrec :: Int -> ReadS UpdatePresetResponse
Prelude.Read, Int -> UpdatePresetResponse -> ShowS
[UpdatePresetResponse] -> ShowS
UpdatePresetResponse -> String
(Int -> UpdatePresetResponse -> ShowS)
-> (UpdatePresetResponse -> String)
-> ([UpdatePresetResponse] -> ShowS)
-> Show UpdatePresetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePresetResponse] -> ShowS
$cshowList :: [UpdatePresetResponse] -> ShowS
show :: UpdatePresetResponse -> String
$cshow :: UpdatePresetResponse -> String
showsPrec :: Int -> UpdatePresetResponse -> ShowS
$cshowsPrec :: Int -> UpdatePresetResponse -> ShowS
Prelude.Show, (forall x. UpdatePresetResponse -> Rep UpdatePresetResponse x)
-> (forall x. Rep UpdatePresetResponse x -> UpdatePresetResponse)
-> Generic UpdatePresetResponse
forall x. Rep UpdatePresetResponse x -> UpdatePresetResponse
forall x. UpdatePresetResponse -> Rep UpdatePresetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePresetResponse x -> UpdatePresetResponse
$cfrom :: forall x. UpdatePresetResponse -> Rep UpdatePresetResponse x
Prelude.Generic)
newUpdatePresetResponse ::
Prelude.Int ->
UpdatePresetResponse
newUpdatePresetResponse :: Int -> UpdatePresetResponse
newUpdatePresetResponse Int
pHttpStatus_ =
UpdatePresetResponse' :: Maybe Preset -> Int -> UpdatePresetResponse
UpdatePresetResponse'
{ $sel:preset:UpdatePresetResponse' :: Maybe Preset
preset = Maybe Preset
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdatePresetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updatePresetResponse_preset :: Lens.Lens' UpdatePresetResponse (Prelude.Maybe Preset)
updatePresetResponse_preset :: (Maybe Preset -> f (Maybe Preset))
-> UpdatePresetResponse -> f UpdatePresetResponse
updatePresetResponse_preset = (UpdatePresetResponse -> Maybe Preset)
-> (UpdatePresetResponse -> Maybe Preset -> UpdatePresetResponse)
-> Lens
UpdatePresetResponse
UpdatePresetResponse
(Maybe Preset)
(Maybe Preset)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePresetResponse' {Maybe Preset
preset :: Maybe Preset
$sel:preset:UpdatePresetResponse' :: UpdatePresetResponse -> Maybe Preset
preset} -> Maybe Preset
preset) (\s :: UpdatePresetResponse
s@UpdatePresetResponse' {} Maybe Preset
a -> UpdatePresetResponse
s {$sel:preset:UpdatePresetResponse' :: Maybe Preset
preset = Maybe Preset
a} :: UpdatePresetResponse)
updatePresetResponse_httpStatus :: Lens.Lens' UpdatePresetResponse Prelude.Int
updatePresetResponse_httpStatus :: (Int -> f Int) -> UpdatePresetResponse -> f UpdatePresetResponse
updatePresetResponse_httpStatus = (UpdatePresetResponse -> Int)
-> (UpdatePresetResponse -> Int -> UpdatePresetResponse)
-> Lens UpdatePresetResponse UpdatePresetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePresetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePresetResponse' :: UpdatePresetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePresetResponse
s@UpdatePresetResponse' {} Int
a -> UpdatePresetResponse
s {$sel:httpStatus:UpdatePresetResponse' :: Int
httpStatus = Int
a} :: UpdatePresetResponse)
instance Prelude.NFData UpdatePresetResponse