{-# 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.CreateMember
(
CreateMember (..),
newCreateMember,
createMember_tags,
createMember_account,
CreateMemberResponse (..),
newCreateMemberResponse,
createMemberResponse_arn,
createMemberResponse_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 CreateMember = CreateMember'
{
CreateMember -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateMember -> AccountDetail
account :: AccountDetail
}
deriving (CreateMember -> CreateMember -> Bool
(CreateMember -> CreateMember -> Bool)
-> (CreateMember -> CreateMember -> Bool) -> Eq CreateMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMember -> CreateMember -> Bool
$c/= :: CreateMember -> CreateMember -> Bool
== :: CreateMember -> CreateMember -> Bool
$c== :: CreateMember -> CreateMember -> Bool
Prelude.Eq, ReadPrec [CreateMember]
ReadPrec CreateMember
Int -> ReadS CreateMember
ReadS [CreateMember]
(Int -> ReadS CreateMember)
-> ReadS [CreateMember]
-> ReadPrec CreateMember
-> ReadPrec [CreateMember]
-> Read CreateMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMember]
$creadListPrec :: ReadPrec [CreateMember]
readPrec :: ReadPrec CreateMember
$creadPrec :: ReadPrec CreateMember
readList :: ReadS [CreateMember]
$creadList :: ReadS [CreateMember]
readsPrec :: Int -> ReadS CreateMember
$creadsPrec :: Int -> ReadS CreateMember
Prelude.Read, Int -> CreateMember -> ShowS
[CreateMember] -> ShowS
CreateMember -> String
(Int -> CreateMember -> ShowS)
-> (CreateMember -> String)
-> ([CreateMember] -> ShowS)
-> Show CreateMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMember] -> ShowS
$cshowList :: [CreateMember] -> ShowS
show :: CreateMember -> String
$cshow :: CreateMember -> String
showsPrec :: Int -> CreateMember -> ShowS
$cshowsPrec :: Int -> CreateMember -> ShowS
Prelude.Show, (forall x. CreateMember -> Rep CreateMember x)
-> (forall x. Rep CreateMember x -> CreateMember)
-> Generic CreateMember
forall x. Rep CreateMember x -> CreateMember
forall x. CreateMember -> Rep CreateMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMember x -> CreateMember
$cfrom :: forall x. CreateMember -> Rep CreateMember x
Prelude.Generic)
newCreateMember ::
AccountDetail ->
CreateMember
newCreateMember :: AccountDetail -> CreateMember
newCreateMember AccountDetail
pAccount_ =
CreateMember' :: Maybe (HashMap Text Text) -> AccountDetail -> CreateMember
CreateMember'
{ $sel:tags:CreateMember' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:account:CreateMember' :: AccountDetail
account = AccountDetail
pAccount_
}
createMember_tags :: Lens.Lens' CreateMember (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createMember_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateMember -> f CreateMember
createMember_tags = (CreateMember -> Maybe (HashMap Text Text))
-> (CreateMember -> Maybe (HashMap Text Text) -> CreateMember)
-> Lens
CreateMember
CreateMember
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMember' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateMember' :: CreateMember -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateMember
s@CreateMember' {} Maybe (HashMap Text Text)
a -> CreateMember
s {$sel:tags:CreateMember' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateMember) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateMember -> f CreateMember)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateMember
-> f CreateMember
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createMember_account :: Lens.Lens' CreateMember AccountDetail
createMember_account :: (AccountDetail -> f AccountDetail)
-> CreateMember -> f CreateMember
createMember_account = (CreateMember -> AccountDetail)
-> (CreateMember -> AccountDetail -> CreateMember)
-> Lens CreateMember CreateMember AccountDetail AccountDetail
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMember' {AccountDetail
account :: AccountDetail
$sel:account:CreateMember' :: CreateMember -> AccountDetail
account} -> AccountDetail
account) (\s :: CreateMember
s@CreateMember' {} AccountDetail
a -> CreateMember
s {$sel:account:CreateMember' :: AccountDetail
account = AccountDetail
a} :: CreateMember)
instance Core.AWSRequest CreateMember where
type AWSResponse CreateMember = CreateMemberResponse
request :: CreateMember -> Request CreateMember
request = Service -> CreateMember -> Request CreateMember
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateMember
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMember)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateMember))
-> Logger
-> Service
-> Proxy CreateMember
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMember)))
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 Text -> Int -> CreateMemberResponse
CreateMemberResponse'
(Maybe Text -> Int -> CreateMemberResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateMemberResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"arn")
Either String (Int -> CreateMemberResponse)
-> Either String Int -> Either String CreateMemberResponse
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 CreateMember
instance Prelude.NFData CreateMember
instance Core.ToHeaders CreateMember where
toHeaders :: CreateMember -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateMember -> 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 CreateMember where
toJSON :: CreateMember -> Value
toJSON CreateMember' {Maybe (HashMap Text Text)
AccountDetail
account :: AccountDetail
tags :: Maybe (HashMap Text Text)
$sel:account:CreateMember' :: CreateMember -> AccountDetail
$sel:tags:CreateMember' :: CreateMember -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"account" Text -> AccountDetail -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AccountDetail
account)
]
)
instance Core.ToPath CreateMember where
toPath :: CreateMember -> ByteString
toPath = ByteString -> CreateMember -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/members"
instance Core.ToQuery CreateMember where
toQuery :: CreateMember -> QueryString
toQuery = QueryString -> CreateMember -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateMemberResponse = CreateMemberResponse'
{
CreateMemberResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
CreateMemberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateMemberResponse -> CreateMemberResponse -> Bool
(CreateMemberResponse -> CreateMemberResponse -> Bool)
-> (CreateMemberResponse -> CreateMemberResponse -> Bool)
-> Eq CreateMemberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMemberResponse -> CreateMemberResponse -> Bool
$c/= :: CreateMemberResponse -> CreateMemberResponse -> Bool
== :: CreateMemberResponse -> CreateMemberResponse -> Bool
$c== :: CreateMemberResponse -> CreateMemberResponse -> Bool
Prelude.Eq, ReadPrec [CreateMemberResponse]
ReadPrec CreateMemberResponse
Int -> ReadS CreateMemberResponse
ReadS [CreateMemberResponse]
(Int -> ReadS CreateMemberResponse)
-> ReadS [CreateMemberResponse]
-> ReadPrec CreateMemberResponse
-> ReadPrec [CreateMemberResponse]
-> Read CreateMemberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMemberResponse]
$creadListPrec :: ReadPrec [CreateMemberResponse]
readPrec :: ReadPrec CreateMemberResponse
$creadPrec :: ReadPrec CreateMemberResponse
readList :: ReadS [CreateMemberResponse]
$creadList :: ReadS [CreateMemberResponse]
readsPrec :: Int -> ReadS CreateMemberResponse
$creadsPrec :: Int -> ReadS CreateMemberResponse
Prelude.Read, Int -> CreateMemberResponse -> ShowS
[CreateMemberResponse] -> ShowS
CreateMemberResponse -> String
(Int -> CreateMemberResponse -> ShowS)
-> (CreateMemberResponse -> String)
-> ([CreateMemberResponse] -> ShowS)
-> Show CreateMemberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMemberResponse] -> ShowS
$cshowList :: [CreateMemberResponse] -> ShowS
show :: CreateMemberResponse -> String
$cshow :: CreateMemberResponse -> String
showsPrec :: Int -> CreateMemberResponse -> ShowS
$cshowsPrec :: Int -> CreateMemberResponse -> ShowS
Prelude.Show, (forall x. CreateMemberResponse -> Rep CreateMemberResponse x)
-> (forall x. Rep CreateMemberResponse x -> CreateMemberResponse)
-> Generic CreateMemberResponse
forall x. Rep CreateMemberResponse x -> CreateMemberResponse
forall x. CreateMemberResponse -> Rep CreateMemberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMemberResponse x -> CreateMemberResponse
$cfrom :: forall x. CreateMemberResponse -> Rep CreateMemberResponse x
Prelude.Generic)
newCreateMemberResponse ::
Prelude.Int ->
CreateMemberResponse
newCreateMemberResponse :: Int -> CreateMemberResponse
newCreateMemberResponse Int
pHttpStatus_ =
CreateMemberResponse' :: Maybe Text -> Int -> CreateMemberResponse
CreateMemberResponse'
{ $sel:arn:CreateMemberResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateMemberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createMemberResponse_arn :: Lens.Lens' CreateMemberResponse (Prelude.Maybe Prelude.Text)
createMemberResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateMemberResponse -> f CreateMemberResponse
createMemberResponse_arn = (CreateMemberResponse -> Maybe Text)
-> (CreateMemberResponse -> Maybe Text -> CreateMemberResponse)
-> Lens
CreateMemberResponse CreateMemberResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMemberResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateMemberResponse' :: CreateMemberResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateMemberResponse
s@CreateMemberResponse' {} Maybe Text
a -> CreateMemberResponse
s {$sel:arn:CreateMemberResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateMemberResponse)
createMemberResponse_httpStatus :: Lens.Lens' CreateMemberResponse Prelude.Int
createMemberResponse_httpStatus :: (Int -> f Int) -> CreateMemberResponse -> f CreateMemberResponse
createMemberResponse_httpStatus = (CreateMemberResponse -> Int)
-> (CreateMemberResponse -> Int -> CreateMemberResponse)
-> Lens CreateMemberResponse CreateMemberResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMemberResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMemberResponse' :: CreateMemberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMemberResponse
s@CreateMemberResponse' {} Int
a -> CreateMemberResponse
s {$sel:httpStatus:CreateMemberResponse' :: Int
httpStatus = Int
a} :: CreateMemberResponse)
instance Prelude.NFData CreateMemberResponse