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