{-# 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.APIGateway.GetSdkType
-- 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)
--
-- -- | Undocumented operation.
module Amazonka.APIGateway.GetSdkType
  ( -- * Creating a Request
    GetSdkType (..),
    newGetSdkType,

    -- * Request Lenses
    getSdkType_id,

    -- * Destructuring the Response
    SdkType (..),
    newSdkType,

    -- * Response Lenses
    sdkType_friendlyName,
    sdkType_configurationProperties,
    sdkType_id,
    sdkType_description,
  )
where

import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Get an SdkType instance.
--
-- /See:/ 'newGetSdkType' smart constructor.
data GetSdkType = GetSdkType'
  { -- | [Required] The identifier of the queried SdkType instance.
    GetSdkType -> Text
id :: Prelude.Text
  }
  deriving (GetSdkType -> GetSdkType -> Bool
(GetSdkType -> GetSdkType -> Bool)
-> (GetSdkType -> GetSdkType -> Bool) -> Eq GetSdkType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSdkType -> GetSdkType -> Bool
$c/= :: GetSdkType -> GetSdkType -> Bool
== :: GetSdkType -> GetSdkType -> Bool
$c== :: GetSdkType -> GetSdkType -> Bool
Prelude.Eq, ReadPrec [GetSdkType]
ReadPrec GetSdkType
Int -> ReadS GetSdkType
ReadS [GetSdkType]
(Int -> ReadS GetSdkType)
-> ReadS [GetSdkType]
-> ReadPrec GetSdkType
-> ReadPrec [GetSdkType]
-> Read GetSdkType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSdkType]
$creadListPrec :: ReadPrec [GetSdkType]
readPrec :: ReadPrec GetSdkType
$creadPrec :: ReadPrec GetSdkType
readList :: ReadS [GetSdkType]
$creadList :: ReadS [GetSdkType]
readsPrec :: Int -> ReadS GetSdkType
$creadsPrec :: Int -> ReadS GetSdkType
Prelude.Read, Int -> GetSdkType -> ShowS
[GetSdkType] -> ShowS
GetSdkType -> String
(Int -> GetSdkType -> ShowS)
-> (GetSdkType -> String)
-> ([GetSdkType] -> ShowS)
-> Show GetSdkType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSdkType] -> ShowS
$cshowList :: [GetSdkType] -> ShowS
show :: GetSdkType -> String
$cshow :: GetSdkType -> String
showsPrec :: Int -> GetSdkType -> ShowS
$cshowsPrec :: Int -> GetSdkType -> ShowS
Prelude.Show, (forall x. GetSdkType -> Rep GetSdkType x)
-> (forall x. Rep GetSdkType x -> GetSdkType) -> Generic GetSdkType
forall x. Rep GetSdkType x -> GetSdkType
forall x. GetSdkType -> Rep GetSdkType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSdkType x -> GetSdkType
$cfrom :: forall x. GetSdkType -> Rep GetSdkType x
Prelude.Generic)

-- |
-- Create a value of 'GetSdkType' 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', 'getSdkType_id' - [Required] The identifier of the queried SdkType instance.
newGetSdkType ::
  -- | 'id'
  Prelude.Text ->
  GetSdkType
newGetSdkType :: Text -> GetSdkType
newGetSdkType Text
pId_ = GetSdkType' :: Text -> GetSdkType
GetSdkType' {$sel:id:GetSdkType' :: Text
id = Text
pId_}

-- | [Required] The identifier of the queried SdkType instance.
getSdkType_id :: Lens.Lens' GetSdkType Prelude.Text
getSdkType_id :: (Text -> f Text) -> GetSdkType -> f GetSdkType
getSdkType_id = (GetSdkType -> Text)
-> (GetSdkType -> Text -> GetSdkType)
-> Lens GetSdkType GetSdkType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSdkType' {Text
id :: Text
$sel:id:GetSdkType' :: GetSdkType -> Text
id} -> Text
id) (\s :: GetSdkType
s@GetSdkType' {} Text
a -> GetSdkType
s {$sel:id:GetSdkType' :: Text
id = Text
a} :: GetSdkType)

instance Core.AWSRequest GetSdkType where
  type AWSResponse GetSdkType = SdkType
  request :: GetSdkType -> Request GetSdkType
request = Service -> GetSdkType -> Request GetSdkType
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSdkType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSdkType)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSdkType))
-> Logger
-> Service
-> Proxy GetSdkType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSdkType)))
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 -> Object -> Either String SdkType
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable GetSdkType

instance Prelude.NFData GetSdkType

instance Core.ToHeaders GetSdkType where
  toHeaders :: GetSdkType -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetSdkType -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

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

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