{-# 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.GetGraphqlApi
(
GetGraphqlApi (..),
newGetGraphqlApi,
getGraphqlApi_apiId,
GetGraphqlApiResponse (..),
newGetGraphqlApiResponse,
getGraphqlApiResponse_graphqlApi,
getGraphqlApiResponse_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 GetGraphqlApi = GetGraphqlApi'
{
GetGraphqlApi -> Text
apiId :: Prelude.Text
}
deriving (GetGraphqlApi -> GetGraphqlApi -> Bool
(GetGraphqlApi -> GetGraphqlApi -> Bool)
-> (GetGraphqlApi -> GetGraphqlApi -> Bool) -> Eq GetGraphqlApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGraphqlApi -> GetGraphqlApi -> Bool
$c/= :: GetGraphqlApi -> GetGraphqlApi -> Bool
== :: GetGraphqlApi -> GetGraphqlApi -> Bool
$c== :: GetGraphqlApi -> GetGraphqlApi -> Bool
Prelude.Eq, ReadPrec [GetGraphqlApi]
ReadPrec GetGraphqlApi
Int -> ReadS GetGraphqlApi
ReadS [GetGraphqlApi]
(Int -> ReadS GetGraphqlApi)
-> ReadS [GetGraphqlApi]
-> ReadPrec GetGraphqlApi
-> ReadPrec [GetGraphqlApi]
-> Read GetGraphqlApi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGraphqlApi]
$creadListPrec :: ReadPrec [GetGraphqlApi]
readPrec :: ReadPrec GetGraphqlApi
$creadPrec :: ReadPrec GetGraphqlApi
readList :: ReadS [GetGraphqlApi]
$creadList :: ReadS [GetGraphqlApi]
readsPrec :: Int -> ReadS GetGraphqlApi
$creadsPrec :: Int -> ReadS GetGraphqlApi
Prelude.Read, Int -> GetGraphqlApi -> ShowS
[GetGraphqlApi] -> ShowS
GetGraphqlApi -> String
(Int -> GetGraphqlApi -> ShowS)
-> (GetGraphqlApi -> String)
-> ([GetGraphqlApi] -> ShowS)
-> Show GetGraphqlApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGraphqlApi] -> ShowS
$cshowList :: [GetGraphqlApi] -> ShowS
show :: GetGraphqlApi -> String
$cshow :: GetGraphqlApi -> String
showsPrec :: Int -> GetGraphqlApi -> ShowS
$cshowsPrec :: Int -> GetGraphqlApi -> ShowS
Prelude.Show, (forall x. GetGraphqlApi -> Rep GetGraphqlApi x)
-> (forall x. Rep GetGraphqlApi x -> GetGraphqlApi)
-> Generic GetGraphqlApi
forall x. Rep GetGraphqlApi x -> GetGraphqlApi
forall x. GetGraphqlApi -> Rep GetGraphqlApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGraphqlApi x -> GetGraphqlApi
$cfrom :: forall x. GetGraphqlApi -> Rep GetGraphqlApi x
Prelude.Generic)
newGetGraphqlApi ::
Prelude.Text ->
GetGraphqlApi
newGetGraphqlApi :: Text -> GetGraphqlApi
newGetGraphqlApi Text
pApiId_ =
GetGraphqlApi' :: Text -> GetGraphqlApi
GetGraphqlApi' {$sel:apiId:GetGraphqlApi' :: Text
apiId = Text
pApiId_}
getGraphqlApi_apiId :: Lens.Lens' GetGraphqlApi Prelude.Text
getGraphqlApi_apiId :: (Text -> f Text) -> GetGraphqlApi -> f GetGraphqlApi
getGraphqlApi_apiId = (GetGraphqlApi -> Text)
-> (GetGraphqlApi -> Text -> GetGraphqlApi)
-> Lens GetGraphqlApi GetGraphqlApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGraphqlApi' {Text
apiId :: Text
$sel:apiId:GetGraphqlApi' :: GetGraphqlApi -> Text
apiId} -> Text
apiId) (\s :: GetGraphqlApi
s@GetGraphqlApi' {} Text
a -> GetGraphqlApi
s {$sel:apiId:GetGraphqlApi' :: Text
apiId = Text
a} :: GetGraphqlApi)
instance Core.AWSRequest GetGraphqlApi where
type
AWSResponse GetGraphqlApi =
GetGraphqlApiResponse
request :: GetGraphqlApi -> Request GetGraphqlApi
request = Service -> GetGraphqlApi -> Request GetGraphqlApi
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGraphqlApi)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetGraphqlApi))
-> Logger
-> Service
-> Proxy GetGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGraphqlApi)))
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 GraphqlApi -> Int -> GetGraphqlApiResponse
GetGraphqlApiResponse'
(Maybe GraphqlApi -> Int -> GetGraphqlApiResponse)
-> Either String (Maybe GraphqlApi)
-> Either String (Int -> GetGraphqlApiResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GraphqlApi)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"graphqlApi")
Either String (Int -> GetGraphqlApiResponse)
-> Either String Int -> Either String GetGraphqlApiResponse
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 GetGraphqlApi
instance Prelude.NFData GetGraphqlApi
instance Core.ToHeaders GetGraphqlApi where
toHeaders :: GetGraphqlApi -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetGraphqlApi -> 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.ToPath GetGraphqlApi where
toPath :: GetGraphqlApi -> ByteString
toPath GetGraphqlApi' {Text
apiId :: Text
$sel:apiId:GetGraphqlApi' :: GetGraphqlApi -> Text
..} =
[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]
instance Core.ToQuery GetGraphqlApi where
toQuery :: GetGraphqlApi -> QueryString
toQuery = QueryString -> GetGraphqlApi -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetGraphqlApiResponse = GetGraphqlApiResponse'
{
GetGraphqlApiResponse -> Maybe GraphqlApi
graphqlApi :: Prelude.Maybe GraphqlApi,
GetGraphqlApiResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool
(GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool)
-> (GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool)
-> Eq GetGraphqlApiResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool
$c/= :: GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool
== :: GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool
$c== :: GetGraphqlApiResponse -> GetGraphqlApiResponse -> Bool
Prelude.Eq, ReadPrec [GetGraphqlApiResponse]
ReadPrec GetGraphqlApiResponse
Int -> ReadS GetGraphqlApiResponse
ReadS [GetGraphqlApiResponse]
(Int -> ReadS GetGraphqlApiResponse)
-> ReadS [GetGraphqlApiResponse]
-> ReadPrec GetGraphqlApiResponse
-> ReadPrec [GetGraphqlApiResponse]
-> Read GetGraphqlApiResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGraphqlApiResponse]
$creadListPrec :: ReadPrec [GetGraphqlApiResponse]
readPrec :: ReadPrec GetGraphqlApiResponse
$creadPrec :: ReadPrec GetGraphqlApiResponse
readList :: ReadS [GetGraphqlApiResponse]
$creadList :: ReadS [GetGraphqlApiResponse]
readsPrec :: Int -> ReadS GetGraphqlApiResponse
$creadsPrec :: Int -> ReadS GetGraphqlApiResponse
Prelude.Read, Int -> GetGraphqlApiResponse -> ShowS
[GetGraphqlApiResponse] -> ShowS
GetGraphqlApiResponse -> String
(Int -> GetGraphqlApiResponse -> ShowS)
-> (GetGraphqlApiResponse -> String)
-> ([GetGraphqlApiResponse] -> ShowS)
-> Show GetGraphqlApiResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGraphqlApiResponse] -> ShowS
$cshowList :: [GetGraphqlApiResponse] -> ShowS
show :: GetGraphqlApiResponse -> String
$cshow :: GetGraphqlApiResponse -> String
showsPrec :: Int -> GetGraphqlApiResponse -> ShowS
$cshowsPrec :: Int -> GetGraphqlApiResponse -> ShowS
Prelude.Show, (forall x. GetGraphqlApiResponse -> Rep GetGraphqlApiResponse x)
-> (forall x. Rep GetGraphqlApiResponse x -> GetGraphqlApiResponse)
-> Generic GetGraphqlApiResponse
forall x. Rep GetGraphqlApiResponse x -> GetGraphqlApiResponse
forall x. GetGraphqlApiResponse -> Rep GetGraphqlApiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGraphqlApiResponse x -> GetGraphqlApiResponse
$cfrom :: forall x. GetGraphqlApiResponse -> Rep GetGraphqlApiResponse x
Prelude.Generic)
newGetGraphqlApiResponse ::
Prelude.Int ->
GetGraphqlApiResponse
newGetGraphqlApiResponse :: Int -> GetGraphqlApiResponse
newGetGraphqlApiResponse Int
pHttpStatus_ =
GetGraphqlApiResponse' :: Maybe GraphqlApi -> Int -> GetGraphqlApiResponse
GetGraphqlApiResponse'
{ $sel:graphqlApi:GetGraphqlApiResponse' :: Maybe GraphqlApi
graphqlApi =
Maybe GraphqlApi
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetGraphqlApiResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getGraphqlApiResponse_graphqlApi :: Lens.Lens' GetGraphqlApiResponse (Prelude.Maybe GraphqlApi)
getGraphqlApiResponse_graphqlApi :: (Maybe GraphqlApi -> f (Maybe GraphqlApi))
-> GetGraphqlApiResponse -> f GetGraphqlApiResponse
getGraphqlApiResponse_graphqlApi = (GetGraphqlApiResponse -> Maybe GraphqlApi)
-> (GetGraphqlApiResponse
-> Maybe GraphqlApi -> GetGraphqlApiResponse)
-> Lens
GetGraphqlApiResponse
GetGraphqlApiResponse
(Maybe GraphqlApi)
(Maybe GraphqlApi)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGraphqlApiResponse' {Maybe GraphqlApi
graphqlApi :: Maybe GraphqlApi
$sel:graphqlApi:GetGraphqlApiResponse' :: GetGraphqlApiResponse -> Maybe GraphqlApi
graphqlApi} -> Maybe GraphqlApi
graphqlApi) (\s :: GetGraphqlApiResponse
s@GetGraphqlApiResponse' {} Maybe GraphqlApi
a -> GetGraphqlApiResponse
s {$sel:graphqlApi:GetGraphqlApiResponse' :: Maybe GraphqlApi
graphqlApi = Maybe GraphqlApi
a} :: GetGraphqlApiResponse)
getGraphqlApiResponse_httpStatus :: Lens.Lens' GetGraphqlApiResponse Prelude.Int
getGraphqlApiResponse_httpStatus :: (Int -> f Int) -> GetGraphqlApiResponse -> f GetGraphqlApiResponse
getGraphqlApiResponse_httpStatus = (GetGraphqlApiResponse -> Int)
-> (GetGraphqlApiResponse -> Int -> GetGraphqlApiResponse)
-> Lens GetGraphqlApiResponse GetGraphqlApiResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGraphqlApiResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGraphqlApiResponse' :: GetGraphqlApiResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGraphqlApiResponse
s@GetGraphqlApiResponse' {} Int
a -> GetGraphqlApiResponse
s {$sel:httpStatus:GetGraphqlApiResponse' :: Int
httpStatus = Int
a} :: GetGraphqlApiResponse)
instance Prelude.NFData GetGraphqlApiResponse