{-# 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.GuardDuty.DeclineInvitations
(
DeclineInvitations (..),
newDeclineInvitations,
declineInvitations_accountIds,
DeclineInvitationsResponse (..),
newDeclineInvitationsResponse,
declineInvitationsResponse_httpStatus,
declineInvitationsResponse_unprocessedAccounts,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeclineInvitations = DeclineInvitations'
{
DeclineInvitations -> NonEmpty Text
accountIds :: Prelude.NonEmpty 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 ::
Prelude.NonEmpty Prelude.Text ->
DeclineInvitations
newDeclineInvitations :: NonEmpty Text -> DeclineInvitations
newDeclineInvitations NonEmpty Text
pAccountIds_ =
DeclineInvitations' :: NonEmpty Text -> DeclineInvitations
DeclineInvitations'
{ $sel:accountIds:DeclineInvitations' :: NonEmpty Text
accountIds =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAccountIds_
}
declineInvitations_accountIds :: Lens.Lens' DeclineInvitations (Prelude.NonEmpty Prelude.Text)
declineInvitations_accountIds :: (NonEmpty Text -> f (NonEmpty Text))
-> DeclineInvitations -> f DeclineInvitations
declineInvitations_accountIds = (DeclineInvitations -> NonEmpty Text)
-> (DeclineInvitations -> NonEmpty Text -> DeclineInvitations)
-> Lens
DeclineInvitations
DeclineInvitations
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeclineInvitations' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:DeclineInvitations' :: DeclineInvitations -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: DeclineInvitations
s@DeclineInvitations' {} NonEmpty Text
a -> DeclineInvitations
s {$sel:accountIds:DeclineInvitations' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: DeclineInvitations) ((NonEmpty Text -> f (NonEmpty Text))
-> DeclineInvitations -> f DeclineInvitations)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DeclineInvitations
-> f DeclineInvitations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty 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 ->
Int -> [UnprocessedAccount] -> DeclineInvitationsResponse
DeclineInvitationsResponse'
(Int -> [UnprocessedAccount] -> DeclineInvitationsResponse)
-> Either String Int
-> Either
String ([UnprocessedAccount] -> DeclineInvitationsResponse)
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))
Either String ([UnprocessedAccount] -> DeclineInvitationsResponse)
-> Either String [UnprocessedAccount]
-> Either String DeclineInvitationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [UnprocessedAccount])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"unprocessedAccounts"
Either String (Maybe [UnprocessedAccount])
-> [UnprocessedAccount] -> Either String [UnprocessedAccount]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
)
)
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' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:DeclineInvitations' :: DeclineInvitations -> NonEmpty 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 -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
accountIds)]
)
instance Core.ToPath DeclineInvitations where
toPath :: DeclineInvitations -> ByteString
toPath = ByteString -> DeclineInvitations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/invitation/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 -> Int
httpStatus :: Prelude.Int,
DeclineInvitationsResponse -> [UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
}
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' :: Int -> [UnprocessedAccount] -> DeclineInvitationsResponse
DeclineInvitationsResponse'
{ $sel:httpStatus:DeclineInvitationsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:unprocessedAccounts:DeclineInvitationsResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
}
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)
declineInvitationsResponse_unprocessedAccounts :: Lens.Lens' DeclineInvitationsResponse [UnprocessedAccount]
declineInvitationsResponse_unprocessedAccounts :: ([UnprocessedAccount] -> f [UnprocessedAccount])
-> DeclineInvitationsResponse -> f DeclineInvitationsResponse
declineInvitationsResponse_unprocessedAccounts = (DeclineInvitationsResponse -> [UnprocessedAccount])
-> (DeclineInvitationsResponse
-> [UnprocessedAccount] -> DeclineInvitationsResponse)
-> Lens
DeclineInvitationsResponse
DeclineInvitationsResponse
[UnprocessedAccount]
[UnprocessedAccount]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeclineInvitationsResponse' {[UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
$sel:unprocessedAccounts:DeclineInvitationsResponse' :: DeclineInvitationsResponse -> [UnprocessedAccount]
unprocessedAccounts} -> [UnprocessedAccount]
unprocessedAccounts) (\s :: DeclineInvitationsResponse
s@DeclineInvitationsResponse' {} [UnprocessedAccount]
a -> DeclineInvitationsResponse
s {$sel:unprocessedAccounts:DeclineInvitationsResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
a} :: DeclineInvitationsResponse) (([UnprocessedAccount] -> f [UnprocessedAccount])
-> DeclineInvitationsResponse -> f DeclineInvitationsResponse)
-> (([UnprocessedAccount] -> f [UnprocessedAccount])
-> [UnprocessedAccount] -> f [UnprocessedAccount])
-> ([UnprocessedAccount] -> f [UnprocessedAccount])
-> DeclineInvitationsResponse
-> f DeclineInvitationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UnprocessedAccount] -> f [UnprocessedAccount])
-> [UnprocessedAccount] -> f [UnprocessedAccount]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData DeclineInvitationsResponse