{-# 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.BatchGetFreeTrialInfo
(
BatchGetFreeTrialInfo (..),
newBatchGetFreeTrialInfo,
batchGetFreeTrialInfo_accountIds,
BatchGetFreeTrialInfoResponse (..),
newBatchGetFreeTrialInfoResponse,
batchGetFreeTrialInfoResponse_httpStatus,
batchGetFreeTrialInfoResponse_accounts,
batchGetFreeTrialInfoResponse_failedAccounts,
)
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 BatchGetFreeTrialInfo = BatchGetFreeTrialInfo'
{
BatchGetFreeTrialInfo -> NonEmpty Text
accountIds :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetFreeTrialInfo -> BatchGetFreeTrialInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetFreeTrialInfo -> BatchGetFreeTrialInfo -> Bool
$c/= :: BatchGetFreeTrialInfo -> BatchGetFreeTrialInfo -> Bool
== :: BatchGetFreeTrialInfo -> BatchGetFreeTrialInfo -> Bool
$c== :: BatchGetFreeTrialInfo -> BatchGetFreeTrialInfo -> Bool
Prelude.Eq, ReadPrec [BatchGetFreeTrialInfo]
ReadPrec BatchGetFreeTrialInfo
Int -> ReadS BatchGetFreeTrialInfo
ReadS [BatchGetFreeTrialInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetFreeTrialInfo]
$creadListPrec :: ReadPrec [BatchGetFreeTrialInfo]
readPrec :: ReadPrec BatchGetFreeTrialInfo
$creadPrec :: ReadPrec BatchGetFreeTrialInfo
readList :: ReadS [BatchGetFreeTrialInfo]
$creadList :: ReadS [BatchGetFreeTrialInfo]
readsPrec :: Int -> ReadS BatchGetFreeTrialInfo
$creadsPrec :: Int -> ReadS BatchGetFreeTrialInfo
Prelude.Read, Int -> BatchGetFreeTrialInfo -> ShowS
[BatchGetFreeTrialInfo] -> ShowS
BatchGetFreeTrialInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetFreeTrialInfo] -> ShowS
$cshowList :: [BatchGetFreeTrialInfo] -> ShowS
show :: BatchGetFreeTrialInfo -> String
$cshow :: BatchGetFreeTrialInfo -> String
showsPrec :: Int -> BatchGetFreeTrialInfo -> ShowS
$cshowsPrec :: Int -> BatchGetFreeTrialInfo -> ShowS
Prelude.Show, forall x. Rep BatchGetFreeTrialInfo x -> BatchGetFreeTrialInfo
forall x. BatchGetFreeTrialInfo -> Rep BatchGetFreeTrialInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetFreeTrialInfo x -> BatchGetFreeTrialInfo
$cfrom :: forall x. BatchGetFreeTrialInfo -> Rep BatchGetFreeTrialInfo x
Prelude.Generic)
newBatchGetFreeTrialInfo ::
Prelude.NonEmpty Prelude.Text ->
BatchGetFreeTrialInfo
newBatchGetFreeTrialInfo :: NonEmpty Text -> BatchGetFreeTrialInfo
newBatchGetFreeTrialInfo NonEmpty Text
pAccountIds_ =
BatchGetFreeTrialInfo'
{ $sel:accountIds:BatchGetFreeTrialInfo' :: NonEmpty Text
accountIds =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAccountIds_
}
batchGetFreeTrialInfo_accountIds :: Lens.Lens' BatchGetFreeTrialInfo (Prelude.NonEmpty Prelude.Text)
batchGetFreeTrialInfo_accountIds :: Lens' BatchGetFreeTrialInfo (NonEmpty Text)
batchGetFreeTrialInfo_accountIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFreeTrialInfo' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:BatchGetFreeTrialInfo' :: BatchGetFreeTrialInfo -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: BatchGetFreeTrialInfo
s@BatchGetFreeTrialInfo' {} NonEmpty Text
a -> BatchGetFreeTrialInfo
s {$sel:accountIds:BatchGetFreeTrialInfo' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: BatchGetFreeTrialInfo) 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 Core.AWSRequest BatchGetFreeTrialInfo where
type
AWSResponse BatchGetFreeTrialInfo =
BatchGetFreeTrialInfoResponse
request :: (Service -> Service)
-> BatchGetFreeTrialInfo -> Request BatchGetFreeTrialInfo
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 BatchGetFreeTrialInfo
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetFreeTrialInfo)))
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 ->
Int
-> [FreeTrialAccountInfo]
-> [FreeTrialInfoError]
-> BatchGetFreeTrialInfoResponse
BatchGetFreeTrialInfoResponse'
forall (f :: * -> *) a b. Functor 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)
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
"failedAccounts"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable BatchGetFreeTrialInfo where
hashWithSalt :: Int -> BatchGetFreeTrialInfo -> Int
hashWithSalt Int
_salt BatchGetFreeTrialInfo' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:BatchGetFreeTrialInfo' :: BatchGetFreeTrialInfo -> NonEmpty Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
accountIds
instance Prelude.NFData BatchGetFreeTrialInfo where
rnf :: BatchGetFreeTrialInfo -> ()
rnf BatchGetFreeTrialInfo' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:BatchGetFreeTrialInfo' :: BatchGetFreeTrialInfo -> NonEmpty Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
accountIds
instance Data.ToHeaders BatchGetFreeTrialInfo where
toHeaders :: BatchGetFreeTrialInfo -> 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 BatchGetFreeTrialInfo where
toJSON :: BatchGetFreeTrialInfo -> Value
toJSON BatchGetFreeTrialInfo' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:BatchGetFreeTrialInfo' :: BatchGetFreeTrialInfo -> NonEmpty Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"accountIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
accountIds)]
)
instance Data.ToPath BatchGetFreeTrialInfo where
toPath :: BatchGetFreeTrialInfo -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/freetrialinfo/batchget"
instance Data.ToQuery BatchGetFreeTrialInfo where
toQuery :: BatchGetFreeTrialInfo -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetFreeTrialInfoResponse = BatchGetFreeTrialInfoResponse'
{
BatchGetFreeTrialInfoResponse -> Int
httpStatus :: Prelude.Int,
BatchGetFreeTrialInfoResponse -> [FreeTrialAccountInfo]
accounts :: [FreeTrialAccountInfo],
BatchGetFreeTrialInfoResponse -> [FreeTrialInfoError]
failedAccounts :: [FreeTrialInfoError]
}
deriving (BatchGetFreeTrialInfoResponse
-> BatchGetFreeTrialInfoResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetFreeTrialInfoResponse
-> BatchGetFreeTrialInfoResponse -> Bool
$c/= :: BatchGetFreeTrialInfoResponse
-> BatchGetFreeTrialInfoResponse -> Bool
== :: BatchGetFreeTrialInfoResponse
-> BatchGetFreeTrialInfoResponse -> Bool
$c== :: BatchGetFreeTrialInfoResponse
-> BatchGetFreeTrialInfoResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetFreeTrialInfoResponse]
ReadPrec BatchGetFreeTrialInfoResponse
Int -> ReadS BatchGetFreeTrialInfoResponse
ReadS [BatchGetFreeTrialInfoResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetFreeTrialInfoResponse]
$creadListPrec :: ReadPrec [BatchGetFreeTrialInfoResponse]
readPrec :: ReadPrec BatchGetFreeTrialInfoResponse
$creadPrec :: ReadPrec BatchGetFreeTrialInfoResponse
readList :: ReadS [BatchGetFreeTrialInfoResponse]
$creadList :: ReadS [BatchGetFreeTrialInfoResponse]
readsPrec :: Int -> ReadS BatchGetFreeTrialInfoResponse
$creadsPrec :: Int -> ReadS BatchGetFreeTrialInfoResponse
Prelude.Read, Int -> BatchGetFreeTrialInfoResponse -> ShowS
[BatchGetFreeTrialInfoResponse] -> ShowS
BatchGetFreeTrialInfoResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetFreeTrialInfoResponse] -> ShowS
$cshowList :: [BatchGetFreeTrialInfoResponse] -> ShowS
show :: BatchGetFreeTrialInfoResponse -> String
$cshow :: BatchGetFreeTrialInfoResponse -> String
showsPrec :: Int -> BatchGetFreeTrialInfoResponse -> ShowS
$cshowsPrec :: Int -> BatchGetFreeTrialInfoResponse -> ShowS
Prelude.Show, forall x.
Rep BatchGetFreeTrialInfoResponse x
-> BatchGetFreeTrialInfoResponse
forall x.
BatchGetFreeTrialInfoResponse
-> Rep BatchGetFreeTrialInfoResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetFreeTrialInfoResponse x
-> BatchGetFreeTrialInfoResponse
$cfrom :: forall x.
BatchGetFreeTrialInfoResponse
-> Rep BatchGetFreeTrialInfoResponse x
Prelude.Generic)
newBatchGetFreeTrialInfoResponse ::
Prelude.Int ->
BatchGetFreeTrialInfoResponse
newBatchGetFreeTrialInfoResponse :: Int -> BatchGetFreeTrialInfoResponse
newBatchGetFreeTrialInfoResponse Int
pHttpStatus_ =
BatchGetFreeTrialInfoResponse'
{ $sel:httpStatus:BatchGetFreeTrialInfoResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:accounts:BatchGetFreeTrialInfoResponse' :: [FreeTrialAccountInfo]
accounts = forall a. Monoid a => a
Prelude.mempty,
$sel:failedAccounts:BatchGetFreeTrialInfoResponse' :: [FreeTrialInfoError]
failedAccounts = forall a. Monoid a => a
Prelude.mempty
}
batchGetFreeTrialInfoResponse_httpStatus :: Lens.Lens' BatchGetFreeTrialInfoResponse Prelude.Int
batchGetFreeTrialInfoResponse_httpStatus :: Lens' BatchGetFreeTrialInfoResponse Int
batchGetFreeTrialInfoResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFreeTrialInfoResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetFreeTrialInfoResponse' :: BatchGetFreeTrialInfoResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetFreeTrialInfoResponse
s@BatchGetFreeTrialInfoResponse' {} Int
a -> BatchGetFreeTrialInfoResponse
s {$sel:httpStatus:BatchGetFreeTrialInfoResponse' :: Int
httpStatus = Int
a} :: BatchGetFreeTrialInfoResponse)
batchGetFreeTrialInfoResponse_accounts :: Lens.Lens' BatchGetFreeTrialInfoResponse [FreeTrialAccountInfo]
batchGetFreeTrialInfoResponse_accounts :: Lens' BatchGetFreeTrialInfoResponse [FreeTrialAccountInfo]
batchGetFreeTrialInfoResponse_accounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFreeTrialInfoResponse' {[FreeTrialAccountInfo]
accounts :: [FreeTrialAccountInfo]
$sel:accounts:BatchGetFreeTrialInfoResponse' :: BatchGetFreeTrialInfoResponse -> [FreeTrialAccountInfo]
accounts} -> [FreeTrialAccountInfo]
accounts) (\s :: BatchGetFreeTrialInfoResponse
s@BatchGetFreeTrialInfoResponse' {} [FreeTrialAccountInfo]
a -> BatchGetFreeTrialInfoResponse
s {$sel:accounts:BatchGetFreeTrialInfoResponse' :: [FreeTrialAccountInfo]
accounts = [FreeTrialAccountInfo]
a} :: BatchGetFreeTrialInfoResponse) 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
batchGetFreeTrialInfoResponse_failedAccounts :: Lens.Lens' BatchGetFreeTrialInfoResponse [FreeTrialInfoError]
batchGetFreeTrialInfoResponse_failedAccounts :: Lens' BatchGetFreeTrialInfoResponse [FreeTrialInfoError]
batchGetFreeTrialInfoResponse_failedAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFreeTrialInfoResponse' {[FreeTrialInfoError]
failedAccounts :: [FreeTrialInfoError]
$sel:failedAccounts:BatchGetFreeTrialInfoResponse' :: BatchGetFreeTrialInfoResponse -> [FreeTrialInfoError]
failedAccounts} -> [FreeTrialInfoError]
failedAccounts) (\s :: BatchGetFreeTrialInfoResponse
s@BatchGetFreeTrialInfoResponse' {} [FreeTrialInfoError]
a -> BatchGetFreeTrialInfoResponse
s {$sel:failedAccounts:BatchGetFreeTrialInfoResponse' :: [FreeTrialInfoError]
failedAccounts = [FreeTrialInfoError]
a} :: BatchGetFreeTrialInfoResponse) 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 BatchGetFreeTrialInfoResponse where
rnf :: BatchGetFreeTrialInfoResponse -> ()
rnf BatchGetFreeTrialInfoResponse' {Int
[FreeTrialInfoError]
[FreeTrialAccountInfo]
failedAccounts :: [FreeTrialInfoError]
accounts :: [FreeTrialAccountInfo]
httpStatus :: Int
$sel:failedAccounts:BatchGetFreeTrialInfoResponse' :: BatchGetFreeTrialInfoResponse -> [FreeTrialInfoError]
$sel:accounts:BatchGetFreeTrialInfoResponse' :: BatchGetFreeTrialInfoResponse -> [FreeTrialAccountInfo]
$sel:httpStatus:BatchGetFreeTrialInfoResponse' :: BatchGetFreeTrialInfoResponse -> Int
..} =
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 [FreeTrialAccountInfo]
accounts
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [FreeTrialInfoError]
failedAccounts