{-# 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.Connect.GetFederationToken
(
GetFederationToken (..),
newGetFederationToken,
getFederationToken_instanceId,
GetFederationTokenResponse (..),
newGetFederationTokenResponse,
getFederationTokenResponse_credentials,
getFederationTokenResponse_httpStatus,
)
where
import Amazonka.Connect.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 GetFederationToken = GetFederationToken'
{
GetFederationToken -> Text
instanceId :: Prelude.Text
}
deriving (GetFederationToken -> GetFederationToken -> Bool
(GetFederationToken -> GetFederationToken -> Bool)
-> (GetFederationToken -> GetFederationToken -> Bool)
-> Eq GetFederationToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFederationToken -> GetFederationToken -> Bool
$c/= :: GetFederationToken -> GetFederationToken -> Bool
== :: GetFederationToken -> GetFederationToken -> Bool
$c== :: GetFederationToken -> GetFederationToken -> Bool
Prelude.Eq, ReadPrec [GetFederationToken]
ReadPrec GetFederationToken
Int -> ReadS GetFederationToken
ReadS [GetFederationToken]
(Int -> ReadS GetFederationToken)
-> ReadS [GetFederationToken]
-> ReadPrec GetFederationToken
-> ReadPrec [GetFederationToken]
-> Read GetFederationToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFederationToken]
$creadListPrec :: ReadPrec [GetFederationToken]
readPrec :: ReadPrec GetFederationToken
$creadPrec :: ReadPrec GetFederationToken
readList :: ReadS [GetFederationToken]
$creadList :: ReadS [GetFederationToken]
readsPrec :: Int -> ReadS GetFederationToken
$creadsPrec :: Int -> ReadS GetFederationToken
Prelude.Read, Int -> GetFederationToken -> ShowS
[GetFederationToken] -> ShowS
GetFederationToken -> String
(Int -> GetFederationToken -> ShowS)
-> (GetFederationToken -> String)
-> ([GetFederationToken] -> ShowS)
-> Show GetFederationToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFederationToken] -> ShowS
$cshowList :: [GetFederationToken] -> ShowS
show :: GetFederationToken -> String
$cshow :: GetFederationToken -> String
showsPrec :: Int -> GetFederationToken -> ShowS
$cshowsPrec :: Int -> GetFederationToken -> ShowS
Prelude.Show, (forall x. GetFederationToken -> Rep GetFederationToken x)
-> (forall x. Rep GetFederationToken x -> GetFederationToken)
-> Generic GetFederationToken
forall x. Rep GetFederationToken x -> GetFederationToken
forall x. GetFederationToken -> Rep GetFederationToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFederationToken x -> GetFederationToken
$cfrom :: forall x. GetFederationToken -> Rep GetFederationToken x
Prelude.Generic)
newGetFederationToken ::
Prelude.Text ->
GetFederationToken
newGetFederationToken :: Text -> GetFederationToken
newGetFederationToken Text
pInstanceId_ =
GetFederationToken' :: Text -> GetFederationToken
GetFederationToken' {$sel:instanceId:GetFederationToken' :: Text
instanceId = Text
pInstanceId_}
getFederationToken_instanceId :: Lens.Lens' GetFederationToken Prelude.Text
getFederationToken_instanceId :: (Text -> f Text) -> GetFederationToken -> f GetFederationToken
getFederationToken_instanceId = (GetFederationToken -> Text)
-> (GetFederationToken -> Text -> GetFederationToken)
-> Lens GetFederationToken GetFederationToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFederationToken' {Text
instanceId :: Text
$sel:instanceId:GetFederationToken' :: GetFederationToken -> Text
instanceId} -> Text
instanceId) (\s :: GetFederationToken
s@GetFederationToken' {} Text
a -> GetFederationToken
s {$sel:instanceId:GetFederationToken' :: Text
instanceId = Text
a} :: GetFederationToken)
instance Core.AWSRequest GetFederationToken where
type
AWSResponse GetFederationToken =
GetFederationTokenResponse
request :: GetFederationToken -> Request GetFederationToken
request = Service -> GetFederationToken -> Request GetFederationToken
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetFederationToken
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetFederationToken)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetFederationToken))
-> Logger
-> Service
-> Proxy GetFederationToken
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetFederationToken)))
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 Credentials -> Int -> GetFederationTokenResponse
GetFederationTokenResponse'
(Maybe Credentials -> Int -> GetFederationTokenResponse)
-> Either String (Maybe Credentials)
-> Either String (Int -> GetFederationTokenResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Credentials)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Credentials")
Either String (Int -> GetFederationTokenResponse)
-> Either String Int -> Either String GetFederationTokenResponse
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 GetFederationToken
instance Prelude.NFData GetFederationToken
instance Core.ToHeaders GetFederationToken where
toHeaders :: GetFederationToken -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetFederationToken -> 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 GetFederationToken where
toPath :: GetFederationToken -> ByteString
toPath GetFederationToken' {Text
instanceId :: Text
$sel:instanceId:GetFederationToken' :: GetFederationToken -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/user/federate/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId]
instance Core.ToQuery GetFederationToken where
toQuery :: GetFederationToken -> QueryString
toQuery = QueryString -> GetFederationToken -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetFederationTokenResponse = GetFederationTokenResponse'
{
GetFederationTokenResponse -> Maybe Credentials
credentials :: Prelude.Maybe Credentials,
GetFederationTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetFederationTokenResponse -> GetFederationTokenResponse -> Bool
(GetFederationTokenResponse -> GetFederationTokenResponse -> Bool)
-> (GetFederationTokenResponse
-> GetFederationTokenResponse -> Bool)
-> Eq GetFederationTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFederationTokenResponse -> GetFederationTokenResponse -> Bool
$c/= :: GetFederationTokenResponse -> GetFederationTokenResponse -> Bool
== :: GetFederationTokenResponse -> GetFederationTokenResponse -> Bool
$c== :: GetFederationTokenResponse -> GetFederationTokenResponse -> Bool
Prelude.Eq, Int -> GetFederationTokenResponse -> ShowS
[GetFederationTokenResponse] -> ShowS
GetFederationTokenResponse -> String
(Int -> GetFederationTokenResponse -> ShowS)
-> (GetFederationTokenResponse -> String)
-> ([GetFederationTokenResponse] -> ShowS)
-> Show GetFederationTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFederationTokenResponse] -> ShowS
$cshowList :: [GetFederationTokenResponse] -> ShowS
show :: GetFederationTokenResponse -> String
$cshow :: GetFederationTokenResponse -> String
showsPrec :: Int -> GetFederationTokenResponse -> ShowS
$cshowsPrec :: Int -> GetFederationTokenResponse -> ShowS
Prelude.Show, (forall x.
GetFederationTokenResponse -> Rep GetFederationTokenResponse x)
-> (forall x.
Rep GetFederationTokenResponse x -> GetFederationTokenResponse)
-> Generic GetFederationTokenResponse
forall x.
Rep GetFederationTokenResponse x -> GetFederationTokenResponse
forall x.
GetFederationTokenResponse -> Rep GetFederationTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFederationTokenResponse x -> GetFederationTokenResponse
$cfrom :: forall x.
GetFederationTokenResponse -> Rep GetFederationTokenResponse x
Prelude.Generic)
newGetFederationTokenResponse ::
Prelude.Int ->
GetFederationTokenResponse
newGetFederationTokenResponse :: Int -> GetFederationTokenResponse
newGetFederationTokenResponse Int
pHttpStatus_ =
GetFederationTokenResponse' :: Maybe Credentials -> Int -> GetFederationTokenResponse
GetFederationTokenResponse'
{ $sel:credentials:GetFederationTokenResponse' :: Maybe Credentials
credentials =
Maybe Credentials
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetFederationTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getFederationTokenResponse_credentials :: Lens.Lens' GetFederationTokenResponse (Prelude.Maybe Credentials)
getFederationTokenResponse_credentials :: (Maybe Credentials -> f (Maybe Credentials))
-> GetFederationTokenResponse -> f GetFederationTokenResponse
getFederationTokenResponse_credentials = (GetFederationTokenResponse -> Maybe Credentials)
-> (GetFederationTokenResponse
-> Maybe Credentials -> GetFederationTokenResponse)
-> Lens
GetFederationTokenResponse
GetFederationTokenResponse
(Maybe Credentials)
(Maybe Credentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFederationTokenResponse' {Maybe Credentials
credentials :: Maybe Credentials
$sel:credentials:GetFederationTokenResponse' :: GetFederationTokenResponse -> Maybe Credentials
credentials} -> Maybe Credentials
credentials) (\s :: GetFederationTokenResponse
s@GetFederationTokenResponse' {} Maybe Credentials
a -> GetFederationTokenResponse
s {$sel:credentials:GetFederationTokenResponse' :: Maybe Credentials
credentials = Maybe Credentials
a} :: GetFederationTokenResponse)
getFederationTokenResponse_httpStatus :: Lens.Lens' GetFederationTokenResponse Prelude.Int
getFederationTokenResponse_httpStatus :: (Int -> f Int)
-> GetFederationTokenResponse -> f GetFederationTokenResponse
getFederationTokenResponse_httpStatus = (GetFederationTokenResponse -> Int)
-> (GetFederationTokenResponse
-> Int -> GetFederationTokenResponse)
-> Lens
GetFederationTokenResponse GetFederationTokenResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFederationTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFederationTokenResponse' :: GetFederationTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFederationTokenResponse
s@GetFederationTokenResponse' {} Int
a -> GetFederationTokenResponse
s {$sel:httpStatus:GetFederationTokenResponse' :: Int
httpStatus = Int
a} :: GetFederationTokenResponse)
instance Prelude.NFData GetFederationTokenResponse