{-# 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.APIGateway.GetUsagePlanKey
(
GetUsagePlanKey (..),
newGetUsagePlanKey,
getUsagePlanKey_usagePlanId,
getUsagePlanKey_keyId,
UsagePlanKey (..),
newUsagePlanKey,
usagePlanKey_value,
usagePlanKey_name,
usagePlanKey_id,
usagePlanKey_type,
)
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
data GetUsagePlanKey = GetUsagePlanKey'
{
GetUsagePlanKey -> Text
usagePlanId :: Prelude.Text,
GetUsagePlanKey -> Text
keyId :: Prelude.Text
}
deriving (GetUsagePlanKey -> GetUsagePlanKey -> Bool
(GetUsagePlanKey -> GetUsagePlanKey -> Bool)
-> (GetUsagePlanKey -> GetUsagePlanKey -> Bool)
-> Eq GetUsagePlanKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUsagePlanKey -> GetUsagePlanKey -> Bool
$c/= :: GetUsagePlanKey -> GetUsagePlanKey -> Bool
== :: GetUsagePlanKey -> GetUsagePlanKey -> Bool
$c== :: GetUsagePlanKey -> GetUsagePlanKey -> Bool
Prelude.Eq, ReadPrec [GetUsagePlanKey]
ReadPrec GetUsagePlanKey
Int -> ReadS GetUsagePlanKey
ReadS [GetUsagePlanKey]
(Int -> ReadS GetUsagePlanKey)
-> ReadS [GetUsagePlanKey]
-> ReadPrec GetUsagePlanKey
-> ReadPrec [GetUsagePlanKey]
-> Read GetUsagePlanKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUsagePlanKey]
$creadListPrec :: ReadPrec [GetUsagePlanKey]
readPrec :: ReadPrec GetUsagePlanKey
$creadPrec :: ReadPrec GetUsagePlanKey
readList :: ReadS [GetUsagePlanKey]
$creadList :: ReadS [GetUsagePlanKey]
readsPrec :: Int -> ReadS GetUsagePlanKey
$creadsPrec :: Int -> ReadS GetUsagePlanKey
Prelude.Read, Int -> GetUsagePlanKey -> ShowS
[GetUsagePlanKey] -> ShowS
GetUsagePlanKey -> String
(Int -> GetUsagePlanKey -> ShowS)
-> (GetUsagePlanKey -> String)
-> ([GetUsagePlanKey] -> ShowS)
-> Show GetUsagePlanKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUsagePlanKey] -> ShowS
$cshowList :: [GetUsagePlanKey] -> ShowS
show :: GetUsagePlanKey -> String
$cshow :: GetUsagePlanKey -> String
showsPrec :: Int -> GetUsagePlanKey -> ShowS
$cshowsPrec :: Int -> GetUsagePlanKey -> ShowS
Prelude.Show, (forall x. GetUsagePlanKey -> Rep GetUsagePlanKey x)
-> (forall x. Rep GetUsagePlanKey x -> GetUsagePlanKey)
-> Generic GetUsagePlanKey
forall x. Rep GetUsagePlanKey x -> GetUsagePlanKey
forall x. GetUsagePlanKey -> Rep GetUsagePlanKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUsagePlanKey x -> GetUsagePlanKey
$cfrom :: forall x. GetUsagePlanKey -> Rep GetUsagePlanKey x
Prelude.Generic)
newGetUsagePlanKey ::
Prelude.Text ->
Prelude.Text ->
GetUsagePlanKey
newGetUsagePlanKey :: Text -> Text -> GetUsagePlanKey
newGetUsagePlanKey Text
pUsagePlanId_ Text
pKeyId_ =
GetUsagePlanKey' :: Text -> Text -> GetUsagePlanKey
GetUsagePlanKey'
{ $sel:usagePlanId:GetUsagePlanKey' :: Text
usagePlanId = Text
pUsagePlanId_,
$sel:keyId:GetUsagePlanKey' :: Text
keyId = Text
pKeyId_
}
getUsagePlanKey_usagePlanId :: Lens.Lens' GetUsagePlanKey Prelude.Text
getUsagePlanKey_usagePlanId :: (Text -> f Text) -> GetUsagePlanKey -> f GetUsagePlanKey
getUsagePlanKey_usagePlanId = (GetUsagePlanKey -> Text)
-> (GetUsagePlanKey -> Text -> GetUsagePlanKey)
-> Lens GetUsagePlanKey GetUsagePlanKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlanKey' {Text
usagePlanId :: Text
$sel:usagePlanId:GetUsagePlanKey' :: GetUsagePlanKey -> Text
usagePlanId} -> Text
usagePlanId) (\s :: GetUsagePlanKey
s@GetUsagePlanKey' {} Text
a -> GetUsagePlanKey
s {$sel:usagePlanId:GetUsagePlanKey' :: Text
usagePlanId = Text
a} :: GetUsagePlanKey)
getUsagePlanKey_keyId :: Lens.Lens' GetUsagePlanKey Prelude.Text
getUsagePlanKey_keyId :: (Text -> f Text) -> GetUsagePlanKey -> f GetUsagePlanKey
getUsagePlanKey_keyId = (GetUsagePlanKey -> Text)
-> (GetUsagePlanKey -> Text -> GetUsagePlanKey)
-> Lens GetUsagePlanKey GetUsagePlanKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlanKey' {Text
keyId :: Text
$sel:keyId:GetUsagePlanKey' :: GetUsagePlanKey -> Text
keyId} -> Text
keyId) (\s :: GetUsagePlanKey
s@GetUsagePlanKey' {} Text
a -> GetUsagePlanKey
s {$sel:keyId:GetUsagePlanKey' :: Text
keyId = Text
a} :: GetUsagePlanKey)
instance Core.AWSRequest GetUsagePlanKey where
type AWSResponse GetUsagePlanKey = UsagePlanKey
request :: GetUsagePlanKey -> Request GetUsagePlanKey
request = Service -> GetUsagePlanKey -> Request GetUsagePlanKey
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetUsagePlanKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUsagePlanKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetUsagePlanKey))
-> Logger
-> Service
-> Proxy GetUsagePlanKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUsagePlanKey)))
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 UsagePlanKey
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetUsagePlanKey
instance Prelude.NFData GetUsagePlanKey
instance Core.ToHeaders GetUsagePlanKey where
toHeaders :: GetUsagePlanKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetUsagePlanKey -> 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 GetUsagePlanKey where
toPath :: GetUsagePlanKey -> ByteString
toPath GetUsagePlanKey' {Text
keyId :: Text
usagePlanId :: Text
$sel:keyId:GetUsagePlanKey' :: GetUsagePlanKey -> Text
$sel:usagePlanId:GetUsagePlanKey' :: GetUsagePlanKey -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/usageplans/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
usagePlanId,
ByteString
"/keys/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
keyId
]
instance Core.ToQuery GetUsagePlanKey where
toQuery :: GetUsagePlanKey -> QueryString
toQuery = QueryString -> GetUsagePlanKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty