{-# 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.GetUsagePlan
(
GetUsagePlan (..),
newGetUsagePlan,
getUsagePlan_usagePlanId,
UsagePlan (..),
newUsagePlan,
usagePlan_apiStages,
usagePlan_name,
usagePlan_id,
usagePlan_throttle,
usagePlan_quota,
usagePlan_description,
usagePlan_productCode,
usagePlan_tags,
)
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 GetUsagePlan = GetUsagePlan'
{
GetUsagePlan -> Text
usagePlanId :: Prelude.Text
}
deriving (GetUsagePlan -> GetUsagePlan -> Bool
(GetUsagePlan -> GetUsagePlan -> Bool)
-> (GetUsagePlan -> GetUsagePlan -> Bool) -> Eq GetUsagePlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUsagePlan -> GetUsagePlan -> Bool
$c/= :: GetUsagePlan -> GetUsagePlan -> Bool
== :: GetUsagePlan -> GetUsagePlan -> Bool
$c== :: GetUsagePlan -> GetUsagePlan -> Bool
Prelude.Eq, ReadPrec [GetUsagePlan]
ReadPrec GetUsagePlan
Int -> ReadS GetUsagePlan
ReadS [GetUsagePlan]
(Int -> ReadS GetUsagePlan)
-> ReadS [GetUsagePlan]
-> ReadPrec GetUsagePlan
-> ReadPrec [GetUsagePlan]
-> Read GetUsagePlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUsagePlan]
$creadListPrec :: ReadPrec [GetUsagePlan]
readPrec :: ReadPrec GetUsagePlan
$creadPrec :: ReadPrec GetUsagePlan
readList :: ReadS [GetUsagePlan]
$creadList :: ReadS [GetUsagePlan]
readsPrec :: Int -> ReadS GetUsagePlan
$creadsPrec :: Int -> ReadS GetUsagePlan
Prelude.Read, Int -> GetUsagePlan -> ShowS
[GetUsagePlan] -> ShowS
GetUsagePlan -> String
(Int -> GetUsagePlan -> ShowS)
-> (GetUsagePlan -> String)
-> ([GetUsagePlan] -> ShowS)
-> Show GetUsagePlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUsagePlan] -> ShowS
$cshowList :: [GetUsagePlan] -> ShowS
show :: GetUsagePlan -> String
$cshow :: GetUsagePlan -> String
showsPrec :: Int -> GetUsagePlan -> ShowS
$cshowsPrec :: Int -> GetUsagePlan -> ShowS
Prelude.Show, (forall x. GetUsagePlan -> Rep GetUsagePlan x)
-> (forall x. Rep GetUsagePlan x -> GetUsagePlan)
-> Generic GetUsagePlan
forall x. Rep GetUsagePlan x -> GetUsagePlan
forall x. GetUsagePlan -> Rep GetUsagePlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUsagePlan x -> GetUsagePlan
$cfrom :: forall x. GetUsagePlan -> Rep GetUsagePlan x
Prelude.Generic)
newGetUsagePlan ::
Prelude.Text ->
GetUsagePlan
newGetUsagePlan :: Text -> GetUsagePlan
newGetUsagePlan Text
pUsagePlanId_ =
GetUsagePlan' :: Text -> GetUsagePlan
GetUsagePlan' {$sel:usagePlanId:GetUsagePlan' :: Text
usagePlanId = Text
pUsagePlanId_}
getUsagePlan_usagePlanId :: Lens.Lens' GetUsagePlan Prelude.Text
getUsagePlan_usagePlanId :: (Text -> f Text) -> GetUsagePlan -> f GetUsagePlan
getUsagePlan_usagePlanId = (GetUsagePlan -> Text)
-> (GetUsagePlan -> Text -> GetUsagePlan)
-> Lens GetUsagePlan GetUsagePlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:GetUsagePlan' :: GetUsagePlan -> Text
usagePlanId} -> Text
usagePlanId) (\s :: GetUsagePlan
s@GetUsagePlan' {} Text
a -> GetUsagePlan
s {$sel:usagePlanId:GetUsagePlan' :: Text
usagePlanId = Text
a} :: GetUsagePlan)
instance Core.AWSRequest GetUsagePlan where
type AWSResponse GetUsagePlan = UsagePlan
request :: GetUsagePlan -> Request GetUsagePlan
request = Service -> GetUsagePlan -> Request GetUsagePlan
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetUsagePlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUsagePlan)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetUsagePlan))
-> Logger
-> Service
-> Proxy GetUsagePlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUsagePlan)))
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 UsagePlan
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetUsagePlan
instance Prelude.NFData GetUsagePlan
instance Core.ToHeaders GetUsagePlan where
toHeaders :: GetUsagePlan -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetUsagePlan -> 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 GetUsagePlan where
toPath :: GetUsagePlan -> ByteString
toPath GetUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:GetUsagePlan' :: GetUsagePlan -> 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]
instance Core.ToQuery GetUsagePlan where
toQuery :: GetUsagePlan -> QueryString
toQuery = QueryString -> GetUsagePlan -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty