{-# 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.CancelHandshake
(
CancelHandshake (..),
newCancelHandshake,
cancelHandshake_handshakeId,
CancelHandshakeResponse (..),
newCancelHandshakeResponse,
cancelHandshakeResponse_handshake,
cancelHandshakeResponse_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 CancelHandshake = CancelHandshake'
{
CancelHandshake -> Text
handshakeId :: Prelude.Text
}
deriving (CancelHandshake -> CancelHandshake -> Bool
(CancelHandshake -> CancelHandshake -> Bool)
-> (CancelHandshake -> CancelHandshake -> Bool)
-> Eq CancelHandshake
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelHandshake -> CancelHandshake -> Bool
$c/= :: CancelHandshake -> CancelHandshake -> Bool
== :: CancelHandshake -> CancelHandshake -> Bool
$c== :: CancelHandshake -> CancelHandshake -> Bool
Prelude.Eq, ReadPrec [CancelHandshake]
ReadPrec CancelHandshake
Int -> ReadS CancelHandshake
ReadS [CancelHandshake]
(Int -> ReadS CancelHandshake)
-> ReadS [CancelHandshake]
-> ReadPrec CancelHandshake
-> ReadPrec [CancelHandshake]
-> Read CancelHandshake
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelHandshake]
$creadListPrec :: ReadPrec [CancelHandshake]
readPrec :: ReadPrec CancelHandshake
$creadPrec :: ReadPrec CancelHandshake
readList :: ReadS [CancelHandshake]
$creadList :: ReadS [CancelHandshake]
readsPrec :: Int -> ReadS CancelHandshake
$creadsPrec :: Int -> ReadS CancelHandshake
Prelude.Read, Int -> CancelHandshake -> ShowS
[CancelHandshake] -> ShowS
CancelHandshake -> String
(Int -> CancelHandshake -> ShowS)
-> (CancelHandshake -> String)
-> ([CancelHandshake] -> ShowS)
-> Show CancelHandshake
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelHandshake] -> ShowS
$cshowList :: [CancelHandshake] -> ShowS
show :: CancelHandshake -> String
$cshow :: CancelHandshake -> String
showsPrec :: Int -> CancelHandshake -> ShowS
$cshowsPrec :: Int -> CancelHandshake -> ShowS
Prelude.Show, (forall x. CancelHandshake -> Rep CancelHandshake x)
-> (forall x. Rep CancelHandshake x -> CancelHandshake)
-> Generic CancelHandshake
forall x. Rep CancelHandshake x -> CancelHandshake
forall x. CancelHandshake -> Rep CancelHandshake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelHandshake x -> CancelHandshake
$cfrom :: forall x. CancelHandshake -> Rep CancelHandshake x
Prelude.Generic)
newCancelHandshake ::
Prelude.Text ->
CancelHandshake
newCancelHandshake :: Text -> CancelHandshake
newCancelHandshake Text
pHandshakeId_ =
CancelHandshake' :: Text -> CancelHandshake
CancelHandshake' {$sel:handshakeId:CancelHandshake' :: Text
handshakeId = Text
pHandshakeId_}
cancelHandshake_handshakeId :: Lens.Lens' CancelHandshake Prelude.Text
cancelHandshake_handshakeId :: (Text -> f Text) -> CancelHandshake -> f CancelHandshake
cancelHandshake_handshakeId = (CancelHandshake -> Text)
-> (CancelHandshake -> Text -> CancelHandshake)
-> Lens CancelHandshake CancelHandshake Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelHandshake' {Text
handshakeId :: Text
$sel:handshakeId:CancelHandshake' :: CancelHandshake -> Text
handshakeId} -> Text
handshakeId) (\s :: CancelHandshake
s@CancelHandshake' {} Text
a -> CancelHandshake
s {$sel:handshakeId:CancelHandshake' :: Text
handshakeId = Text
a} :: CancelHandshake)
instance Core.AWSRequest CancelHandshake where
type
AWSResponse CancelHandshake =
CancelHandshakeResponse
request :: CancelHandshake -> Request CancelHandshake
request = Service -> CancelHandshake -> Request CancelHandshake
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CancelHandshake
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelHandshake)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CancelHandshake))
-> Logger
-> Service
-> Proxy CancelHandshake
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelHandshake)))
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 -> CancelHandshakeResponse
CancelHandshakeResponse'
(Maybe Handshake -> Int -> CancelHandshakeResponse)
-> Either String (Maybe Handshake)
-> Either String (Int -> CancelHandshakeResponse)
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 -> CancelHandshakeResponse)
-> Either String Int -> Either String CancelHandshakeResponse
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 CancelHandshake
instance Prelude.NFData CancelHandshake
instance Core.ToHeaders CancelHandshake where
toHeaders :: CancelHandshake -> ResponseHeaders
toHeaders =
ResponseHeaders -> CancelHandshake -> 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.CancelHandshake" ::
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 CancelHandshake where
toJSON :: CancelHandshake -> Value
toJSON CancelHandshake' {Text
handshakeId :: Text
$sel:handshakeId:CancelHandshake' :: CancelHandshake -> 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 CancelHandshake where
toPath :: CancelHandshake -> ByteString
toPath = ByteString -> CancelHandshake -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CancelHandshake where
toQuery :: CancelHandshake -> QueryString
toQuery = QueryString -> CancelHandshake -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CancelHandshakeResponse = CancelHandshakeResponse'
{
CancelHandshakeResponse -> Maybe Handshake
handshake :: Prelude.Maybe Handshake,
CancelHandshakeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelHandshakeResponse -> CancelHandshakeResponse -> Bool
(CancelHandshakeResponse -> CancelHandshakeResponse -> Bool)
-> (CancelHandshakeResponse -> CancelHandshakeResponse -> Bool)
-> Eq CancelHandshakeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelHandshakeResponse -> CancelHandshakeResponse -> Bool
$c/= :: CancelHandshakeResponse -> CancelHandshakeResponse -> Bool
== :: CancelHandshakeResponse -> CancelHandshakeResponse -> Bool
$c== :: CancelHandshakeResponse -> CancelHandshakeResponse -> Bool
Prelude.Eq, Int -> CancelHandshakeResponse -> ShowS
[CancelHandshakeResponse] -> ShowS
CancelHandshakeResponse -> String
(Int -> CancelHandshakeResponse -> ShowS)
-> (CancelHandshakeResponse -> String)
-> ([CancelHandshakeResponse] -> ShowS)
-> Show CancelHandshakeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelHandshakeResponse] -> ShowS
$cshowList :: [CancelHandshakeResponse] -> ShowS
show :: CancelHandshakeResponse -> String
$cshow :: CancelHandshakeResponse -> String
showsPrec :: Int -> CancelHandshakeResponse -> ShowS
$cshowsPrec :: Int -> CancelHandshakeResponse -> ShowS
Prelude.Show, (forall x.
CancelHandshakeResponse -> Rep CancelHandshakeResponse x)
-> (forall x.
Rep CancelHandshakeResponse x -> CancelHandshakeResponse)
-> Generic CancelHandshakeResponse
forall x. Rep CancelHandshakeResponse x -> CancelHandshakeResponse
forall x. CancelHandshakeResponse -> Rep CancelHandshakeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelHandshakeResponse x -> CancelHandshakeResponse
$cfrom :: forall x. CancelHandshakeResponse -> Rep CancelHandshakeResponse x
Prelude.Generic)
newCancelHandshakeResponse ::
Prelude.Int ->
CancelHandshakeResponse
newCancelHandshakeResponse :: Int -> CancelHandshakeResponse
newCancelHandshakeResponse Int
pHttpStatus_ =
CancelHandshakeResponse' :: Maybe Handshake -> Int -> CancelHandshakeResponse
CancelHandshakeResponse'
{ $sel:handshake:CancelHandshakeResponse' :: Maybe Handshake
handshake =
Maybe Handshake
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelHandshakeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelHandshakeResponse_handshake :: Lens.Lens' CancelHandshakeResponse (Prelude.Maybe Handshake)
cancelHandshakeResponse_handshake :: (Maybe Handshake -> f (Maybe Handshake))
-> CancelHandshakeResponse -> f CancelHandshakeResponse
cancelHandshakeResponse_handshake = (CancelHandshakeResponse -> Maybe Handshake)
-> (CancelHandshakeResponse
-> Maybe Handshake -> CancelHandshakeResponse)
-> Lens
CancelHandshakeResponse
CancelHandshakeResponse
(Maybe Handshake)
(Maybe Handshake)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelHandshakeResponse' {Maybe Handshake
handshake :: Maybe Handshake
$sel:handshake:CancelHandshakeResponse' :: CancelHandshakeResponse -> Maybe Handshake
handshake} -> Maybe Handshake
handshake) (\s :: CancelHandshakeResponse
s@CancelHandshakeResponse' {} Maybe Handshake
a -> CancelHandshakeResponse
s {$sel:handshake:CancelHandshakeResponse' :: Maybe Handshake
handshake = Maybe Handshake
a} :: CancelHandshakeResponse)
cancelHandshakeResponse_httpStatus :: Lens.Lens' CancelHandshakeResponse Prelude.Int
cancelHandshakeResponse_httpStatus :: (Int -> f Int)
-> CancelHandshakeResponse -> f CancelHandshakeResponse
cancelHandshakeResponse_httpStatus = (CancelHandshakeResponse -> Int)
-> (CancelHandshakeResponse -> Int -> CancelHandshakeResponse)
-> Lens CancelHandshakeResponse CancelHandshakeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelHandshakeResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelHandshakeResponse' :: CancelHandshakeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelHandshakeResponse
s@CancelHandshakeResponse' {} Int
a -> CancelHandshakeResponse
s {$sel:httpStatus:CancelHandshakeResponse' :: Int
httpStatus = Int
a} :: CancelHandshakeResponse)
instance Prelude.NFData CancelHandshakeResponse