{-# 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.AcceptHandshake
(
AcceptHandshake (..),
newAcceptHandshake,
acceptHandshake_handshakeId,
AcceptHandshakeResponse (..),
newAcceptHandshakeResponse,
acceptHandshakeResponse_handshake,
acceptHandshakeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Organizations.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AcceptHandshake = AcceptHandshake'
{
AcceptHandshake -> Text
handshakeId :: Prelude.Text
}
deriving (AcceptHandshake -> AcceptHandshake -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptHandshake -> AcceptHandshake -> Bool
$c/= :: AcceptHandshake -> AcceptHandshake -> Bool
== :: AcceptHandshake -> AcceptHandshake -> Bool
$c== :: AcceptHandshake -> AcceptHandshake -> Bool
Prelude.Eq, ReadPrec [AcceptHandshake]
ReadPrec AcceptHandshake
Int -> ReadS AcceptHandshake
ReadS [AcceptHandshake]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptHandshake]
$creadListPrec :: ReadPrec [AcceptHandshake]
readPrec :: ReadPrec AcceptHandshake
$creadPrec :: ReadPrec AcceptHandshake
readList :: ReadS [AcceptHandshake]
$creadList :: ReadS [AcceptHandshake]
readsPrec :: Int -> ReadS AcceptHandshake
$creadsPrec :: Int -> ReadS AcceptHandshake
Prelude.Read, Int -> AcceptHandshake -> ShowS
[AcceptHandshake] -> ShowS
AcceptHandshake -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptHandshake] -> ShowS
$cshowList :: [AcceptHandshake] -> ShowS
show :: AcceptHandshake -> String
$cshow :: AcceptHandshake -> String
showsPrec :: Int -> AcceptHandshake -> ShowS
$cshowsPrec :: Int -> AcceptHandshake -> ShowS
Prelude.Show, forall x. Rep AcceptHandshake x -> AcceptHandshake
forall x. AcceptHandshake -> Rep AcceptHandshake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptHandshake x -> AcceptHandshake
$cfrom :: forall x. AcceptHandshake -> Rep AcceptHandshake x
Prelude.Generic)
newAcceptHandshake ::
Prelude.Text ->
AcceptHandshake
newAcceptHandshake :: Text -> AcceptHandshake
newAcceptHandshake Text
pHandshakeId_ =
AcceptHandshake' {$sel:handshakeId:AcceptHandshake' :: Text
handshakeId = Text
pHandshakeId_}
acceptHandshake_handshakeId :: Lens.Lens' AcceptHandshake Prelude.Text
acceptHandshake_handshakeId :: Lens' AcceptHandshake Text
acceptHandshake_handshakeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptHandshake' {Text
handshakeId :: Text
$sel:handshakeId:AcceptHandshake' :: AcceptHandshake -> Text
handshakeId} -> Text
handshakeId) (\s :: AcceptHandshake
s@AcceptHandshake' {} Text
a -> AcceptHandshake
s {$sel:handshakeId:AcceptHandshake' :: Text
handshakeId = Text
a} :: AcceptHandshake)
instance Core.AWSRequest AcceptHandshake where
type
AWSResponse AcceptHandshake =
AcceptHandshakeResponse
request :: (Service -> Service) -> AcceptHandshake -> Request AcceptHandshake
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AcceptHandshake
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptHandshake)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Handshake -> Int -> AcceptHandshakeResponse
AcceptHandshakeResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Handshake")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AcceptHandshake where
hashWithSalt :: Int -> AcceptHandshake -> Int
hashWithSalt Int
_salt AcceptHandshake' {Text
handshakeId :: Text
$sel:handshakeId:AcceptHandshake' :: AcceptHandshake -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
handshakeId
instance Prelude.NFData AcceptHandshake where
rnf :: AcceptHandshake -> ()
rnf AcceptHandshake' {Text
handshakeId :: Text
$sel:handshakeId:AcceptHandshake' :: AcceptHandshake -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
handshakeId
instance Data.ToHeaders AcceptHandshake where
toHeaders :: AcceptHandshake -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSOrganizationsV20161128.AcceptHandshake" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AcceptHandshake where
toJSON :: AcceptHandshake -> Value
toJSON AcceptHandshake' {Text
handshakeId :: Text
$sel:handshakeId:AcceptHandshake' :: AcceptHandshake -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"HandshakeId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
handshakeId)]
)
instance Data.ToPath AcceptHandshake where
toPath :: AcceptHandshake -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AcceptHandshake where
toQuery :: AcceptHandshake -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AcceptHandshakeResponse = AcceptHandshakeResponse'
{
AcceptHandshakeResponse -> Maybe Handshake
handshake :: Prelude.Maybe Handshake,
AcceptHandshakeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptHandshakeResponse -> AcceptHandshakeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptHandshakeResponse -> AcceptHandshakeResponse -> Bool
$c/= :: AcceptHandshakeResponse -> AcceptHandshakeResponse -> Bool
== :: AcceptHandshakeResponse -> AcceptHandshakeResponse -> Bool
$c== :: AcceptHandshakeResponse -> AcceptHandshakeResponse -> Bool
Prelude.Eq, Int -> AcceptHandshakeResponse -> ShowS
[AcceptHandshakeResponse] -> ShowS
AcceptHandshakeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptHandshakeResponse] -> ShowS
$cshowList :: [AcceptHandshakeResponse] -> ShowS
show :: AcceptHandshakeResponse -> String
$cshow :: AcceptHandshakeResponse -> String
showsPrec :: Int -> AcceptHandshakeResponse -> ShowS
$cshowsPrec :: Int -> AcceptHandshakeResponse -> ShowS
Prelude.Show, forall x. Rep AcceptHandshakeResponse x -> AcceptHandshakeResponse
forall x. AcceptHandshakeResponse -> Rep AcceptHandshakeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptHandshakeResponse x -> AcceptHandshakeResponse
$cfrom :: forall x. AcceptHandshakeResponse -> Rep AcceptHandshakeResponse x
Prelude.Generic)
newAcceptHandshakeResponse ::
Prelude.Int ->
AcceptHandshakeResponse
newAcceptHandshakeResponse :: Int -> AcceptHandshakeResponse
newAcceptHandshakeResponse Int
pHttpStatus_ =
AcceptHandshakeResponse'
{ $sel:handshake:AcceptHandshakeResponse' :: Maybe Handshake
handshake =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AcceptHandshakeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
acceptHandshakeResponse_handshake :: Lens.Lens' AcceptHandshakeResponse (Prelude.Maybe Handshake)
acceptHandshakeResponse_handshake :: Lens' AcceptHandshakeResponse (Maybe Handshake)
acceptHandshakeResponse_handshake = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptHandshakeResponse' {Maybe Handshake
handshake :: Maybe Handshake
$sel:handshake:AcceptHandshakeResponse' :: AcceptHandshakeResponse -> Maybe Handshake
handshake} -> Maybe Handshake
handshake) (\s :: AcceptHandshakeResponse
s@AcceptHandshakeResponse' {} Maybe Handshake
a -> AcceptHandshakeResponse
s {$sel:handshake:AcceptHandshakeResponse' :: Maybe Handshake
handshake = Maybe Handshake
a} :: AcceptHandshakeResponse)
acceptHandshakeResponse_httpStatus :: Lens.Lens' AcceptHandshakeResponse Prelude.Int
acceptHandshakeResponse_httpStatus :: Lens' AcceptHandshakeResponse Int
acceptHandshakeResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptHandshakeResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptHandshakeResponse' :: AcceptHandshakeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptHandshakeResponse
s@AcceptHandshakeResponse' {} Int
a -> AcceptHandshakeResponse
s {$sel:httpStatus:AcceptHandshakeResponse' :: Int
httpStatus = Int
a} :: AcceptHandshakeResponse)
instance Prelude.NFData AcceptHandshakeResponse where
rnf :: AcceptHandshakeResponse -> ()
rnf AcceptHandshakeResponse' {Int
Maybe Handshake
httpStatus :: Int
handshake :: Maybe Handshake
$sel:httpStatus:AcceptHandshakeResponse' :: AcceptHandshakeResponse -> Int
$sel:handshake:AcceptHandshakeResponse' :: AcceptHandshakeResponse -> Maybe Handshake
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Handshake
handshake
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus