{-# 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.Organizations.DescribeHandshake
(
DescribeHandshake (..),
newDescribeHandshake,
describeHandshake_handshakeId,
DescribeHandshakeResponse (..),
newDescribeHandshakeResponse,
describeHandshakeResponse_handshake,
describeHandshakeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeHandshake = DescribeHandshake'
{
DescribeHandshake -> Text
handshakeId :: Prelude.Text
}
deriving (DescribeHandshake -> DescribeHandshake -> Bool
(DescribeHandshake -> DescribeHandshake -> Bool)
-> (DescribeHandshake -> DescribeHandshake -> Bool)
-> Eq DescribeHandshake
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHandshake -> DescribeHandshake -> Bool
$c/= :: DescribeHandshake -> DescribeHandshake -> Bool
== :: DescribeHandshake -> DescribeHandshake -> Bool
$c== :: DescribeHandshake -> DescribeHandshake -> Bool
Prelude.Eq, ReadPrec [DescribeHandshake]
ReadPrec DescribeHandshake
Int -> ReadS DescribeHandshake
ReadS [DescribeHandshake]
(Int -> ReadS DescribeHandshake)
-> ReadS [DescribeHandshake]
-> ReadPrec DescribeHandshake
-> ReadPrec [DescribeHandshake]
-> Read DescribeHandshake
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHandshake]
$creadListPrec :: ReadPrec [DescribeHandshake]
readPrec :: ReadPrec DescribeHandshake
$creadPrec :: ReadPrec DescribeHandshake
readList :: ReadS [DescribeHandshake]
$creadList :: ReadS [DescribeHandshake]
readsPrec :: Int -> ReadS DescribeHandshake
$creadsPrec :: Int -> ReadS DescribeHandshake
Prelude.Read, Int -> DescribeHandshake -> ShowS
[DescribeHandshake] -> ShowS
DescribeHandshake -> String
(Int -> DescribeHandshake -> ShowS)
-> (DescribeHandshake -> String)
-> ([DescribeHandshake] -> ShowS)
-> Show DescribeHandshake
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHandshake] -> ShowS
$cshowList :: [DescribeHandshake] -> ShowS
show :: DescribeHandshake -> String
$cshow :: DescribeHandshake -> String
showsPrec :: Int -> DescribeHandshake -> ShowS
$cshowsPrec :: Int -> DescribeHandshake -> ShowS
Prelude.Show, (forall x. DescribeHandshake -> Rep DescribeHandshake x)
-> (forall x. Rep DescribeHandshake x -> DescribeHandshake)
-> Generic DescribeHandshake
forall x. Rep DescribeHandshake x -> DescribeHandshake
forall x. DescribeHandshake -> Rep DescribeHandshake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeHandshake x -> DescribeHandshake
$cfrom :: forall x. DescribeHandshake -> Rep DescribeHandshake x
Prelude.Generic)
newDescribeHandshake ::
Prelude.Text ->
DescribeHandshake
newDescribeHandshake :: Text -> DescribeHandshake
newDescribeHandshake Text
pHandshakeId_ =
DescribeHandshake' :: Text -> DescribeHandshake
DescribeHandshake' {$sel:handshakeId:DescribeHandshake' :: Text
handshakeId = Text
pHandshakeId_}
describeHandshake_handshakeId :: Lens.Lens' DescribeHandshake Prelude.Text
describeHandshake_handshakeId :: (Text -> f Text) -> DescribeHandshake -> f DescribeHandshake
describeHandshake_handshakeId = (DescribeHandshake -> Text)
-> (DescribeHandshake -> Text -> DescribeHandshake)
-> Lens DescribeHandshake DescribeHandshake Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHandshake' {Text
handshakeId :: Text
$sel:handshakeId:DescribeHandshake' :: DescribeHandshake -> Text
handshakeId} -> Text
handshakeId) (\s :: DescribeHandshake
s@DescribeHandshake' {} Text
a -> DescribeHandshake
s {$sel:handshakeId:DescribeHandshake' :: Text
handshakeId = Text
a} :: DescribeHandshake)
instance Core.AWSRequest DescribeHandshake where
type
AWSResponse DescribeHandshake =
DescribeHandshakeResponse
request :: DescribeHandshake -> Request DescribeHandshake
request = Service -> DescribeHandshake -> Request DescribeHandshake
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeHandshake
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeHandshake)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeHandshake))
-> Logger
-> Service
-> Proxy DescribeHandshake
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeHandshake)))
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 Handshake -> Int -> DescribeHandshakeResponse
DescribeHandshakeResponse'
(Maybe Handshake -> Int -> DescribeHandshakeResponse)
-> Either String (Maybe Handshake)
-> Either String (Int -> DescribeHandshakeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Handshake)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Handshake")
Either String (Int -> DescribeHandshakeResponse)
-> Either String Int -> Either String DescribeHandshakeResponse
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 DescribeHandshake
instance Prelude.NFData DescribeHandshake
instance Core.ToHeaders DescribeHandshake where
toHeaders :: DescribeHandshake -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeHandshake -> 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
"AWSOrganizationsV20161128.DescribeHandshake" ::
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 DescribeHandshake where
toJSON :: DescribeHandshake -> Value
toJSON DescribeHandshake' {Text
handshakeId :: Text
$sel:handshakeId:DescribeHandshake' :: DescribeHandshake -> 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
"HandshakeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
handshakeId)]
)
instance Core.ToPath DescribeHandshake where
toPath :: DescribeHandshake -> ByteString
toPath = ByteString -> DescribeHandshake -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeHandshake where
toQuery :: DescribeHandshake -> QueryString
toQuery = QueryString -> DescribeHandshake -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeHandshakeResponse = DescribeHandshakeResponse'
{
DescribeHandshakeResponse -> Maybe Handshake
handshake :: Prelude.Maybe Handshake,
DescribeHandshakeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool
(DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool)
-> (DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool)
-> Eq DescribeHandshakeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool
$c/= :: DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool
== :: DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool
$c== :: DescribeHandshakeResponse -> DescribeHandshakeResponse -> Bool
Prelude.Eq, Int -> DescribeHandshakeResponse -> ShowS
[DescribeHandshakeResponse] -> ShowS
DescribeHandshakeResponse -> String
(Int -> DescribeHandshakeResponse -> ShowS)
-> (DescribeHandshakeResponse -> String)
-> ([DescribeHandshakeResponse] -> ShowS)
-> Show DescribeHandshakeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHandshakeResponse] -> ShowS
$cshowList :: [DescribeHandshakeResponse] -> ShowS
show :: DescribeHandshakeResponse -> String
$cshow :: DescribeHandshakeResponse -> String
showsPrec :: Int -> DescribeHandshakeResponse -> ShowS
$cshowsPrec :: Int -> DescribeHandshakeResponse -> ShowS
Prelude.Show, (forall x.
DescribeHandshakeResponse -> Rep DescribeHandshakeResponse x)
-> (forall x.
Rep DescribeHandshakeResponse x -> DescribeHandshakeResponse)
-> Generic DescribeHandshakeResponse
forall x.
Rep DescribeHandshakeResponse x -> DescribeHandshakeResponse
forall x.
DescribeHandshakeResponse -> Rep DescribeHandshakeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeHandshakeResponse x -> DescribeHandshakeResponse
$cfrom :: forall x.
DescribeHandshakeResponse -> Rep DescribeHandshakeResponse x
Prelude.Generic)
newDescribeHandshakeResponse ::
Prelude.Int ->
DescribeHandshakeResponse
newDescribeHandshakeResponse :: Int -> DescribeHandshakeResponse
newDescribeHandshakeResponse Int
pHttpStatus_ =
DescribeHandshakeResponse' :: Maybe Handshake -> Int -> DescribeHandshakeResponse
DescribeHandshakeResponse'
{ $sel:handshake:DescribeHandshakeResponse' :: Maybe Handshake
handshake =
Maybe Handshake
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeHandshakeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeHandshakeResponse_handshake :: Lens.Lens' DescribeHandshakeResponse (Prelude.Maybe Handshake)
describeHandshakeResponse_handshake :: (Maybe Handshake -> f (Maybe Handshake))
-> DescribeHandshakeResponse -> f DescribeHandshakeResponse
describeHandshakeResponse_handshake = (DescribeHandshakeResponse -> Maybe Handshake)
-> (DescribeHandshakeResponse
-> Maybe Handshake -> DescribeHandshakeResponse)
-> Lens
DescribeHandshakeResponse
DescribeHandshakeResponse
(Maybe Handshake)
(Maybe Handshake)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHandshakeResponse' {Maybe Handshake
handshake :: Maybe Handshake
$sel:handshake:DescribeHandshakeResponse' :: DescribeHandshakeResponse -> Maybe Handshake
handshake} -> Maybe Handshake
handshake) (\s :: DescribeHandshakeResponse
s@DescribeHandshakeResponse' {} Maybe Handshake
a -> DescribeHandshakeResponse
s {$sel:handshake:DescribeHandshakeResponse' :: Maybe Handshake
handshake = Maybe Handshake
a} :: DescribeHandshakeResponse)
describeHandshakeResponse_httpStatus :: Lens.Lens' DescribeHandshakeResponse Prelude.Int
describeHandshakeResponse_httpStatus :: (Int -> f Int)
-> DescribeHandshakeResponse -> f DescribeHandshakeResponse
describeHandshakeResponse_httpStatus = (DescribeHandshakeResponse -> Int)
-> (DescribeHandshakeResponse -> Int -> DescribeHandshakeResponse)
-> Lens DescribeHandshakeResponse DescribeHandshakeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHandshakeResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeHandshakeResponse' :: DescribeHandshakeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeHandshakeResponse
s@DescribeHandshakeResponse' {} Int
a -> DescribeHandshakeResponse
s {$sel:httpStatus:DescribeHandshakeResponse' :: Int
httpStatus = Int
a} :: DescribeHandshakeResponse)
instance Prelude.NFData DescribeHandshakeResponse