{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ElasticTranscoder.ReadPreset
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- The ReadPreset operation gets detailed information about a preset.
module Amazonka.ElasticTranscoder.ReadPreset
  ( -- * Creating a Request
    ReadPreset (..),
    newReadPreset,

    -- * Request Lenses
    readPreset_id,

    -- * Destructuring the Response
    ReadPresetResponse (..),
    newReadPresetResponse,

    -- * Response Lenses
    readPresetResponse_preset,
    readPresetResponse_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

-- | The @ReadPresetRequest@ structure.
--
-- /See:/ 'newReadPreset' smart constructor.
data ReadPreset = ReadPreset'
  { -- | The identifier of the preset for which you want to get detailed
    -- information.
    ReadPreset -> Text
id :: Prelude.Text
  }
  deriving (ReadPreset -> ReadPreset -> Bool
(ReadPreset -> ReadPreset -> Bool)
-> (ReadPreset -> ReadPreset -> Bool) -> Eq ReadPreset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReadPreset -> ReadPreset -> Bool
$c/= :: ReadPreset -> ReadPreset -> Bool
== :: ReadPreset -> ReadPreset -> Bool
$c== :: ReadPreset -> ReadPreset -> Bool
Prelude.Eq, ReadPrec [ReadPreset]
ReadPrec ReadPreset
Int -> ReadS ReadPreset
ReadS [ReadPreset]
(Int -> ReadS ReadPreset)
-> ReadS [ReadPreset]
-> ReadPrec ReadPreset
-> ReadPrec [ReadPreset]
-> Read ReadPreset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReadPreset]
$creadListPrec :: ReadPrec [ReadPreset]
readPrec :: ReadPrec ReadPreset
$creadPrec :: ReadPrec ReadPreset
readList :: ReadS [ReadPreset]
$creadList :: ReadS [ReadPreset]
readsPrec :: Int -> ReadS ReadPreset
$creadsPrec :: Int -> ReadS ReadPreset
Prelude.Read, Int -> ReadPreset -> ShowS
[ReadPreset] -> ShowS
ReadPreset -> String
(Int -> ReadPreset -> ShowS)
-> (ReadPreset -> String)
-> ([ReadPreset] -> ShowS)
-> Show ReadPreset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReadPreset] -> ShowS
$cshowList :: [ReadPreset] -> ShowS
show :: ReadPreset -> String
$cshow :: ReadPreset -> String
showsPrec :: Int -> ReadPreset -> ShowS
$cshowsPrec :: Int -> ReadPreset -> ShowS
Prelude.Show, (forall x. ReadPreset -> Rep ReadPreset x)
-> (forall x. Rep ReadPreset x -> ReadPreset) -> Generic ReadPreset
forall x. Rep ReadPreset x -> ReadPreset
forall x. ReadPreset -> Rep ReadPreset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReadPreset x -> ReadPreset
$cfrom :: forall x. ReadPreset -> Rep ReadPreset x
Prelude.Generic)

-- |
-- Create a value of 'ReadPreset' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'id', 'readPreset_id' - The identifier of the preset for which you want to get detailed
-- information.
newReadPreset ::
  -- | 'id'
  Prelude.Text ->
  ReadPreset
newReadPreset :: Text -> ReadPreset
newReadPreset Text
pId_ = ReadPreset' :: Text -> ReadPreset
ReadPreset' {$sel:id:ReadPreset' :: Text
id = Text
pId_}

-- | The identifier of the preset for which you want to get detailed
-- information.
readPreset_id :: Lens.Lens' ReadPreset Prelude.Text
readPreset_id :: (Text -> f Text) -> ReadPreset -> f ReadPreset
readPreset_id = (ReadPreset -> Text)
-> (ReadPreset -> Text -> ReadPreset)
-> Lens ReadPreset ReadPreset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadPreset' {Text
id :: Text
$sel:id:ReadPreset' :: ReadPreset -> Text
id} -> Text
id) (\s :: ReadPreset
s@ReadPreset' {} Text
a -> ReadPreset
s {$sel:id:ReadPreset' :: Text
id = Text
a} :: ReadPreset)

instance Core.AWSRequest ReadPreset where
  type AWSResponse ReadPreset = ReadPresetResponse
  request :: ReadPreset -> Request ReadPreset
request = Service -> ReadPreset -> Request ReadPreset
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ReadPreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ReadPreset)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ReadPreset))
-> Logger
-> Service
-> Proxy ReadPreset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ReadPreset)))
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 -> ReadPresetResponse
ReadPresetResponse'
            (Maybe Preset -> Int -> ReadPresetResponse)
-> Either String (Maybe Preset)
-> Either String (Int -> ReadPresetResponse)
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 -> ReadPresetResponse)
-> Either String Int -> Either String ReadPresetResponse
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 ReadPreset

instance Prelude.NFData ReadPreset

instance Core.ToHeaders ReadPreset where
  toHeaders :: ReadPreset -> ResponseHeaders
toHeaders = ResponseHeaders -> ReadPreset -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ReadPreset where
  toPath :: ReadPreset -> ByteString
toPath ReadPreset' {Text
id :: Text
$sel:id:ReadPreset' :: ReadPreset -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2012-09-25/presets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]

instance Core.ToQuery ReadPreset where
  toQuery :: ReadPreset -> QueryString
