{-# 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.InviteAccountToOrganization
(
InviteAccountToOrganization (..),
newInviteAccountToOrganization,
inviteAccountToOrganization_notes,
inviteAccountToOrganization_tags,
inviteAccountToOrganization_target,
InviteAccountToOrganizationResponse (..),
newInviteAccountToOrganizationResponse,
inviteAccountToOrganizationResponse_handshake,
inviteAccountToOrganizationResponse_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 InviteAccountToOrganization = InviteAccountToOrganization'
{
InviteAccountToOrganization -> Maybe (Sensitive Text)
notes :: Prelude.Maybe (Core.Sensitive Prelude.Text),
InviteAccountToOrganization -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
InviteAccountToOrganization -> HandshakeParty
target :: HandshakeParty
}
deriving (InviteAccountToOrganization -> InviteAccountToOrganization -> Bool
(InviteAccountToOrganization
-> InviteAccountToOrganization -> Bool)
-> (InviteAccountToOrganization
-> InviteAccountToOrganization -> Bool)
-> Eq InviteAccountToOrganization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteAccountToOrganization -> InviteAccountToOrganization -> Bool
$c/= :: InviteAccountToOrganization -> InviteAccountToOrganization -> Bool
== :: InviteAccountToOrganization -> InviteAccountToOrganization -> Bool
$c== :: InviteAccountToOrganization -> InviteAccountToOrganization -> Bool
Prelude.Eq, Int -> InviteAccountToOrganization -> ShowS
[InviteAccountToOrganization] -> ShowS
InviteAccountToOrganization -> String
(Int -> InviteAccountToOrganization -> ShowS)
-> (InviteAccountToOrganization -> String)
-> ([InviteAccountToOrganization] -> ShowS)
-> Show InviteAccountToOrganization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteAccountToOrganization] -> ShowS
$cshowList :: [InviteAccountToOrganization] -> ShowS
show :: InviteAccountToOrganization -> String
$cshow :: InviteAccountToOrganization -> String
showsPrec :: Int -> InviteAccountToOrganization -> ShowS
$cshowsPrec :: Int -> InviteAccountToOrganization -> ShowS
Prelude.Show, (forall x.
InviteAccountToOrganization -> Rep InviteAccountToOrganization x)
-> (forall x.
Rep InviteAccountToOrganization x -> InviteAccountToOrganization)
-> Generic InviteAccountToOrganization
forall x.
Rep InviteAccountToOrganization x -> InviteAccountToOrganization
forall x.
InviteAccountToOrganization -> Rep InviteAccountToOrganization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InviteAccountToOrganization x -> InviteAccountToOrganization
$cfrom :: forall x.
InviteAccountToOrganization -> Rep InviteAccountToOrganization x
Prelude.Generic)
newInviteAccountToOrganization ::
HandshakeParty ->
InviteAccountToOrganization
newInviteAccountToOrganization :: HandshakeParty -> InviteAccountToOrganization
newInviteAccountToOrganization HandshakeParty
pTarget_ =
InviteAccountToOrganization' :: Maybe (Sensitive Text)
-> Maybe [Tag] -> HandshakeParty -> InviteAccountToOrganization
InviteAccountToOrganization'
{ $sel:notes:InviteAccountToOrganization' :: Maybe (Sensitive Text)
notes =
Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:tags:InviteAccountToOrganization' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:target:InviteAccountToOrganization' :: HandshakeParty
target = HandshakeParty
pTarget_
}
inviteAccountToOrganization_notes :: Lens.Lens' InviteAccountToOrganization (Prelude.Maybe Prelude.Text)
inviteAccountToOrganization_notes :: (Maybe Text -> f (Maybe Text))
-> InviteAccountToOrganization -> f InviteAccountToOrganization
inviteAccountToOrganization_notes = (InviteAccountToOrganization -> Maybe (Sensitive Text))
-> (InviteAccountToOrganization
-> Maybe (Sensitive Text) -> InviteAccountToOrganization)
-> Lens
InviteAccountToOrganization
InviteAccountToOrganization
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteAccountToOrganization' {Maybe (Sensitive Text)
notes :: Maybe (Sensitive Text)
$sel:notes:InviteAccountToOrganization' :: InviteAccountToOrganization -> Maybe (Sensitive Text)
notes} -> Maybe (Sensitive Text)
notes) (\s :: InviteAccountToOrganization
s@InviteAccountToOrganization' {} Maybe (Sensitive Text)
a -> InviteAccountToOrganization
s {$sel:notes:InviteAccountToOrganization' :: Maybe (Sensitive Text)
notes = Maybe (Sensitive Text)
a} :: InviteAccountToOrganization) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> InviteAccountToOrganization -> f InviteAccountToOrganization)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> InviteAccountToOrganization
-> f InviteAccountToOrganization
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
inviteAccountToOrganization_tags :: Lens.Lens' InviteAccountToOrganization (Prelude.Maybe [Tag])
inviteAccountToOrganization_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> InviteAccountToOrganization -> f InviteAccountToOrganization
inviteAccountToOrganization_tags = (InviteAccountToOrganization -> Maybe [Tag])
-> (InviteAccountToOrganization
-> Maybe [Tag] -> InviteAccountToOrganization)
-> Lens
InviteAccountToOrganization
InviteAccountToOrganization
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteAccountToOrganization' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:InviteAccountToOrganization' :: InviteAccountToOrganization -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: InviteAccountToOrganization
s@InviteAccountToOrganization' {} Maybe [Tag]
a -> InviteAccountToOrganization
s {$sel:tags:InviteAccountToOrganization' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: InviteAccountToOrganization) ((Maybe [Tag] -> f (Maybe [Tag]))
-> InviteAccountToOrganization -> f InviteAccountToOrganization)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> InviteAccountToOrganization
-> f InviteAccountToOrganization
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
inviteAccountToOrganization_target :: Lens.Lens' InviteAccountToOrganization HandshakeParty
inviteAccountToOrganization_target :: (HandshakeParty -> f HandshakeParty)
-> InviteAccountToOrganization -> f InviteAccountToOrganization
inviteAccountToOrganization_target = (InviteAccountToOrganization -> HandshakeParty)
-> (InviteAccountToOrganization
-> HandshakeParty -> InviteAccountToOrganization)
-> Lens
InviteAccountToOrganization
InviteAccountToOrganization
HandshakeParty
HandshakeParty
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteAccountToOrganization' {HandshakeParty
target :: HandshakeParty
$sel:target:InviteAccountToOrganization' :: InviteAccountToOrganization -> HandshakeParty
target} -> HandshakeParty
target) (\s :: InviteAccountToOrganization
s@InviteAccountToOrganization' {} HandshakeParty
a -> InviteAccountToOrganization
s {$sel:target:InviteAccountToOrganization' :: HandshakeParty
target = HandshakeParty
a} :: InviteAccountToOrganization)
instance Core.AWSRequest InviteAccountToOrganization where
type
AWSResponse InviteAccountToOrganization =
InviteAccountToOrganizationResponse
request :: InviteAccountToOrganization -> Request InviteAccountToOrganization
request = Service
-> InviteAccountToOrganization
-> Request InviteAccountToOrganization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy InviteAccountToOrganization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse InviteAccountToOrganization)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse InviteAccountToOrganization))
-> Logger
-> Service
-> Proxy InviteAccountToOrganization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse InviteAccountToOrganization)))
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 -> InviteAccountToOrganizationResponse
InviteAccountToOrganizationResponse'
(Maybe Handshake -> Int -> InviteAccountToOrganizationResponse)
-> Either String (Maybe Handshake)
-> Either String (Int -> InviteAccountToOrganizationResponse)
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 -> InviteAccountToOrganizationResponse)
-> Either String Int
-> Either String InviteAccountToOrganizationResponse
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 InviteAccountToOrganization
instance Prelude.NFData InviteAccountToOrganization
instance Core.ToHeaders InviteAccountToOrganization where
toHeaders :: InviteAccountToOrganization -> ResponseHeaders
toHeaders =
ResponseHeaders -> InviteAccountToOrganization -> 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.InviteAccountToOrganization" ::
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 InviteAccountToOrganization where
toJSON :: InviteAccountToOrganization -> Value
toJSON InviteAccountToOrganization' {Maybe [Tag]
Maybe (Sensitive Text)
HandshakeParty
target :: HandshakeParty
tags :: Maybe [Tag]
notes :: Maybe (Sensitive Text)
$sel:target:InviteAccountToOrganization' :: InviteAccountToOrganization -> HandshakeParty
$sel:tags:InviteAccountToOrganization' :: InviteAccountToOrganization -> Maybe [Tag]
$sel:notes:InviteAccountToOrganization' :: InviteAccountToOrganization -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Notes" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
notes,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Target" Text -> HandshakeParty -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HandshakeParty
target)
]
)
instance Core.ToPath InviteAccountToOrganization where
toPath :: InviteAccountToOrganization -> ByteString
toPath = ByteString -> InviteAccountToOrganization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery InviteAccountToOrganization where
toQuery :: InviteAccountToOrganization -> QueryString
toQuery = QueryString -> InviteAccountToOrganization -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data InviteAccountToOrganizationResponse = InviteAccountToOrganizationResponse'
{
InviteAccountToOrganizationResponse -> Maybe Handshake
handshake :: Prelude.Maybe Handshake,
InviteAccountToOrganizationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool
(InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool)
-> (InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool)
-> Eq InviteAccountToOrganizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool
$c/= :: InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool
== :: InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool
$c== :: InviteAccountToOrganizationResponse
-> InviteAccountToOrganizationResponse -> Bool
Prelude.Eq, Int -> InviteAccountToOrganizationResponse -> ShowS
[InviteAccountToOrganizationResponse] -> ShowS
InviteAccountToOrganizationResponse -> String
(Int -> InviteAccountToOrganizationResponse -> ShowS)
-> (InviteAccountToOrganizationResponse -> String)
-> ([InviteAccountToOrganizationResponse] -> ShowS)
-> Show InviteAccountToOrganizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteAccountToOrganizationResponse] -> ShowS
$cshowList :: [InviteAccountToOrganizationResponse] -> ShowS
show :: InviteAccountToOrganizationResponse -> String
$cshow :: InviteAccountToOrganizationResponse -> String
showsPrec :: Int -> InviteAccountToOrganizationResponse -> ShowS
$cshowsPrec :: Int -> InviteAccountToOrganizationResponse -> ShowS
Prelude.Show, (forall x.
InviteAccountToOrganizationResponse
-> Rep InviteAccountToOrganizationResponse x)
-> (forall x.
Rep InviteAccountToOrganizationResponse x
-> InviteAccountToOrganizationResponse)
-> Generic InviteAccountToOrganizationResponse
forall x.
Rep InviteAccountToOrganizationResponse x
-> InviteAccountToOrganizationResponse
forall x.
InviteAccountToOrganizationResponse
-> Rep InviteAccountToOrganizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InviteAccountToOrganizationResponse x
-> InviteAccountToOrganizationResponse
$cfrom :: forall x.
InviteAccountToOrganizationResponse
-> Rep InviteAccountToOrganizationResponse x
Prelude.Generic)
newInviteAccountToOrganizationResponse ::
Prelude.Int ->
InviteAccountToOrganizationResponse
newInviteAccountToOrganizationResponse :: Int -> InviteAccountToOrganizationResponse
newInviteAccountToOrganizationResponse Int
pHttpStatus_ =
InviteAccountToOrganizationResponse' :: Maybe Handshake -> Int -> InviteAccountToOrganizationResponse
InviteAccountToOrganizationResponse'
{ $sel:handshake:InviteAccountToOrganizationResponse' :: Maybe Handshake
handshake =
Maybe Handshake
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:InviteAccountToOrganizationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
inviteAccountToOrganizationResponse_handshake :: Lens.Lens' InviteAccountToOrganizationResponse (Prelude.Maybe Handshake)
inviteAccountToOrganizationResponse_handshake :: (Maybe Handshake -> f (Maybe Handshake))
-> InviteAccountToOrganizationResponse
-> f InviteAccountToOrganizationResponse
inviteAccountToOrganizationResponse_handshake = (InviteAccountToOrganizationResponse -> Maybe Handshake)
-> (InviteAccountToOrganizationResponse
-> Maybe Handshake -> InviteAccountToOrganizationResponse)
-> Lens
InviteAccountToOrganizationResponse
InviteAccountToOrganizationResponse
(Maybe Handshake)
(Maybe Handshake)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteAccountToOrganizationResponse' {Maybe Handshake
handshake :: Maybe Handshake
$sel:handshake:InviteAccountToOrganizationResponse' :: InviteAccountToOrganizationResponse -> Maybe Handshake
handshake} -> Maybe Handshake
handshake) (\s :: InviteAccountToOrganizationResponse
s@InviteAccountToOrganizationResponse' {} Maybe Handshake
a -> InviteAccountToOrganizationResponse
s {$sel:handshake:InviteAccountToOrganizationResponse' :: Maybe Handshake
handshake = Maybe Handshake
a} :: InviteAccountToOrganizationResponse)
inviteAccountToOrganizationResponse_httpStatus :: Lens.Lens' InviteAccountToOrganizationResponse Prelude.Int
inviteAccountToOrganizationResponse_httpStatus :: (Int -> f Int)
-> InviteAccountToOrganizationResponse
-> f InviteAccountToOrganizationResponse
inviteAccountToOrganizationResponse_httpStatus = (InviteAccountToOrganizationResponse -> Int)
-> (InviteAccountToOrganizationResponse
-> Int -> InviteAccountToOrganizationResponse)
-> Lens
InviteAccountToOrganizationResponse
InviteAccountToOrganizationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteAccountToOrganizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:InviteAccountToOrganizationResponse' :: InviteAccountToOrganizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: InviteAccountToOrganizationResponse
s@InviteAccountToOrganizationResponse' {} Int
a -> InviteAccountToOrganizationResponse
s {$sel:httpStatus:InviteAccountToOrganizationResponse' :: Int
httpStatus = Int
a} :: InviteAccountToOrganizationResponse)
instance
Prelude.NFData
InviteAccountToOrganizationResponse