{-# 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.SecurityHub.InviteMembers
(
InviteMembers (..),
newInviteMembers,
inviteMembers_accountIds,
InviteMembersResponse (..),
newInviteMembersResponse,
inviteMembersResponse_unprocessedAccounts,
inviteMembersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecurityHub.Types
data InviteMembers = InviteMembers'
{
InviteMembers -> [Text]
accountIds :: [Prelude.Text]
}
deriving (InviteMembers -> InviteMembers -> Bool
(InviteMembers -> InviteMembers -> Bool)
-> (InviteMembers -> InviteMembers -> Bool) -> Eq InviteMembers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteMembers -> InviteMembers -> Bool
$c/= :: InviteMembers -> InviteMembers -> Bool
== :: InviteMembers -> InviteMembers -> Bool
$c== :: InviteMembers -> InviteMembers -> Bool
Prelude.Eq, ReadPrec [InviteMembers]
ReadPrec InviteMembers
Int -> ReadS InviteMembers
ReadS [InviteMembers]
(Int -> ReadS InviteMembers)
-> ReadS [InviteMembers]
-> ReadPrec InviteMembers
-> ReadPrec [InviteMembers]
-> Read InviteMembers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InviteMembers]
$creadListPrec :: ReadPrec [InviteMembers]
readPrec :: ReadPrec InviteMembers
$creadPrec :: ReadPrec InviteMembers
readList :: ReadS [InviteMembers]
$creadList :: ReadS [InviteMembers]
readsPrec :: Int -> ReadS InviteMembers
$creadsPrec :: Int -> ReadS InviteMembers
Prelude.Read, Int -> InviteMembers -> ShowS
[InviteMembers] -> ShowS
InviteMembers -> String
(Int -> InviteMembers -> ShowS)
-> (InviteMembers -> String)
-> ([InviteMembers] -> ShowS)
-> Show InviteMembers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteMembers] -> ShowS
$cshowList :: [InviteMembers] -> ShowS
show :: InviteMembers -> String
$cshow :: InviteMembers -> String
showsPrec :: Int -> InviteMembers -> ShowS
$cshowsPrec :: Int -> InviteMembers -> ShowS
Prelude.Show, (forall x. InviteMembers -> Rep InviteMembers x)
-> (forall x. Rep InviteMembers x -> InviteMembers)
-> Generic InviteMembers
forall x. Rep InviteMembers x -> InviteMembers
forall x. InviteMembers -> Rep InviteMembers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InviteMembers x -> InviteMembers
$cfrom :: forall x. InviteMembers -> Rep InviteMembers x
Prelude.Generic)
newInviteMembers ::
InviteMembers
newInviteMembers :: InviteMembers
newInviteMembers =
InviteMembers' :: [Text] -> InviteMembers
InviteMembers' {$sel:accountIds:InviteMembers' :: [Text]
accountIds = [Text]
forall a. Monoid a => a
Prelude.mempty}
inviteMembers_accountIds :: Lens.Lens' InviteMembers [Prelude.Text]
inviteMembers_accountIds :: ([Text] -> f [Text]) -> InviteMembers -> f InviteMembers
inviteMembers_accountIds = (InviteMembers -> [Text])
-> (InviteMembers -> [Text] -> InviteMembers)
-> Lens InviteMembers InviteMembers [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembers' {[Text]
accountIds :: [Text]
$sel:accountIds:InviteMembers' :: InviteMembers -> [Text]
accountIds} -> [Text]
accountIds) (\s :: InviteMembers
s@InviteMembers' {} [Text]
a -> InviteMembers
s {$sel:accountIds:InviteMembers' :: [Text]
accountIds = [Text]
a} :: InviteMembers) (([Text] -> f [Text]) -> InviteMembers -> f InviteMembers)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> InviteMembers
-> f InviteMembers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest InviteMembers where
type
AWSResponse InviteMembers =
InviteMembersResponse
request :: InviteMembers -> Request InviteMembers
request = Service -> InviteMembers -> Request InviteMembers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy InviteMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse InviteMembers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse InviteMembers))
-> Logger
-> Service
-> Proxy InviteMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse InviteMembers)))
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 [Result] -> Int -> InviteMembersResponse
InviteMembersResponse'
(Maybe [Result] -> Int -> InviteMembersResponse)
-> Either String (Maybe [Result])
-> Either String (Int -> InviteMembersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Result]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UnprocessedAccounts"
Either String (Maybe (Maybe [Result]))
-> Maybe [Result] -> Either String (Maybe [Result])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Result]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> InviteMembersResponse)
-> Either String Int -> Either String InviteMembersResponse
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 InviteMembers
instance Prelude.NFData InviteMembers
instance Core.ToHeaders InviteMembers where
toHeaders :: InviteMembers -> ResponseHeaders
toHeaders =
ResponseHeaders -> InviteMembers -> 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 InviteMembers where
toJSON :: InviteMembers -> Value
toJSON InviteMembers' {[Text]
accountIds :: [Text]
$sel:accountIds:InviteMembers' :: InviteMembers -> [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
"AccountIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
accountIds)]
)
instance Core.ToPath InviteMembers where
toPath :: InviteMembers -> ByteString
toPath = ByteString -> InviteMembers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/members/invite"
instance Core.ToQuery InviteMembers where
toQuery :: InviteMembers -> QueryString
toQuery = QueryString -> InviteMembers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data InviteMembersResponse = InviteMembersResponse'
{
InviteMembersResponse -> Maybe [Result]
unprocessedAccounts :: Prelude.Maybe [Result],
InviteMembersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (InviteMembersResponse -> InviteMembersResponse -> Bool
(InviteMembersResponse -> InviteMembersResponse -> Bool)
-> (InviteMembersResponse -> InviteMembersResponse -> Bool)
-> Eq InviteMembersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteMembersResponse -> InviteMembersResponse -> Bool
$c/= :: InviteMembersResponse -> InviteMembersResponse -> Bool
== :: InviteMembersResponse -> InviteMembersResponse -> Bool
$c== :: InviteMembersResponse -> InviteMembersResponse -> Bool
Prelude.Eq, ReadPrec [InviteMembersResponse]
ReadPrec InviteMembersResponse
Int -> ReadS InviteMembersResponse
ReadS [InviteMembersResponse]
(Int -> ReadS InviteMembersResponse)
-> ReadS [InviteMembersResponse]
-> ReadPrec InviteMembersResponse
-> ReadPrec [InviteMembersResponse]
-> Read InviteMembersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InviteMembersResponse]
$creadListPrec :: ReadPrec [InviteMembersResponse]
readPrec :: ReadPrec InviteMembersResponse
$creadPrec :: ReadPrec InviteMembersResponse
readList :: ReadS [InviteMembersResponse]
$creadList :: ReadS [InviteMembersResponse]
readsPrec :: Int -> ReadS InviteMembersResponse
$creadsPrec :: Int -> ReadS InviteMembersResponse
Prelude.Read, Int -> InviteMembersResponse -> ShowS
[InviteMembersResponse] -> ShowS
InviteMembersResponse -> String
(Int -> InviteMembersResponse -> ShowS)
-> (InviteMembersResponse -> String)
-> ([InviteMembersResponse] -> ShowS)
-> Show InviteMembersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteMembersResponse] -> ShowS
$cshowList :: [InviteMembersResponse] -> ShowS
show :: InviteMembersResponse -> String
$cshow :: InviteMembersResponse -> String
showsPrec :: Int -> InviteMembersResponse -> ShowS
$cshowsPrec :: Int -> InviteMembersResponse -> ShowS
Prelude.Show, (forall x. InviteMembersResponse -> Rep InviteMembersResponse x)
-> (forall x. Rep InviteMembersResponse x -> InviteMembersResponse)
-> Generic InviteMembersResponse
forall x. Rep InviteMembersResponse x -> InviteMembersResponse
forall x. InviteMembersResponse -> Rep InviteMembersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InviteMembersResponse x -> InviteMembersResponse
$cfrom :: forall x. InviteMembersResponse -> Rep InviteMembersResponse x
Prelude.Generic)
newInviteMembersResponse ::
Prelude.Int ->
InviteMembersResponse
newInviteMembersResponse :: Int -> InviteMembersResponse
newInviteMembersResponse Int
pHttpStatus_ =
InviteMembersResponse' :: Maybe [Result] -> Int -> InviteMembersResponse
InviteMembersResponse'
{ $sel:unprocessedAccounts:InviteMembersResponse' :: Maybe [Result]
unprocessedAccounts =
Maybe [Result]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:InviteMembersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
inviteMembersResponse_unprocessedAccounts :: Lens.Lens' InviteMembersResponse (Prelude.Maybe [Result])
inviteMembersResponse_unprocessedAccounts :: (Maybe [Result] -> f (Maybe [Result]))
-> InviteMembersResponse -> f InviteMembersResponse
inviteMembersResponse_unprocessedAccounts = (InviteMembersResponse -> Maybe [Result])
-> (InviteMembersResponse
-> Maybe [Result] -> InviteMembersResponse)
-> Lens
InviteMembersResponse
InviteMembersResponse
(Maybe [Result])
(Maybe [Result])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembersResponse' {Maybe [Result]
unprocessedAccounts :: Maybe [Result]
$sel:unprocessedAccounts:InviteMembersResponse' :: InviteMembersResponse -> Maybe [Result]
unprocessedAccounts} -> Maybe [Result]
unprocessedAccounts) (\s :: InviteMembersResponse
s@InviteMembersResponse' {} Maybe [Result]
a -> InviteMembersResponse
s {$sel:unprocessedAccounts:InviteMembersResponse' :: Maybe [Result]
unprocessedAccounts = Maybe [Result]
a} :: InviteMembersResponse) ((Maybe [Result] -> f (Maybe [Result]))
-> InviteMembersResponse -> f InviteMembersResponse)
-> ((Maybe [Result] -> f (Maybe [Result]))
-> Maybe [Result] -> f (Maybe [Result]))
-> (Maybe [Result] -> f (Maybe [Result]))
-> InviteMembersResponse
-> f InviteMembersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Result] [Result] [Result] [Result]
-> Iso
(Maybe [Result]) (Maybe [Result]) (Maybe [Result]) (Maybe [Result])
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 [Result] [Result] [Result] [Result]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
inviteMembersResponse_httpStatus :: Lens.Lens' InviteMembersResponse Prelude.Int
inviteMembersResponse_httpStatus :: (Int -> f Int) -> InviteMembersResponse -> f InviteMembersResponse
inviteMembersResponse_httpStatus = (InviteMembersResponse -> Int)
-> (InviteMembersResponse -> Int -> InviteMembersResponse)
-> Lens InviteMembersResponse InviteMembersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembersResponse' {Int
httpStatus :: Int
$sel:httpStatus:InviteMembersResponse' :: InviteMembersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: InviteMembersResponse
s@InviteMembersResponse' {} Int
a -> InviteMembersResponse
s {$sel:httpStatus:InviteMembersResponse' :: Int
httpStatus = Int
a} :: InviteMembersResponse)
instance Prelude.NFData InviteMembersResponse