{-# 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.Inspector2.BatchGetAccountStatus
(
BatchGetAccountStatus (..),
newBatchGetAccountStatus,
batchGetAccountStatus_accountIds,
BatchGetAccountStatusResponse (..),
newBatchGetAccountStatusResponse,
batchGetAccountStatusResponse_failedAccounts,
batchGetAccountStatusResponse_httpStatus,
batchGetAccountStatusResponse_accounts,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchGetAccountStatus = BatchGetAccountStatus'
{
BatchGetAccountStatus -> Maybe [Text]
accountIds :: Prelude.Maybe [Prelude.Text]
}
deriving (BatchGetAccountStatus -> BatchGetAccountStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetAccountStatus -> BatchGetAccountStatus -> Bool
$c/= :: BatchGetAccountStatus -> BatchGetAccountStatus -> Bool
== :: BatchGetAccountStatus -> BatchGetAccountStatus -> Bool
$c== :: BatchGetAccountStatus -> BatchGetAccountStatus -> Bool
Prelude.Eq, ReadPrec [BatchGetAccountStatus]
ReadPrec BatchGetAccountStatus
Int -> ReadS BatchGetAccountStatus
ReadS [BatchGetAccountStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetAccountStatus]
$creadListPrec :: ReadPrec [BatchGetAccountStatus]
readPrec :: ReadPrec BatchGetAccountStatus
$creadPrec :: ReadPrec BatchGetAccountStatus
readList :: ReadS [BatchGetAccountStatus]
$creadList :: ReadS [BatchGetAccountStatus]
readsPrec :: Int -> ReadS BatchGetAccountStatus
$creadsPrec :: Int -> ReadS BatchGetAccountStatus
Prelude.Read, Int -> BatchGetAccountStatus -> ShowS
[BatchGetAccountStatus] -> ShowS
BatchGetAccountStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetAccountStatus] -> ShowS
$cshowList :: [BatchGetAccountStatus] -> ShowS
show :: BatchGetAccountStatus -> String
$cshow :: BatchGetAccountStatus -> String
showsPrec :: Int -> BatchGetAccountStatus -> ShowS
$cshowsPrec :: Int -> BatchGetAccountStatus -> ShowS
Prelude.Show, forall x. Rep BatchGetAccountStatus x -> BatchGetAccountStatus
forall x. BatchGetAccountStatus -> Rep BatchGetAccountStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetAccountStatus x -> BatchGetAccountStatus
$cfrom :: forall x. BatchGetAccountStatus -> Rep BatchGetAccountStatus x
Prelude.Generic)
newBatchGetAccountStatus ::
BatchGetAccountStatus
newBatchGetAccountStatus :: BatchGetAccountStatus
newBatchGetAccountStatus =
BatchGetAccountStatus'
{ $sel:accountIds:BatchGetAccountStatus' :: Maybe [Text]
accountIds =
forall a. Maybe a
Prelude.Nothing
}
batchGetAccountStatus_accountIds :: Lens.Lens' BatchGetAccountStatus (Prelude.Maybe [Prelude.Text])
batchGetAccountStatus_accountIds :: Lens' BatchGetAccountStatus (Maybe [Text])
batchGetAccountStatus_accountIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAccountStatus' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:BatchGetAccountStatus' :: BatchGetAccountStatus -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: BatchGetAccountStatus
s@BatchGetAccountStatus' {} Maybe [Text]
a -> BatchGetAccountStatus
s {$sel:accountIds:BatchGetAccountStatus' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: BatchGetAccountStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchGetAccountStatus where
type
AWSResponse BatchGetAccountStatus =
BatchGetAccountStatusResponse
request :: (Service -> Service)
-> BatchGetAccountStatus -> Request BatchGetAccountStatus
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchGetAccountStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetAccountStatus)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [FailedAccount]
-> Int -> [AccountState] -> BatchGetAccountStatusResponse
BatchGetAccountStatusResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"failedAccounts" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"accounts" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchGetAccountStatus where
hashWithSalt :: Int -> BatchGetAccountStatus -> Int
hashWithSalt Int
_salt BatchGetAccountStatus' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:BatchGetAccountStatus' :: BatchGetAccountStatus -> Maybe [Text]
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
accountIds
instance Prelude.NFData BatchGetAccountStatus where
rnf :: BatchGetAccountStatus -> ()
rnf BatchGetAccountStatus' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:BatchGetAccountStatus' :: BatchGetAccountStatus -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
accountIds
instance Data.ToHeaders BatchGetAccountStatus where
toHeaders :: BatchGetAccountStatus -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchGetAccountStatus where
toJSON :: BatchGetAccountStatus -> Value
toJSON BatchGetAccountStatus' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:BatchGetAccountStatus' :: BatchGetAccountStatus -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"accountIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
accountIds]
)
instance Data.ToPath BatchGetAccountStatus where
toPath :: BatchGetAccountStatus -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/status/batch/get"
instance Data.ToQuery BatchGetAccountStatus where
toQuery :: BatchGetAccountStatus -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetAccountStatusResponse = BatchGetAccountStatusResponse'
{
BatchGetAccountStatusResponse -> Maybe [FailedAccount]
failedAccounts :: Prelude.Maybe [FailedAccount],
BatchGetAccountStatusResponse -> Int
httpStatus :: Prelude.Int,
BatchGetAccountStatusResponse -> [AccountState]
accounts :: [AccountState]
}
deriving (BatchGetAccountStatusResponse
-> BatchGetAccountStatusResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetAccountStatusResponse
-> BatchGetAccountStatusResponse -> Bool
$c/= :: BatchGetAccountStatusResponse
-> BatchGetAccountStatusResponse -> Bool
== :: BatchGetAccountStatusResponse
-> BatchGetAccountStatusResponse -> Bool
$c== :: BatchGetAccountStatusResponse
-> BatchGetAccountStatusResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetAccountStatusResponse]
ReadPrec BatchGetAccountStatusResponse
Int -> ReadS BatchGetAccountStatusResponse
ReadS [BatchGetAccountStatusResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetAccountStatusResponse]
$creadListPrec :: ReadPrec [BatchGetAccountStatusResponse]
readPrec :: ReadPrec BatchGetAccountStatusResponse
$creadPrec :: ReadPrec BatchGetAccountStatusResponse
readList :: ReadS [BatchGetAccountStatusResponse]
$creadList :: ReadS [BatchGetAccountStatusResponse]
readsPrec :: Int -> ReadS BatchGetAccountStatusResponse
$creadsPrec :: Int -> ReadS BatchGetAccountStatusResponse
Prelude.Read, Int -> BatchGetAccountStatusResponse -> ShowS
[BatchGetAccountStatusResponse] -> ShowS
BatchGetAccountStatusResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetAccountStatusResponse] -> ShowS
$cshowList :: [BatchGetAccountStatusResponse] -> ShowS
show :: BatchGetAccountStatusResponse -> String
$cshow :: BatchGetAccountStatusResponse -> String
showsPrec :: Int -> BatchGetAccountStatusResponse -> ShowS
$cshowsPrec :: Int -> BatchGetAccountStatusResponse -> ShowS
Prelude.Show, forall x.
Rep BatchGetAccountStatusResponse x
-> BatchGetAccountStatusResponse
forall x.
BatchGetAccountStatusResponse
-> Rep BatchGetAccountStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetAccountStatusResponse x
-> BatchGetAccountStatusResponse
$cfrom :: forall x.
BatchGetAccountStatusResponse
-> Rep BatchGetAccountStatusResponse x
Prelude.Generic)
newBatchGetAccountStatusResponse ::
Prelude.Int ->
BatchGetAccountStatusResponse
newBatchGetAccountStatusResponse :: Int -> BatchGetAccountStatusResponse
newBatchGetAccountStatusResponse Int
pHttpStatus_ =
BatchGetAccountStatusResponse'
{ $sel:failedAccounts:BatchGetAccountStatusResponse' :: Maybe [FailedAccount]
failedAccounts =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetAccountStatusResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:accounts:BatchGetAccountStatusResponse' :: [AccountState]
accounts = forall a. Monoid a => a
Prelude.mempty
}
batchGetAccountStatusResponse_failedAccounts :: Lens.Lens' BatchGetAccountStatusResponse (Prelude.Maybe [FailedAccount])
batchGetAccountStatusResponse_failedAccounts :: Lens' BatchGetAccountStatusResponse (Maybe [FailedAccount])
batchGetAccountStatusResponse_failedAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAccountStatusResponse' {Maybe [FailedAccount]
failedAccounts :: Maybe [FailedAccount]
$sel:failedAccounts:BatchGetAccountStatusResponse' :: BatchGetAccountStatusResponse -> Maybe [FailedAccount]
failedAccounts} -> Maybe [FailedAccount]
failedAccounts) (\s :: BatchGetAccountStatusResponse
s@BatchGetAccountStatusResponse' {} Maybe [FailedAccount]
a -> BatchGetAccountStatusResponse
s {$sel:failedAccounts:BatchGetAccountStatusResponse' :: Maybe [FailedAccount]
failedAccounts = Maybe [FailedAccount]
a} :: BatchGetAccountStatusResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetAccountStatusResponse_httpStatus :: Lens.Lens' BatchGetAccountStatusResponse Prelude.Int
batchGetAccountStatusResponse_httpStatus :: Lens' BatchGetAccountStatusResponse Int
batchGetAccountStatusResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAccountStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetAccountStatusResponse' :: BatchGetAccountStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetAccountStatusResponse
s@BatchGetAccountStatusResponse' {} Int
a -> BatchGetAccountStatusResponse
s {$sel:httpStatus:BatchGetAccountStatusResponse' :: Int
httpStatus = Int
a} :: BatchGetAccountStatusResponse)
batchGetAccountStatusResponse_accounts :: Lens.Lens' BatchGetAccountStatusResponse [AccountState]
batchGetAccountStatusResponse_accounts :: Lens' BatchGetAccountStatusResponse [AccountState]
batchGetAccountStatusResponse_accounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetAccountStatusResponse' {[AccountState]
accounts :: [AccountState]
$sel:accounts:BatchGetAccountStatusResponse' :: BatchGetAccountStatusResponse -> [AccountState]
accounts} -> [AccountState]
accounts) (\s :: BatchGetAccountStatusResponse
s@BatchGetAccountStatusResponse' {} [AccountState]
a -> BatchGetAccountStatusResponse
s {$sel:accounts:BatchGetAccountStatusResponse' :: [AccountState]
accounts = [AccountState]
a} :: BatchGetAccountStatusResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData BatchGetAccountStatusResponse where
rnf :: BatchGetAccountStatusResponse -> ()
rnf BatchGetAccountStatusResponse' {Int
[AccountState]
Maybe [FailedAccount]
accounts :: [AccountState]
httpStatus :: Int
failedAccounts :: Maybe [FailedAccount]
$sel:accounts:BatchGetAccountStatusResponse' :: BatchGetAccountStatusResponse -> [AccountState]
$sel:httpStatus:BatchGetAccountStatusResponse' :: BatchGetAccountStatusResponse -> Int
$sel:failedAccounts:BatchGetAccountStatusResponse' :: BatchGetAccountStatusResponse -> Maybe [FailedAccount]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [FailedAccount]
failedAccounts
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AccountState]
accounts