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