{-# 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.MacieV2.EnableOrganizationAdminAccount
(
EnableOrganizationAdminAccount (..),
newEnableOrganizationAdminAccount,
enableOrganizationAdminAccount_clientToken,
enableOrganizationAdminAccount_adminAccountId,
EnableOrganizationAdminAccountResponse (..),
newEnableOrganizationAdminAccountResponse,
enableOrganizationAdminAccountResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data EnableOrganizationAdminAccount = EnableOrganizationAdminAccount'
{
EnableOrganizationAdminAccount -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
EnableOrganizationAdminAccount -> Text
adminAccountId :: Prelude.Text
}
deriving (EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool
(EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool)
-> (EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool)
-> Eq EnableOrganizationAdminAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool
$c/= :: EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool
== :: EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool
$c== :: EnableOrganizationAdminAccount
-> EnableOrganizationAdminAccount -> Bool
Prelude.Eq, ReadPrec [EnableOrganizationAdminAccount]
ReadPrec EnableOrganizationAdminAccount
Int -> ReadS EnableOrganizationAdminAccount
ReadS [EnableOrganizationAdminAccount]
(Int -> ReadS EnableOrganizationAdminAccount)
-> ReadS [EnableOrganizationAdminAccount]
-> ReadPrec EnableOrganizationAdminAccount
-> ReadPrec [EnableOrganizationAdminAccount]
-> Read EnableOrganizationAdminAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableOrganizationAdminAccount]
$creadListPrec :: ReadPrec [EnableOrganizationAdminAccount]
readPrec :: ReadPrec EnableOrganizationAdminAccount
$creadPrec :: ReadPrec EnableOrganizationAdminAccount
readList :: ReadS [EnableOrganizationAdminAccount]
$creadList :: ReadS [EnableOrganizationAdminAccount]
readsPrec :: Int -> ReadS EnableOrganizationAdminAccount
$creadsPrec :: Int -> ReadS EnableOrganizationAdminAccount
Prelude.Read, Int -> EnableOrganizationAdminAccount -> ShowS
[EnableOrganizationAdminAccount] -> ShowS
EnableOrganizationAdminAccount -> String
(Int -> EnableOrganizationAdminAccount -> ShowS)
-> (EnableOrganizationAdminAccount -> String)
-> ([EnableOrganizationAdminAccount] -> ShowS)
-> Show EnableOrganizationAdminAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableOrganizationAdminAccount] -> ShowS
$cshowList :: [EnableOrganizationAdminAccount] -> ShowS
show :: EnableOrganizationAdminAccount -> String
$cshow :: EnableOrganizationAdminAccount -> String
showsPrec :: Int -> EnableOrganizationAdminAccount -> ShowS
$cshowsPrec :: Int -> EnableOrganizationAdminAccount -> ShowS
Prelude.Show, (forall x.
EnableOrganizationAdminAccount
-> Rep EnableOrganizationAdminAccount x)
-> (forall x.
Rep EnableOrganizationAdminAccount x
-> EnableOrganizationAdminAccount)
-> Generic EnableOrganizationAdminAccount
forall x.
Rep EnableOrganizationAdminAccount x
-> EnableOrganizationAdminAccount
forall x.
EnableOrganizationAdminAccount
-> Rep EnableOrganizationAdminAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableOrganizationAdminAccount x
-> EnableOrganizationAdminAccount
$cfrom :: forall x.
EnableOrganizationAdminAccount
-> Rep EnableOrganizationAdminAccount x
Prelude.Generic)
newEnableOrganizationAdminAccount ::
Prelude.Text ->
EnableOrganizationAdminAccount
newEnableOrganizationAdminAccount :: Text -> EnableOrganizationAdminAccount
newEnableOrganizationAdminAccount Text
pAdminAccountId_ =
EnableOrganizationAdminAccount' :: Maybe Text -> Text -> EnableOrganizationAdminAccount
EnableOrganizationAdminAccount'
{ $sel:clientToken:EnableOrganizationAdminAccount' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:adminAccountId:EnableOrganizationAdminAccount' :: Text
adminAccountId = Text
pAdminAccountId_
}
enableOrganizationAdminAccount_clientToken :: Lens.Lens' EnableOrganizationAdminAccount (Prelude.Maybe Prelude.Text)
enableOrganizationAdminAccount_clientToken :: (Maybe Text -> f (Maybe Text))
-> EnableOrganizationAdminAccount
-> f EnableOrganizationAdminAccount
enableOrganizationAdminAccount_clientToken = (EnableOrganizationAdminAccount -> Maybe Text)
-> (EnableOrganizationAdminAccount
-> Maybe Text -> EnableOrganizationAdminAccount)
-> Lens
EnableOrganizationAdminAccount
EnableOrganizationAdminAccount
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableOrganizationAdminAccount' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:EnableOrganizationAdminAccount' :: EnableOrganizationAdminAccount -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: EnableOrganizationAdminAccount
s@EnableOrganizationAdminAccount' {} Maybe Text
a -> EnableOrganizationAdminAccount
s {$sel:clientToken:EnableOrganizationAdminAccount' :: Maybe Text
clientToken = Maybe Text
a} :: EnableOrganizationAdminAccount)
enableOrganizationAdminAccount_adminAccountId :: Lens.Lens' EnableOrganizationAdminAccount Prelude.Text
enableOrganizationAdminAccount_adminAccountId :: (Text -> f Text)
-> EnableOrganizationAdminAccount
-> f EnableOrganizationAdminAccount
enableOrganizationAdminAccount_adminAccountId = (EnableOrganizationAdminAccount -> Text)
-> (EnableOrganizationAdminAccount
-> Text -> EnableOrganizationAdminAccount)
-> Lens
EnableOrganizationAdminAccount
EnableOrganizationAdminAccount
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableOrganizationAdminAccount' {Text
adminAccountId :: Text
$sel:adminAccountId:EnableOrganizationAdminAccount' :: EnableOrganizationAdminAccount -> Text
adminAccountId} -> Text
adminAccountId) (\s :: EnableOrganizationAdminAccount
s@EnableOrganizationAdminAccount' {} Text
a -> EnableOrganizationAdminAccount
s {$sel:adminAccountId:EnableOrganizationAdminAccount' :: Text
adminAccountId = Text
a} :: EnableOrganizationAdminAccount)
instance
Core.AWSRequest
EnableOrganizationAdminAccount
where
type
AWSResponse EnableOrganizationAdminAccount =
EnableOrganizationAdminAccountResponse
request :: EnableOrganizationAdminAccount
-> Request EnableOrganizationAdminAccount
request = Service
-> EnableOrganizationAdminAccount
-> Request EnableOrganizationAdminAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EnableOrganizationAdminAccount
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse EnableOrganizationAdminAccount)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse EnableOrganizationAdminAccount))
-> Logger
-> Service
-> Proxy EnableOrganizationAdminAccount
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse EnableOrganizationAdminAccount)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> EnableOrganizationAdminAccountResponse
EnableOrganizationAdminAccountResponse'
(Int -> EnableOrganizationAdminAccountResponse)
-> Either String Int
-> Either String EnableOrganizationAdminAccountResponse
forall (f :: * -> *) a b. Functor 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
EnableOrganizationAdminAccount
instance
Prelude.NFData
EnableOrganizationAdminAccount
instance
Core.ToHeaders
EnableOrganizationAdminAccount
where
toHeaders :: EnableOrganizationAdminAccount -> ResponseHeaders
toHeaders =
ResponseHeaders
-> EnableOrganizationAdminAccount -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 EnableOrganizationAdminAccount where
toJSON :: EnableOrganizationAdminAccount -> Value
toJSON EnableOrganizationAdminAccount' {Maybe Text
Text
adminAccountId :: Text
clientToken :: Maybe Text
$sel:adminAccountId:EnableOrganizationAdminAccount' :: EnableOrganizationAdminAccount -> Text
$sel:clientToken:EnableOrganizationAdminAccount' :: EnableOrganizationAdminAccount -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"adminAccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
adminAccountId)
]
)
instance Core.ToPath EnableOrganizationAdminAccount where
toPath :: EnableOrganizationAdminAccount -> ByteString
toPath = ByteString -> EnableOrganizationAdminAccount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/admin"
instance Core.ToQuery EnableOrganizationAdminAccount where
toQuery :: EnableOrganizationAdminAccount -> QueryString
toQuery = QueryString -> EnableOrganizationAdminAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data EnableOrganizationAdminAccountResponse = EnableOrganizationAdminAccountResponse'
{
EnableOrganizationAdminAccountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool
(EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool)
-> (EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool)
-> Eq EnableOrganizationAdminAccountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool
$c/= :: EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool
== :: EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool
$c== :: EnableOrganizationAdminAccountResponse
-> EnableOrganizationAdminAccountResponse -> Bool
Prelude.Eq, ReadPrec [EnableOrganizationAdminAccountResponse]
ReadPrec EnableOrganizationAdminAccountResponse
Int -> ReadS EnableOrganizationAdminAccountResponse
ReadS [EnableOrganizationAdminAccountResponse]
(Int -> ReadS EnableOrganizationAdminAccountResponse)
-> ReadS [EnableOrganizationAdminAccountResponse]
-> ReadPrec EnableOrganizationAdminAccountResponse
-> ReadPrec [EnableOrganizationAdminAccountResponse]
-> Read EnableOrganizationAdminAccountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableOrganizationAdminAccountResponse]
$creadListPrec :: ReadPrec [EnableOrganizationAdminAccountResponse]
readPrec :: ReadPrec EnableOrganizationAdminAccountResponse
$creadPrec :: ReadPrec EnableOrganizationAdminAccountResponse
readList :: ReadS [EnableOrganizationAdminAccountResponse]
$creadList :: ReadS [EnableOrganizationAdminAccountResponse]
readsPrec :: Int -> ReadS EnableOrganizationAdminAccountResponse
$creadsPrec :: Int -> ReadS EnableOrganizationAdminAccountResponse
Prelude.Read, Int -> EnableOrganizationAdminAccountResponse -> ShowS
[EnableOrganizationAdminAccountResponse] -> ShowS
EnableOrganizationAdminAccountResponse -> String
(Int -> EnableOrganizationAdminAccountResponse -> ShowS)
-> (EnableOrganizationAdminAccountResponse -> String)
-> ([EnableOrganizationAdminAccountResponse] -> ShowS)
-> Show EnableOrganizationAdminAccountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableOrganizationAdminAccountResponse] -> ShowS
$cshowList :: [EnableOrganizationAdminAccountResponse] -> ShowS
show :: EnableOrganizationAdminAccountResponse -> String
$cshow :: EnableOrganizationAdminAccountResponse -> String
showsPrec :: Int -> EnableOrganizationAdminAccountResponse -> ShowS
$cshowsPrec :: Int -> EnableOrganizationAdminAccountResponse -> ShowS
Prelude.Show, (forall x.
EnableOrganizationAdminAccountResponse
-> Rep EnableOrganizationAdminAccountResponse x)
-> (forall x.
Rep EnableOrganizationAdminAccountResponse x
-> EnableOrganizationAdminAccountResponse)
-> Generic EnableOrganizationAdminAccountResponse
forall x.
Rep EnableOrganizationAdminAccountResponse x
-> EnableOrganizationAdminAccountResponse
forall x.
EnableOrganizationAdminAccountResponse
-> Rep EnableOrganizationAdminAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableOrganizationAdminAccountResponse x
-> EnableOrganizationAdminAccountResponse
$cfrom :: forall x.
EnableOrganizationAdminAccountResponse
-> Rep EnableOrganizationAdminAccountResponse x
Prelude.Generic)
newEnableOrganizationAdminAccountResponse ::
Prelude.Int ->
EnableOrganizationAdminAccountResponse
newEnableOrganizationAdminAccountResponse :: Int -> EnableOrganizationAdminAccountResponse
newEnableOrganizationAdminAccountResponse
Int
pHttpStatus_ =
EnableOrganizationAdminAccountResponse' :: Int -> EnableOrganizationAdminAccountResponse
EnableOrganizationAdminAccountResponse'
{ $sel:httpStatus:EnableOrganizationAdminAccountResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
enableOrganizationAdminAccountResponse_httpStatus :: Lens.Lens' EnableOrganizationAdminAccountResponse Prelude.Int
enableOrganizationAdminAccountResponse_httpStatus :: (Int -> f Int)
-> EnableOrganizationAdminAccountResponse
-> f EnableOrganizationAdminAccountResponse
enableOrganizationAdminAccountResponse_httpStatus = (EnableOrganizationAdminAccountResponse -> Int)
-> (EnableOrganizationAdminAccountResponse
-> Int -> EnableOrganizationAdminAccountResponse)
-> Lens
EnableOrganizationAdminAccountResponse
EnableOrganizationAdminAccountResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableOrganizationAdminAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnableOrganizationAdminAccountResponse' :: EnableOrganizationAdminAccountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EnableOrganizationAdminAccountResponse
s@EnableOrganizationAdminAccountResponse' {} Int
a -> EnableOrganizationAdminAccountResponse
s {$sel:httpStatus:EnableOrganizationAdminAccountResponse' :: Int
httpStatus = Int
a} :: EnableOrganizationAdminAccountResponse)
instance
Prelude.NFData
EnableOrganizationAdminAccountResponse