{-# 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.CognitoIdentityProvider.DescribeResourceServer
(
DescribeResourceServer (..),
newDescribeResourceServer,
describeResourceServer_userPoolId,
describeResourceServer_identifier,
DescribeResourceServerResponse (..),
newDescribeResourceServerResponse,
describeResourceServerResponse_httpStatus,
describeResourceServerResponse_resourceServer,
)
where
import Amazonka.CognitoIdentityProvider.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 DescribeResourceServer = DescribeResourceServer'
{
DescribeResourceServer -> Text
userPoolId :: Prelude.Text,
DescribeResourceServer -> Text
identifier :: Prelude.Text
}
deriving (DescribeResourceServer -> DescribeResourceServer -> Bool
(DescribeResourceServer -> DescribeResourceServer -> Bool)
-> (DescribeResourceServer -> DescribeResourceServer -> Bool)
-> Eq DescribeResourceServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourceServer -> DescribeResourceServer -> Bool
$c/= :: DescribeResourceServer -> DescribeResourceServer -> Bool
== :: DescribeResourceServer -> DescribeResourceServer -> Bool
$c== :: DescribeResourceServer -> DescribeResourceServer -> Bool
Prelude.Eq, ReadPrec [DescribeResourceServer]
ReadPrec DescribeResourceServer
Int -> ReadS DescribeResourceServer
ReadS [DescribeResourceServer]
(Int -> ReadS DescribeResourceServer)
-> ReadS [DescribeResourceServer]
-> ReadPrec DescribeResourceServer
-> ReadPrec [DescribeResourceServer]
-> Read DescribeResourceServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourceServer]
$creadListPrec :: ReadPrec [DescribeResourceServer]
readPrec :: ReadPrec DescribeResourceServer
$creadPrec :: ReadPrec DescribeResourceServer
readList :: ReadS [DescribeResourceServer]
$creadList :: ReadS [DescribeResourceServer]
readsPrec :: Int -> ReadS DescribeResourceServer
$creadsPrec :: Int -> ReadS DescribeResourceServer
Prelude.Read, Int -> DescribeResourceServer -> ShowS
[DescribeResourceServer] -> ShowS
DescribeResourceServer -> String
(Int -> DescribeResourceServer -> ShowS)
-> (DescribeResourceServer -> String)
-> ([DescribeResourceServer] -> ShowS)
-> Show DescribeResourceServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourceServer] -> ShowS
$cshowList :: [DescribeResourceServer] -> ShowS
show :: DescribeResourceServer -> String
$cshow :: DescribeResourceServer -> String
showsPrec :: Int -> DescribeResourceServer -> ShowS
$cshowsPrec :: Int -> DescribeResourceServer -> ShowS
Prelude.Show, (forall x. DescribeResourceServer -> Rep DescribeResourceServer x)
-> (forall x.
Rep DescribeResourceServer x -> DescribeResourceServer)
-> Generic DescribeResourceServer
forall x. Rep DescribeResourceServer x -> DescribeResourceServer
forall x. DescribeResourceServer -> Rep DescribeResourceServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeResourceServer x -> DescribeResourceServer
$cfrom :: forall x. DescribeResourceServer -> Rep DescribeResourceServer x
Prelude.Generic)
newDescribeResourceServer ::
Prelude.Text ->
Prelude.Text ->
DescribeResourceServer
newDescribeResourceServer :: Text -> Text -> DescribeResourceServer
newDescribeResourceServer Text
pUserPoolId_ Text
pIdentifier_ =
DescribeResourceServer' :: Text -> Text -> DescribeResourceServer
DescribeResourceServer'
{ $sel:userPoolId:DescribeResourceServer' :: Text
userPoolId = Text
pUserPoolId_,
$sel:identifier:DescribeResourceServer' :: Text
identifier = Text
pIdentifier_
}
describeResourceServer_userPoolId :: Lens.Lens' DescribeResourceServer Prelude.Text
describeResourceServer_userPoolId :: (Text -> f Text)
-> DescribeResourceServer -> f DescribeResourceServer
describeResourceServer_userPoolId = (DescribeResourceServer -> Text)
-> (DescribeResourceServer -> Text -> DescribeResourceServer)
-> Lens DescribeResourceServer DescribeResourceServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceServer' {Text
userPoolId :: Text
$sel:userPoolId:DescribeResourceServer' :: DescribeResourceServer -> Text
userPoolId} -> Text
userPoolId) (\s :: DescribeResourceServer
s@DescribeResourceServer' {} Text
a -> DescribeResourceServer
s {$sel:userPoolId:DescribeResourceServer' :: Text
userPoolId = Text
a} :: DescribeResourceServer)
describeResourceServer_identifier :: Lens.Lens' DescribeResourceServer Prelude.Text
describeResourceServer_identifier :: (Text -> f Text)
-> DescribeResourceServer -> f DescribeResourceServer
describeResourceServer_identifier = (DescribeResourceServer -> Text)
-> (DescribeResourceServer -> Text -> DescribeResourceServer)
-> Lens DescribeResourceServer DescribeResourceServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceServer' {Text
identifier :: Text
$sel:identifier:DescribeResourceServer' :: DescribeResourceServer -> Text
identifier} -> Text
identifier) (\s :: DescribeResourceServer
s@DescribeResourceServer' {} Text
a -> DescribeResourceServer
s {$sel:identifier:DescribeResourceServer' :: Text
identifier = Text
a} :: DescribeResourceServer)
instance Core.AWSRequest DescribeResourceServer where
type
AWSResponse DescribeResourceServer =
DescribeResourceServerResponse
request :: DescribeResourceServer -> Request DescribeResourceServer
request = Service -> DescribeResourceServer -> Request DescribeResourceServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeResourceServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeResourceServer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeResourceServer))
-> Logger
-> Service
-> Proxy DescribeResourceServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeResourceServer)))
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 ->
Int -> ResourceServerType -> DescribeResourceServerResponse
DescribeResourceServerResponse'
(Int -> ResourceServerType -> DescribeResourceServerResponse)
-> Either String Int
-> Either
String (ResourceServerType -> DescribeResourceServerResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String (ResourceServerType -> DescribeResourceServerResponse)
-> Either String ResourceServerType
-> Either String DescribeResourceServerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ResourceServerType
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ResourceServer")
)
instance Prelude.Hashable DescribeResourceServer
instance Prelude.NFData DescribeResourceServer
instance Core.ToHeaders DescribeResourceServer where
toHeaders :: DescribeResourceServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeResourceServer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.DescribeResourceServer" ::
Prelude.ByteString
),
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 DescribeResourceServer where
toJSON :: DescribeResourceServer -> Value
toJSON DescribeResourceServer' {Text
identifier :: Text
userPoolId :: Text
$sel:identifier:DescribeResourceServer' :: DescribeResourceServer -> Text
$sel:userPoolId:DescribeResourceServer' :: DescribeResourceServer -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identifier)
]
)
instance Core.ToPath DescribeResourceServer where
toPath :: DescribeResourceServer -> ByteString
toPath = ByteString -> DescribeResourceServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeResourceServer where
toQuery :: DescribeResourceServer -> QueryString
toQuery = QueryString -> DescribeResourceServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeResourceServerResponse = DescribeResourceServerResponse'
{
DescribeResourceServerResponse -> Int
httpStatus :: Prelude.Int,
DescribeResourceServerResponse -> ResourceServerType
resourceServer :: ResourceServerType
}
deriving (DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool
(DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool)
-> (DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool)
-> Eq DescribeResourceServerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool
$c/= :: DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool
== :: DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool
$c== :: DescribeResourceServerResponse
-> DescribeResourceServerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeResourceServerResponse]
ReadPrec DescribeResourceServerResponse
Int -> ReadS DescribeResourceServerResponse
ReadS [DescribeResourceServerResponse]
(Int -> ReadS DescribeResourceServerResponse)
-> ReadS [DescribeResourceServerResponse]
-> ReadPrec DescribeResourceServerResponse
-> ReadPrec [DescribeResourceServerResponse]
-> Read DescribeResourceServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourceServerResponse]
$creadListPrec :: ReadPrec [DescribeResourceServerResponse]
readPrec :: ReadPrec DescribeResourceServerResponse
$creadPrec :: ReadPrec DescribeResourceServerResponse
readList :: ReadS [DescribeResourceServerResponse]
$creadList :: ReadS [DescribeResourceServerResponse]
readsPrec :: Int -> ReadS DescribeResourceServerResponse
$creadsPrec :: Int -> ReadS DescribeResourceServerResponse
Prelude.Read, Int -> DescribeResourceServerResponse -> ShowS
[DescribeResourceServerResponse] -> ShowS
DescribeResourceServerResponse -> String
(Int -> DescribeResourceServerResponse -> ShowS)
-> (DescribeResourceServerResponse -> String)
-> ([DescribeResourceServerResponse] -> ShowS)
-> Show DescribeResourceServerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourceServerResponse] -> ShowS
$cshowList :: [DescribeResourceServerResponse] -> ShowS
show :: DescribeResourceServerResponse -> String
$cshow :: DescribeResourceServerResponse -> String
showsPrec :: Int -> DescribeResourceServerResponse -> ShowS
$cshowsPrec :: Int -> DescribeResourceServerResponse -> ShowS
Prelude.Show, (forall x.
DescribeResourceServerResponse
-> Rep DescribeResourceServerResponse x)
-> (forall x.
Rep DescribeResourceServerResponse x
-> DescribeResourceServerResponse)
-> Generic DescribeResourceServerResponse
forall x.
Rep DescribeResourceServerResponse x
-> DescribeResourceServerResponse
forall x.
DescribeResourceServerResponse
-> Rep DescribeResourceServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourceServerResponse x
-> DescribeResourceServerResponse
$cfrom :: forall x.
DescribeResourceServerResponse
-> Rep DescribeResourceServerResponse x
Prelude.Generic)
newDescribeResourceServerResponse ::
Prelude.Int ->
ResourceServerType ->
DescribeResourceServerResponse
newDescribeResourceServerResponse :: Int -> ResourceServerType -> DescribeResourceServerResponse
newDescribeResourceServerResponse
Int
pHttpStatus_
ResourceServerType
pResourceServer_ =
DescribeResourceServerResponse' :: Int -> ResourceServerType -> DescribeResourceServerResponse
DescribeResourceServerResponse'
{ $sel:httpStatus:DescribeResourceServerResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resourceServer:DescribeResourceServerResponse' :: ResourceServerType
resourceServer = ResourceServerType
pResourceServer_
}
describeResourceServerResponse_httpStatus :: Lens.Lens' DescribeResourceServerResponse Prelude.Int
describeResourceServerResponse_httpStatus :: (Int -> f Int)
-> DescribeResourceServerResponse
-> f DescribeResourceServerResponse
describeResourceServerResponse_httpStatus = (DescribeResourceServerResponse -> Int)
-> (DescribeResourceServerResponse
-> Int -> DescribeResourceServerResponse)
-> Lens
DescribeResourceServerResponse
DescribeResourceServerResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeResourceServerResponse' :: DescribeResourceServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeResourceServerResponse
s@DescribeResourceServerResponse' {} Int
a -> DescribeResourceServerResponse
s {$sel:httpStatus:DescribeResourceServerResponse' :: Int
httpStatus = Int
a} :: DescribeResourceServerResponse)
describeResourceServerResponse_resourceServer :: Lens.Lens' DescribeResourceServerResponse ResourceServerType
describeResourceServerResponse_resourceServer :: (ResourceServerType -> f ResourceServerType)
-> DescribeResourceServerResponse
-> f DescribeResourceServerResponse
describeResourceServerResponse_resourceServer = (DescribeResourceServerResponse -> ResourceServerType)
-> (DescribeResourceServerResponse
-> ResourceServerType -> DescribeResourceServerResponse)
-> Lens
DescribeResourceServerResponse
DescribeResourceServerResponse
ResourceServerType
ResourceServerType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceServerResponse' {ResourceServerType
resourceServer :: ResourceServerType
$sel:resourceServer:DescribeResourceServerResponse' :: DescribeResourceServerResponse -> ResourceServerType
resourceServer} -> ResourceServerType
resourceServer) (\s :: DescribeResourceServerResponse
s@DescribeResourceServerResponse' {} ResourceServerType
a -> DescribeResourceServerResponse
s {$sel:resourceServer:DescribeResourceServerResponse' :: ResourceServerType
resourceServer = ResourceServerType
a} :: DescribeResourceServerResponse)
instance
Prelude.NFData
DescribeResourceServerResponse