{-# 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_description,
usagePlan_id,
usagePlan_name,
usagePlan_productCode,
usagePlan_quota,
usagePlan_tags,
usagePlan_throttle,
)
where
import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:usagePlanId:GetUsagePlan' :: Text
usagePlanId = Text
pUsagePlanId_}
getUsagePlan_usagePlanId :: Lens.Lens' GetUsagePlan Prelude.Text
getUsagePlan_usagePlanId :: Lens' GetUsagePlan Text
getUsagePlan_usagePlanId = 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 :: (Service -> Service) -> GetUsagePlan -> Request GetUsagePlan
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetUsagePlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUsagePlan)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable GetUsagePlan where
hashWithSalt :: Int -> GetUsagePlan -> Int
hashWithSalt Int
_salt GetUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:GetUsagePlan' :: GetUsagePlan -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
usagePlanId
instance Prelude.NFData GetUsagePlan where
rnf :: GetUsagePlan -> ()
rnf GetUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:GetUsagePlan' :: GetUsagePlan -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
usagePlanId
instance Data.ToHeaders GetUsagePlan where
toHeaders :: GetUsagePlan -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Data.ToPath GetUsagePlan where
toPath :: GetUsagePlan -> ByteString
toPath GetUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:GetUsagePlan' :: GetUsagePlan -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/usageplans/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
usagePlanId]
instance Data.ToQuery GetUsagePlan where
toQuery :: GetUsagePlan -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty