{-# 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.AppSync.UpdateApiKey
(
UpdateApiKey (..),
newUpdateApiKey,
updateApiKey_expires,
updateApiKey_description,
updateApiKey_apiId,
updateApiKey_id,
UpdateApiKeyResponse (..),
newUpdateApiKeyResponse,
updateApiKeyResponse_apiKey,
updateApiKeyResponse_httpStatus,
)
where
import Amazonka.AppSync.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 UpdateApiKey = UpdateApiKey'
{
UpdateApiKey -> Maybe Integer
expires :: Prelude.Maybe Prelude.Integer,
UpdateApiKey -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateApiKey -> Text
apiId :: Prelude.Text,
UpdateApiKey -> Text
id :: Prelude.Text
}
deriving (UpdateApiKey -> UpdateApiKey -> Bool
(UpdateApiKey -> UpdateApiKey -> Bool)
-> (UpdateApiKey -> UpdateApiKey -> Bool) -> Eq UpdateApiKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateApiKey -> UpdateApiKey -> Bool
$c/= :: UpdateApiKey -> UpdateApiKey -> Bool
== :: UpdateApiKey -> UpdateApiKey -> Bool
$c== :: UpdateApiKey -> UpdateApiKey -> Bool
Prelude.Eq, ReadPrec [UpdateApiKey]
ReadPrec UpdateApiKey
Int -> ReadS UpdateApiKey
ReadS [UpdateApiKey]
(Int -> ReadS UpdateApiKey)
-> ReadS [UpdateApiKey]
-> ReadPrec UpdateApiKey
-> ReadPrec [UpdateApiKey]
-> Read UpdateApiKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateApiKey]
$creadListPrec :: ReadPrec [UpdateApiKey]
readPrec :: ReadPrec UpdateApiKey
$creadPrec :: ReadPrec UpdateApiKey
readList :: ReadS [UpdateApiKey]
$creadList :: ReadS [UpdateApiKey]
readsPrec :: Int -> ReadS UpdateApiKey
$creadsPrec :: Int -> ReadS UpdateApiKey
Prelude.Read, Int -> UpdateApiKey -> ShowS
[UpdateApiKey] -> ShowS
UpdateApiKey -> String
(Int -> UpdateApiKey -> ShowS)
-> (UpdateApiKey -> String)
-> ([UpdateApiKey] -> ShowS)
-> Show UpdateApiKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateApiKey] -> ShowS
$cshowList :: [UpdateApiKey] -> ShowS
show :: UpdateApiKey -> String
$cshow :: UpdateApiKey -> String
showsPrec :: Int -> UpdateApiKey -> ShowS
$cshowsPrec :: Int -> UpdateApiKey -> ShowS
Prelude.Show, (forall x. UpdateApiKey -> Rep UpdateApiKey x)
-> (forall x. Rep UpdateApiKey x -> UpdateApiKey)
-> Generic UpdateApiKey
forall x. Rep UpdateApiKey x -> UpdateApiKey
forall x. UpdateApiKey -> Rep UpdateApiKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateApiKey x -> UpdateApiKey
$cfrom :: forall x. UpdateApiKey -> Rep UpdateApiKey x
Prelude.Generic)
newUpdateApiKey ::
Prelude.Text ->
Prelude.Text ->
UpdateApiKey
newUpdateApiKey :: Text -> Text -> UpdateApiKey
newUpdateApiKey Text
pApiId_ Text
pId_ =
UpdateApiKey' :: Maybe Integer -> Maybe Text -> Text -> Text -> UpdateApiKey
UpdateApiKey'
{ $sel:expires:UpdateApiKey' :: Maybe Integer
expires = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateApiKey' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:apiId:UpdateApiKey' :: Text
apiId = Text
pApiId_,
$sel:id:UpdateApiKey' :: Text
id = Text
pId_
}
updateApiKey_expires :: Lens.Lens' UpdateApiKey (Prelude.Maybe Prelude.Integer)
updateApiKey_expires :: (Maybe Integer -> f (Maybe Integer))
-> UpdateApiKey -> f UpdateApiKey
updateApiKey_expires = (UpdateApiKey -> Maybe Integer)
-> (UpdateApiKey -> Maybe Integer -> UpdateApiKey)
-> Lens UpdateApiKey UpdateApiKey (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiKey' {Maybe Integer
expires :: Maybe Integer
$sel:expires:UpdateApiKey' :: UpdateApiKey -> Maybe Integer
expires} -> Maybe Integer
expires) (\s :: UpdateApiKey
s@UpdateApiKey' {} Maybe Integer
a -> UpdateApiKey
s {$sel:expires:UpdateApiKey' :: Maybe Integer
expires = Maybe Integer
a} :: UpdateApiKey)
updateApiKey_description :: Lens.Lens' UpdateApiKey (Prelude.Maybe Prelude.Text)
updateApiKey_description :: (Maybe Text -> f (Maybe Text)) -> UpdateApiKey -> f UpdateApiKey
updateApiKey_description = (UpdateApiKey -> Maybe Text)
-> (UpdateApiKey -> Maybe Text -> UpdateApiKey)
-> Lens UpdateApiKey UpdateApiKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiKey' {Maybe Text
description :: Maybe Text
$sel:description:UpdateApiKey' :: UpdateApiKey -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateApiKey
s@UpdateApiKey' {} Maybe Text
a -> UpdateApiKey
s {$sel:description:UpdateApiKey' :: Maybe Text
description = Maybe Text
a} :: UpdateApiKey)
updateApiKey_apiId :: Lens.Lens' UpdateApiKey Prelude.Text
updateApiKey_apiId :: (Text -> f Text) -> UpdateApiKey -> f UpdateApiKey
updateApiKey_apiId = (UpdateApiKey -> Text)
-> (UpdateApiKey -> Text -> UpdateApiKey)
-> Lens UpdateApiKey UpdateApiKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiKey' {Text
apiId :: Text
$sel:apiId:UpdateApiKey' :: UpdateApiKey -> Text
apiId} -> Text
apiId) (\s :: UpdateApiKey
s@UpdateApiKey' {} Text
a -> UpdateApiKey
s {$sel:apiId:UpdateApiKey' :: Text
apiId = Text
a} :: UpdateApiKey)
updateApiKey_id :: Lens.Lens' UpdateApiKey Prelude.Text
updateApiKey_id :: (Text -> f Text) -> UpdateApiKey -> f UpdateApiKey
updateApiKey_id = (UpdateApiKey -> Text)
-> (UpdateApiKey -> Text -> UpdateApiKey)
-> Lens UpdateApiKey UpdateApiKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiKey' {Text
id :: Text
$sel:id:UpdateApiKey' :: UpdateApiKey -> Text
id} -> Text
id) (\s :: UpdateApiKey
s@UpdateApiKey' {} Text
a -> UpdateApiKey
s {$sel:id:UpdateApiKey' :: Text
id = Text
a} :: UpdateApiKey)
instance Core.AWSRequest UpdateApiKey where
type AWSResponse UpdateApiKey = UpdateApiKeyResponse
request :: UpdateApiKey -> Request UpdateApiKey
request = Service -> UpdateApiKey -> Request UpdateApiKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateApiKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateApiKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateApiKey))
-> Logger
-> Service
-> Proxy UpdateApiKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateApiKey)))
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 ->
Maybe ApiKey -> Int -> UpdateApiKeyResponse
UpdateApiKeyResponse'
(Maybe ApiKey -> Int -> UpdateApiKeyResponse)
-> Either String (Maybe ApiKey)
-> Either String (Int -> UpdateApiKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ApiKey)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"apiKey")
Either String (Int -> UpdateApiKeyResponse)
-> Either String Int -> Either String UpdateApiKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateApiKey
instance Prelude.NFData UpdateApiKey
instance Core.ToHeaders UpdateApiKey where
toHeaders :: UpdateApiKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateApiKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateApiKey where
toJSON :: UpdateApiKey -> Value
toJSON UpdateApiKey' {Maybe Integer
Maybe Text
Text
id :: Text
apiId :: Text
description :: Maybe Text
expires :: Maybe Integer
$sel:id:UpdateApiKey' :: UpdateApiKey -> Text
$sel:apiId:UpdateApiKey' :: UpdateApiKey -> Text
$sel:description:UpdateApiKey' :: UpdateApiKey -> Maybe Text
$sel:expires:UpdateApiKey' :: UpdateApiKey -> Maybe Integer
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"expires" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
expires,
(Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
]
)
instance Core.ToPath UpdateApiKey where
toPath :: UpdateApiKey -> ByteString
toPath UpdateApiKey' {Maybe Integer
Maybe Text
Text
id :: Text
apiId :: Text
description :: Maybe Text
expires :: Maybe Integer
$sel:id:UpdateApiKey' :: UpdateApiKey -> Text
$sel:apiId:UpdateApiKey' :: UpdateApiKey -> Text
$sel:description:UpdateApiKey' :: UpdateApiKey -> Maybe Text
$sel:expires:UpdateApiKey' :: UpdateApiKey -> Maybe Integer
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId,
ByteString
"/apikeys/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id
]
instance Core.ToQuery UpdateApiKey where
toQuery :: UpdateApiKey -> QueryString
toQuery = QueryString -> UpdateApiKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateApiKeyResponse = UpdateApiKeyResponse'
{
UpdateApiKeyResponse -> Maybe ApiKey
apiKey :: Prelude.Maybe ApiKey,
UpdateApiKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool
(UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool)
-> (UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool)
-> Eq UpdateApiKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool
$c/= :: UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool
== :: UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool
$c== :: UpdateApiKeyResponse -> UpdateApiKeyResponse -> Bool
Prelude.Eq, ReadPrec [UpdateApiKeyResponse]
ReadPrec UpdateApiKeyResponse
Int -> ReadS UpdateApiKeyResponse
ReadS [UpdateApiKeyResponse]
(Int -> ReadS UpdateApiKeyResponse)
-> ReadS [UpdateApiKeyResponse]
-> ReadPrec UpdateApiKeyResponse
-> ReadPrec [UpdateApiKeyResponse]
-> Read UpdateApiKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateApiKeyResponse]
$creadListPrec :: ReadPrec [UpdateApiKeyResponse]
readPrec :: ReadPrec UpdateApiKeyResponse
$creadPrec :: ReadPrec UpdateApiKeyResponse
readList :: ReadS [UpdateApiKeyResponse]
$creadList :: ReadS [UpdateApiKeyResponse]
readsPrec :: Int -> ReadS UpdateApiKeyResponse
$creadsPrec :: Int -> ReadS UpdateApiKeyResponse
Prelude.Read, Int -> UpdateApiKeyResponse -> ShowS
[UpdateApiKeyResponse] -> ShowS
UpdateApiKeyResponse -> String
(Int -> UpdateApiKeyResponse -> ShowS)
-> (UpdateApiKeyResponse -> String)
-> ([UpdateApiKeyResponse] -> ShowS)
-> Show UpdateApiKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateApiKeyResponse] -> ShowS
$cshowList :: [UpdateApiKeyResponse] -> ShowS
show :: UpdateApiKeyResponse -> String
$cshow :: UpdateApiKeyResponse -> String
showsPrec :: Int -> UpdateApiKeyResponse -> ShowS
$cshowsPrec :: Int -> UpdateApiKeyResponse -> ShowS
Prelude.Show, (forall x. UpdateApiKeyResponse -> Rep UpdateApiKeyResponse x)
-> (forall x. Rep UpdateApiKeyResponse x -> UpdateApiKeyResponse)
-> Generic UpdateApiKeyResponse
forall x. Rep UpdateApiKeyResponse x -> UpdateApiKeyResponse
forall x. UpdateApiKeyResponse -> Rep UpdateApiKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateApiKeyResponse x -> UpdateApiKeyResponse
$cfrom :: forall x. UpdateApiKeyResponse -> Rep UpdateApiKeyResponse x
Prelude.Generic)
newUpdateApiKeyResponse ::
Prelude.Int ->
UpdateApiKeyResponse
newUpdateApiKeyResponse :: Int -> UpdateApiKeyResponse
newUpdateApiKeyResponse Int
pHttpStatus_ =
UpdateApiKeyResponse' :: Maybe ApiKey -> Int -> UpdateApiKeyResponse
UpdateApiKeyResponse'
{ $sel:apiKey:UpdateApiKeyResponse' :: Maybe ApiKey
apiKey = Maybe ApiKey
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateApiKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateApiKeyResponse_apiKey :: Lens.Lens' UpdateApiKeyResponse (Prelude.Maybe ApiKey)
updateApiKeyResponse_apiKey :: (Maybe ApiKey -> f (Maybe ApiKey))
-> UpdateApiKeyResponse -> f UpdateApiKeyResponse
updateApiKeyResponse_apiKey = (UpdateApiKeyResponse -> Maybe ApiKey)
-> (UpdateApiKeyResponse -> Maybe ApiKey -> UpdateApiKeyResponse)
-> Lens
UpdateApiKeyResponse
UpdateApiKeyResponse
(Maybe ApiKey)
(Maybe ApiKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiKeyResponse' {Maybe ApiKey
apiKey :: Maybe ApiKey
$sel:apiKey:UpdateApiKeyResponse' :: UpdateApiKeyResponse -> Maybe ApiKey
apiKey} -> Maybe ApiKey
apiKey) (\s :: UpdateApiKeyResponse
s@UpdateApiKeyResponse' {} Maybe ApiKey
a -> UpdateApiKeyResponse
s {$sel:apiKey:UpdateApiKeyResponse' :: Maybe ApiKey
apiKey = Maybe ApiKey
a} :: UpdateApiKeyResponse)
updateApiKeyResponse_httpStatus :: Lens.Lens' UpdateApiKeyResponse Prelude.Int
updateApiKeyResponse_httpStatus :: (Int -> f Int) -> UpdateApiKeyResponse -> f UpdateApiKeyResponse
updateApiKeyResponse_httpStatus = (UpdateApiKeyResponse -> Int)
-> (UpdateApiKeyResponse -> Int -> UpdateApiKeyResponse)
-> Lens UpdateApiKeyResponse UpdateApiKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateApiKeyResponse' :: UpdateApiKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateApiKeyResponse
s@UpdateApiKeyResponse' {} Int
a -> UpdateApiKeyResponse
s {$sel:httpStatus:UpdateApiKeyResponse' :: Int
httpStatus = Int
a} :: UpdateApiKeyResponse)
instance Prelude.NFData UpdateApiKeyResponse