{-# 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.GetApiKey
(
GetApiKey (..),
newGetApiKey,
getApiKey_includeValue,
getApiKey_apiKey,
ApiKey (..),
newApiKey,
apiKey_enabled,
apiKey_value,
apiKey_customerId,
apiKey_createdDate,
apiKey_name,
apiKey_id,
apiKey_stageKeys,
apiKey_lastUpdatedDate,
apiKey_description,
apiKey_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 GetApiKey = GetApiKey'
{
GetApiKey -> Maybe Bool
includeValue :: Prelude.Maybe Prelude.Bool,
GetApiKey -> Text
apiKey :: Prelude.Text
}
deriving (GetApiKey -> GetApiKey -> Bool
(GetApiKey -> GetApiKey -> Bool)
-> (GetApiKey -> GetApiKey -> Bool) -> Eq GetApiKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApiKey -> GetApiKey -> Bool
$c/= :: GetApiKey -> GetApiKey -> Bool
== :: GetApiKey -> GetApiKey -> Bool
$c== :: GetApiKey -> GetApiKey -> Bool
Prelude.Eq, ReadPrec [GetApiKey]
ReadPrec GetApiKey
Int -> ReadS GetApiKey
ReadS [GetApiKey]
(Int -> ReadS GetApiKey)
-> ReadS [GetApiKey]
-> ReadPrec GetApiKey
-> ReadPrec [GetApiKey]
-> Read GetApiKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApiKey]
$creadListPrec :: ReadPrec [GetApiKey]
readPrec :: ReadPrec GetApiKey
$creadPrec :: ReadPrec GetApiKey
readList :: ReadS [GetApiKey]
$creadList :: ReadS [GetApiKey]
readsPrec :: Int -> ReadS GetApiKey
$creadsPrec :: Int -> ReadS GetApiKey
Prelude.Read, Int -> GetApiKey -> ShowS
[GetApiKey] -> ShowS
GetApiKey -> String
(Int -> GetApiKey -> ShowS)
-> (GetApiKey -> String)
-> ([GetApiKey] -> ShowS)
-> Show GetApiKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApiKey] -> ShowS
$cshowList :: [GetApiKey] -> ShowS
show :: GetApiKey -> String
$cshow :: GetApiKey -> String
showsPrec :: Int -> GetApiKey -> ShowS
$cshowsPrec :: Int -> GetApiKey -> ShowS
Prelude.Show, (forall x. GetApiKey -> Rep GetApiKey x)
-> (forall x. Rep GetApiKey x -> GetApiKey) -> Generic GetApiKey
forall x. Rep GetApiKey x -> GetApiKey
forall x. GetApiKey -> Rep GetApiKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApiKey x -> GetApiKey
$cfrom :: forall x. GetApiKey -> Rep GetApiKey x
Prelude.Generic)
newGetApiKey ::
Prelude.Text ->
GetApiKey
newGetApiKey :: Text -> GetApiKey
newGetApiKey Text
pApiKey_ =
GetApiKey' :: Maybe Bool -> Text -> GetApiKey
GetApiKey'
{ $sel:includeValue:GetApiKey' :: Maybe Bool
includeValue = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:apiKey:GetApiKey' :: Text
apiKey = Text
pApiKey_
}
getApiKey_includeValue :: Lens.Lens' GetApiKey (Prelude.Maybe Prelude.Bool)
getApiKey_includeValue :: (Maybe Bool -> f (Maybe Bool)) -> GetApiKey -> f GetApiKey
getApiKey_includeValue = (GetApiKey -> Maybe Bool)
-> (GetApiKey -> Maybe Bool -> GetApiKey)
-> Lens GetApiKey GetApiKey (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiKey' {Maybe Bool
includeValue :: Maybe Bool
$sel:includeValue:GetApiKey' :: GetApiKey -> Maybe Bool
includeValue} -> Maybe Bool
includeValue) (\s :: GetApiKey
s@GetApiKey' {} Maybe Bool
a -> GetApiKey
s {$sel:includeValue:GetApiKey' :: Maybe Bool
includeValue = Maybe Bool
a} :: GetApiKey)
getApiKey_apiKey :: Lens.Lens' GetApiKey Prelude.Text
getApiKey_apiKey :: (Text -> f Text) -> GetApiKey -> f GetApiKey
getApiKey_apiKey = (GetApiKey -> Text)
-> (GetApiKey -> Text -> GetApiKey)
-> Lens GetApiKey GetApiKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiKey' {Text
apiKey :: Text
$sel:apiKey:GetApiKey' :: GetApiKey -> Text
apiKey} -> Text
apiKey) (\s :: GetApiKey
s@GetApiKey' {} Text
a -> GetApiKey
s {$sel:apiKey:GetApiKey' :: Text
apiKey = Text
a} :: GetApiKey)
instance Core.AWSRequest GetApiKey where
type AWSResponse GetApiKey = ApiKey
request :: GetApiKey -> Request GetApiKey
request = Service -> GetApiKey -> Request GetApiKey
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetApiKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApiKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApiKey))
-> Logger
-> Service
-> Proxy GetApiKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApiKey)))
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 ApiKey
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetApiKey
instance Prelude.NFData GetApiKey
instance Core.ToHeaders GetApiKey where
toHeaders :: GetApiKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApiKey -> 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 GetApiKey where
toPath :: GetApiKey -> ByteString
toPath GetApiKey' {Maybe Bool
Text
apiKey :: Text
includeValue :: Maybe Bool
$sel:apiKey:GetApiKey' :: GetApiKey -> Text
$sel:includeValue:GetApiKey' :: GetApiKey -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/apikeys/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiKey]
instance Core.ToQuery GetApiKey where
toQuery :: GetApiKey -> QueryString
toQuery GetApiKey' {Maybe Bool
Text
apiKey :: Text
includeValue :: Maybe Bool
$sel:apiKey:GetApiKey' :: GetApiKey -> Text
$sel:includeValue:GetApiKey' :: GetApiKey -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"includeValue" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeValue]