{-# 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.GetPreset
(
GetPreset (..),
newGetPreset,
getPreset_name,
GetPresetResponse (..),
newGetPresetResponse,
getPresetResponse_preset,
getPresetResponse_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 GetPreset = GetPreset'
{
GetPreset -> Text
name :: Prelude.Text
}
deriving (GetPreset -> GetPreset -> Bool
(GetPreset -> GetPreset -> Bool)
-> (GetPreset -> GetPreset -> Bool) -> Eq GetPreset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPreset -> GetPreset -> Bool
$c/= :: GetPreset -> GetPreset -> Bool
== :: GetPreset -> GetPreset -> Bool
$c== :: GetPreset -> GetPreset -> Bool
Prelude.Eq, ReadPrec [GetPreset]
ReadPrec GetPreset
Int -> ReadS GetPreset
ReadS [GetPreset]
(Int -> ReadS GetPreset)
-> ReadS [GetPreset]
-> ReadPrec GetPreset
-> ReadPrec [GetPreset]
-> Read GetPreset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPreset]
$creadListPrec :: ReadPrec [GetPreset]
readPrec :: ReadPrec GetPreset
$creadPrec :: ReadPrec GetPreset
readList :: ReadS [GetPreset]
$creadList :: ReadS [GetPreset]
readsPrec :: Int -> ReadS GetPreset
$creadsPrec :: Int -> ReadS GetPreset
Prelude.Read, Int -> GetPreset -> ShowS
[GetPreset] -> ShowS
GetPreset -> String
(Int -> GetPreset -> ShowS)
-> (GetPreset -> String)
-> ([GetPreset] -> ShowS)
-> Show GetPreset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPreset] -> ShowS
$cshowList :: [GetPreset] -> ShowS
show :: GetPreset -> String
$cshow :: GetPreset -> String
showsPrec :: Int -> GetPreset -> ShowS
$cshowsPrec :: Int -> GetPreset -> ShowS
Prelude.Show, (forall x. GetPreset -> Rep GetPreset x)
-> (forall x. Rep GetPreset x -> GetPreset) -> Generic GetPreset
forall x. Rep GetPreset x -> GetPreset
forall x. GetPreset -> Rep GetPreset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPreset x -> GetPreset
$cfrom :: forall x. GetPreset -> Rep GetPreset x
Prelude.Generic)
newGetPreset ::
Prelude.Text ->
GetPreset
newGetPreset :: Text -> GetPreset
newGetPreset Text
pName_ = GetPreset' :: Text -> GetPreset
GetPreset' {$sel:name:GetPreset' :: Text
name = Text
pName_}
getPreset_name :: Lens.Lens' GetPreset Prelude.Text
getPreset_name :: (Text -> f Text) -> GetPreset -> f GetPreset
getPreset_name = (GetPreset -> Text)
-> (GetPreset -> Text -> GetPreset)
-> Lens GetPreset GetPreset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPreset' {Text
name :: Text
$sel:name:GetPreset' :: GetPreset -> Text
name} -> Text
name) (\s :: GetPreset
s@GetPreset' {} Text
a -> GetPreset
s {$sel:name:GetPreset' :: Text
name = Text
a} :: GetPreset)
instance Core.AWSRequest GetPreset where
type AWSResponse GetPreset = GetPresetResponse
request :: GetPreset -> Request GetPreset
request = Service -> GetPreset -> Request GetPreset
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetPreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPreset)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetPreset))
-> Logger
-> Service
-> Proxy GetPreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPreset)))
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 -> GetPresetResponse
GetPresetResponse'
(Maybe Preset -> Int -> GetPresetResponse)
-> Either String (Maybe Preset)
-> Either String (Int -> GetPresetResponse)
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 -> GetPresetResponse)
-> Either String Int -> Either String GetPresetResponse
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 GetPreset
instance Prelude.NFData GetPreset
instance Core.ToHeaders GetPreset where
toHeaders :: GetPreset -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetPreset -> 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.ToPath GetPreset where
toPath :: GetPreset -> ByteString
toPath GetPreset' {Text
name :: Text
$sel:name:GetPreset' :: GetPreset -> Text
..} =
[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 GetPreset where
toQuery :: GetPreset -> QueryString
toQuery = QueryString -> GetPreset -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetPresetResponse = GetPresetResponse'
{
GetPresetResponse -> Maybe Preset
preset :: Prelude.Maybe Preset,
GetPresetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPresetResponse -> GetPresetResponse -> Bool
(GetPresetResponse -> GetPresetResponse -> Bool)
-> (GetPresetResponse -> GetPresetResponse -> Bool)
-> Eq GetPresetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPresetResponse -> GetPresetResponse -> Bool
$c/= :: GetPresetResponse -> GetPresetResponse -> Bool
== :: GetPresetResponse -> GetPresetResponse -> Bool
$c== :: GetPresetResponse -> GetPresetResponse -> Bool
Prelude.Eq, ReadPrec [GetPresetResponse]
ReadPrec GetPresetResponse
Int -> ReadS GetPresetResponse
ReadS [GetPresetResponse]
(Int -> ReadS GetPresetResponse)
-> ReadS [GetPresetResponse]
-> ReadPrec GetPresetResponse
-> ReadPrec [GetPresetResponse]
-> Read GetPresetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPresetResponse]
$creadListPrec :: ReadPrec [GetPresetResponse]
readPrec :: ReadPrec GetPresetResponse
$creadPrec :: ReadPrec GetPresetResponse
readList :: ReadS [GetPresetResponse]
$creadList :: ReadS [GetPresetResponse]
readsPrec :: Int -> ReadS GetPresetResponse
$creadsPrec :: Int -> ReadS GetPresetResponse
Prelude.Read, Int -> GetPresetResponse -> ShowS
[GetPresetResponse] -> ShowS
GetPresetResponse -> String
(Int -> GetPresetResponse -> ShowS)
-> (GetPresetResponse -> String)
-> ([GetPresetResponse] -> ShowS)
-> Show GetPresetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPresetResponse] -> ShowS
$cshowList :: [GetPresetResponse] -> ShowS
show :: GetPresetResponse -> String
$cshow :: GetPresetResponse -> String
showsPrec :: Int -> GetPresetResponse -> ShowS
$cshowsPrec :: Int -> GetPresetResponse -> ShowS
Prelude.Show, (forall x. GetPresetResponse -> Rep GetPresetResponse x)
-> (forall x. Rep GetPresetResponse x -> GetPresetResponse)
-> Generic GetPresetResponse
forall x. Rep GetPresetResponse x -> GetPresetResponse
forall x. GetPresetResponse -> Rep GetPresetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPresetResponse x -> GetPresetResponse
$cfrom :: forall x. GetPresetResponse -> Rep GetPresetResponse x
Prelude.Generic)
newGetPresetResponse ::
Prelude.Int ->
GetPresetResponse
newGetPresetResponse :: Int -> GetPresetResponse
newGetPresetResponse Int
pHttpStatus_ =
GetPresetResponse' :: Maybe Preset -> Int -> GetPresetResponse
GetPresetResponse'
{ $sel:preset:GetPresetResponse' :: Maybe Preset
preset = Maybe Preset
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPresetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPresetResponse_preset :: Lens.Lens' GetPresetResponse (Prelude.Maybe Preset)
getPresetResponse_preset :: (Maybe Preset -> f (Maybe Preset))
-> GetPresetResponse -> f GetPresetResponse
getPresetResponse_preset = (GetPresetResponse -> Maybe Preset)
-> (GetPresetResponse -> Maybe Preset -> GetPresetResponse)
-> Lens
GetPresetResponse GetPresetResponse (Maybe Preset) (Maybe Preset)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPresetResponse' {Maybe Preset
preset :: Maybe Preset
$sel:preset:GetPresetResponse' :: GetPresetResponse -> Maybe Preset
preset} -> Maybe Preset
preset) (\s :: GetPresetResponse
s@GetPresetResponse' {} Maybe Preset
a -> GetPresetResponse
s {$sel:preset:GetPresetResponse' :: Maybe Preset
preset = Maybe Preset
a} :: GetPresetResponse)
getPresetResponse_httpStatus :: Lens.Lens' GetPresetResponse Prelude.Int
getPresetResponse_httpStatus :: (Int -> f Int) -> GetPresetResponse -> f GetPresetResponse
getPresetResponse_httpStatus = (GetPresetResponse -> Int)
-> (GetPresetResponse -> Int -> GetPresetResponse)
-> Lens GetPresetResponse GetPresetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPresetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPresetResponse' :: GetPresetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPresetResponse
s@GetPresetResponse' {} Int
a -> GetPresetResponse
s {$sel:httpStatus:GetPresetResponse' :: Int
httpStatus = Int
a} :: GetPresetResponse)
instance Prelude.NFData GetPresetResponse