toQuery = QueryString -> ReadPreset -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | The @ReadPresetResponse@ structure.
--
-- /See:/ 'newReadPresetResponse' smart constructor.
data ReadPresetResponse = ReadPresetResponse'
  { -- | A section of the response body that provides information about the
    -- preset.
    ReadPresetResponse -> Maybe Preset
preset :: Prelude.Maybe Preset,
    -- | The response's http status code.
    ReadPresetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ReadPresetResponse -> ReadPresetResponse -> Bool
(ReadPresetResponse -> ReadPresetResponse -> Bool)
-> (ReadPresetResponse -> ReadPresetResponse -> Bool)
-> Eq ReadPresetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReadPresetResponse -> ReadPresetResponse -> Bool
$c/= :: ReadPresetResponse -> ReadPresetResponse -> Bool
== :: ReadPresetResponse -> ReadPresetResponse -> Bool
$c== :: ReadPresetResponse -> ReadPresetResponse -> Bool
Prelude.Eq, ReadPrec [ReadPresetResponse]
ReadPrec ReadPresetResponse
Int -> ReadS ReadPresetResponse
ReadS [ReadPresetResponse]
(Int -> ReadS ReadPresetResponse)
-> ReadS [ReadPresetResponse]
-> ReadPrec ReadPresetResponse
-> ReadPrec [ReadPresetResponse]
-> Read ReadPresetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReadPresetResponse]
$creadListPrec :: ReadPrec [ReadPresetResponse]
readPrec :: ReadPrec ReadPresetResponse
$creadPrec :: ReadPrec ReadPresetResponse
readList :: ReadS [ReadPresetResponse]
$creadList :: ReadS [ReadPresetResponse]
readsPrec :: Int -> ReadS ReadPresetResponse
$creadsPrec :: Int -> ReadS ReadPresetResponse
Prelude.Read, Int -> ReadPresetResponse -> ShowS
[ReadPresetResponse] -> ShowS
ReadPresetResponse -> String
(Int -> ReadPresetResponse -> ShowS)
-> (ReadPresetResponse -> String)
-> ([ReadPresetResponse] -> ShowS)
-> Show ReadPresetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReadPresetResponse] -> ShowS
$cshowList :: [ReadPresetResponse] -> ShowS
show :: ReadPresetResponse -> String
$cshow :: ReadPresetResponse -> String
showsPrec :: Int -> ReadPresetResponse -> ShowS
$cshowsPrec :: Int -> ReadPresetResponse -> ShowS
Prelude.Show, (forall x. ReadPresetResponse -> Rep ReadPresetResponse x)
-> (forall x. Rep ReadPresetResponse x -> ReadPresetResponse)
-> Generic ReadPresetResponse
forall x. Rep ReadPresetResponse x -> ReadPresetResponse
forall x. ReadPresetResponse -> Rep ReadPresetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReadPresetResponse x -> ReadPresetResponse
$cfrom :: forall x. ReadPresetResponse -> Rep ReadPresetResponse x
Prelude.Generic)

-- |
-- Create a value of 'ReadPresetResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'preset', 'readPresetResponse_preset' - A section of the response body that provides information about the
-- preset.
--
-- 'httpStatus', 'readPresetResponse_httpStatus' - The response's http status code.
newReadPresetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ReadPresetResponse
newReadPresetResponse :: Int -> ReadPresetResponse
newReadPresetResponse Int
pHttpStatus_ =
  ReadPresetResponse' :: Maybe Preset -> Int -> ReadPresetResponse
ReadPresetResponse'
    { $sel:preset:ReadPresetResponse' :: Maybe Preset
preset = Maybe Preset
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ReadPresetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A section of the response body that provides information about the
-- preset.
readPresetResponse_preset :: Lens.Lens' ReadPresetResponse (Prelude.Maybe Preset)
readPresetResponse_preset :: (Maybe Preset -> f (Maybe Preset))
-> ReadPresetResponse -> f ReadPresetResponse
readPresetResponse_preset = (ReadPresetResponse -> Maybe Preset)
-> (ReadPresetResponse -> Maybe Preset -> ReadPresetResponse)
-> Lens
     ReadPresetResponse ReadPresetResponse (Maybe Preset) (Maybe Preset)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadPresetResponse' {Maybe Preset
preset :: Maybe Preset
$sel:preset:ReadPresetResponse' :: ReadPresetResponse -> Maybe Preset
preset} -> Maybe Preset
preset) (\s :: ReadPresetResponse
s@ReadPresetResponse' {} Maybe Preset
a -> ReadPresetResponse
s {$sel:preset:ReadPresetResponse' :: Maybe Preset
preset = Maybe Preset
a} :: ReadPresetResponse)

-- | The response's http status code.
readPresetResponse_httpStatus :: Lens.Lens' ReadPresetResponse Prelude.Int
readPresetResponse_httpStatus :: (Int -> f Int) -> ReadPresetResponse -> f ReadPresetResponse
readPresetResponse_httpStatus = (ReadPresetResponse -> Int)
-> (ReadPresetResponse -> Int -> ReadPresetResponse)
-> Lens ReadPresetResponse ReadPresetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadPresetResponse' {Int
httpStatus :: Int
$sel:httpStatus:ReadPresetResponse' :: ReadPresetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ReadPresetResponse
s@ReadPresetResponse' {} Int
a -> ReadPresetResponse
s {$sel:httpStatus:ReadPresetResponse' :: Int
httpStatus = Int
a} :: ReadPresetResponse)

instance Prelude.NFData ReadPresetResponse