{-# 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.FraudDetector.BatchGetVariable
(
BatchGetVariable (..),
newBatchGetVariable,
batchGetVariable_names,
BatchGetVariableResponse (..),
newBatchGetVariableResponse,
batchGetVariableResponse_variables,
batchGetVariableResponse_errors,
batchGetVariableResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.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 BatchGetVariable = BatchGetVariable'
{
BatchGetVariable -> NonEmpty Text
names :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetVariable -> BatchGetVariable -> Bool
(BatchGetVariable -> BatchGetVariable -> Bool)
-> (BatchGetVariable -> BatchGetVariable -> Bool)
-> Eq BatchGetVariable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetVariable -> BatchGetVariable -> Bool
$c/= :: BatchGetVariable -> BatchGetVariable -> Bool
== :: BatchGetVariable -> BatchGetVariable -> Bool
$c== :: BatchGetVariable -> BatchGetVariable -> Bool
Prelude.Eq, ReadPrec [BatchGetVariable]
ReadPrec BatchGetVariable
Int -> ReadS BatchGetVariable
ReadS [BatchGetVariable]
(Int -> ReadS BatchGetVariable)
-> ReadS [BatchGetVariable]
-> ReadPrec BatchGetVariable
-> ReadPrec [BatchGetVariable]
-> Read BatchGetVariable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetVariable]
$creadListPrec :: ReadPrec [BatchGetVariable]
readPrec :: ReadPrec BatchGetVariable
$creadPrec :: ReadPrec BatchGetVariable
readList :: ReadS [BatchGetVariable]
$creadList :: ReadS [BatchGetVariable]
readsPrec :: Int -> ReadS BatchGetVariable
$creadsPrec :: Int -> ReadS BatchGetVariable
Prelude.Read, Int -> BatchGetVariable -> ShowS
[BatchGetVariable] -> ShowS
BatchGetVariable -> String
(Int -> BatchGetVariable -> ShowS)
-> (BatchGetVariable -> String)
-> ([BatchGetVariable] -> ShowS)
-> Show BatchGetVariable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetVariable] -> ShowS
$cshowList :: [BatchGetVariable] -> ShowS
show :: BatchGetVariable -> String
$cshow :: BatchGetVariable -> String
showsPrec :: Int -> BatchGetVariable -> ShowS
$cshowsPrec :: Int -> BatchGetVariable -> ShowS
Prelude.Show, (forall x. BatchGetVariable -> Rep BatchGetVariable x)
-> (forall x. Rep BatchGetVariable x -> BatchGetVariable)
-> Generic BatchGetVariable
forall x. Rep BatchGetVariable x -> BatchGetVariable
forall x. BatchGetVariable -> Rep BatchGetVariable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetVariable x -> BatchGetVariable
$cfrom :: forall x. BatchGetVariable -> Rep BatchGetVariable x
Prelude.Generic)
newBatchGetVariable ::
Prelude.NonEmpty Prelude.Text ->
BatchGetVariable
newBatchGetVariable :: NonEmpty Text -> BatchGetVariable
newBatchGetVariable NonEmpty Text
pNames_ =
BatchGetVariable' :: NonEmpty Text -> BatchGetVariable
BatchGetVariable'
{ $sel:names:BatchGetVariable' :: NonEmpty Text
names =
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
pNames_
}
batchGetVariable_names :: Lens.Lens' BatchGetVariable (Prelude.NonEmpty Prelude.Text)
batchGetVariable_names :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetVariable -> f BatchGetVariable
batchGetVariable_names = (BatchGetVariable -> NonEmpty Text)
-> (BatchGetVariable -> NonEmpty Text -> BatchGetVariable)
-> Lens
BatchGetVariable BatchGetVariable (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetVariable' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetVariable' :: BatchGetVariable -> NonEmpty Text
names} -> NonEmpty Text
names) (\s :: BatchGetVariable
s@BatchGetVariable' {} NonEmpty Text
a -> BatchGetVariable
s {$sel:names:BatchGetVariable' :: NonEmpty Text
names = NonEmpty Text
a} :: BatchGetVariable) ((NonEmpty Text -> f (NonEmpty Text))
-> BatchGetVariable -> f BatchGetVariable)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetVariable
-> f BatchGetVariable
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 BatchGetVariable where
type
AWSResponse BatchGetVariable =
BatchGetVariableResponse
request :: BatchGetVariable -> Request BatchGetVariable
request = Service -> BatchGetVariable -> Request BatchGetVariable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchGetVariable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetVariable)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchGetVariable))
-> Logger
-> Service
-> Proxy BatchGetVariable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetVariable)))
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 [Variable]
-> Maybe [BatchGetVariableError] -> Int -> BatchGetVariableResponse
BatchGetVariableResponse'
(Maybe [Variable]
-> Maybe [BatchGetVariableError]
-> Int
-> BatchGetVariableResponse)
-> Either String (Maybe [Variable])
-> Either
String
(Maybe [BatchGetVariableError] -> Int -> BatchGetVariableResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Variable]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"variables" Either String (Maybe (Maybe [Variable]))
-> Maybe [Variable] -> Either String (Maybe [Variable])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Variable]
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Maybe [BatchGetVariableError] -> Int -> BatchGetVariableResponse)
-> Either String (Maybe [BatchGetVariableError])
-> Either String (Int -> BatchGetVariableResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [BatchGetVariableError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"errors" Either String (Maybe (Maybe [BatchGetVariableError]))
-> Maybe [BatchGetVariableError]
-> Either String (Maybe [BatchGetVariableError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchGetVariableError]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchGetVariableResponse)
-> Either String Int -> Either String BatchGetVariableResponse
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 BatchGetVariable
instance Prelude.NFData BatchGetVariable
instance Core.ToHeaders BatchGetVariable where
toHeaders :: BatchGetVariable -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchGetVariable -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSHawksNestServiceFacade.BatchGetVariable" ::
Prelude.ByteString
),
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 BatchGetVariable where
toJSON :: BatchGetVariable -> Value
toJSON BatchGetVariable' {NonEmpty Text
names :: NonEmpty Text
$sel:names:BatchGetVariable' :: BatchGetVariable -> 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
"names" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
names)]
)
instance Core.ToPath BatchGetVariable where
toPath :: BatchGetVariable -> ByteString
toPath = ByteString -> BatchGetVariable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchGetVariable where
toQuery :: BatchGetVariable -> QueryString
toQuery = QueryString -> BatchGetVariable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchGetVariableResponse = BatchGetVariableResponse'
{
BatchGetVariableResponse -> Maybe [Variable]
variables :: Prelude.Maybe [Variable],
BatchGetVariableResponse -> Maybe [BatchGetVariableError]
errors :: Prelude.Maybe [BatchGetVariableError],
BatchGetVariableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetVariableResponse -> BatchGetVariableResponse -> Bool
(BatchGetVariableResponse -> BatchGetVariableResponse -> Bool)
-> (BatchGetVariableResponse -> BatchGetVariableResponse -> Bool)
-> Eq BatchGetVariableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetVariableResponse -> BatchGetVariableResponse -> Bool
$c/= :: BatchGetVariableResponse -> BatchGetVariableResponse -> Bool
== :: BatchGetVariableResponse -> BatchGetVariableResponse -> Bool
$c== :: BatchGetVariableResponse -> BatchGetVariableResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetVariableResponse]
ReadPrec BatchGetVariableResponse
Int -> ReadS BatchGetVariableResponse
ReadS [BatchGetVariableResponse]
(Int -> ReadS BatchGetVariableResponse)
-> ReadS [BatchGetVariableResponse]
-> ReadPrec BatchGetVariableResponse
-> ReadPrec [BatchGetVariableResponse]
-> Read BatchGetVariableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetVariableResponse]
$creadListPrec :: ReadPrec [BatchGetVariableResponse]
readPrec :: ReadPrec BatchGetVariableResponse
$creadPrec :: ReadPrec BatchGetVariableResponse
readList :: ReadS [BatchGetVariableResponse]
$creadList :: ReadS [BatchGetVariableResponse]
readsPrec :: Int -> ReadS BatchGetVariableResponse
$creadsPrec :: Int -> ReadS BatchGetVariableResponse
Prelude.Read, Int -> BatchGetVariableResponse -> ShowS
[BatchGetVariableResponse] -> ShowS
BatchGetVariableResponse -> String
(Int -> BatchGetVariableResponse -> ShowS)
-> (BatchGetVariableResponse -> String)
-> ([BatchGetVariableResponse] -> ShowS)
-> Show BatchGetVariableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetVariableResponse] -> ShowS
$cshowList :: [BatchGetVariableResponse] -> ShowS
show :: BatchGetVariableResponse -> String
$cshow :: BatchGetVariableResponse -> String
showsPrec :: Int -> BatchGetVariableResponse -> ShowS
$cshowsPrec :: Int -> BatchGetVariableResponse -> ShowS
Prelude.Show, (forall x.
BatchGetVariableResponse -> Rep BatchGetVariableResponse x)
-> (forall x.
Rep BatchGetVariableResponse x -> BatchGetVariableResponse)
-> Generic BatchGetVariableResponse
forall x.
Rep BatchGetVariableResponse x -> BatchGetVariableResponse
forall x.
BatchGetVariableResponse -> Rep BatchGetVariableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetVariableResponse x -> BatchGetVariableResponse
$cfrom :: forall x.
BatchGetVariableResponse -> Rep BatchGetVariableResponse x
Prelude.Generic)
newBatchGetVariableResponse ::
Prelude.Int ->
BatchGetVariableResponse
newBatchGetVariableResponse :: Int -> BatchGetVariableResponse
newBatchGetVariableResponse Int
pHttpStatus_ =
BatchGetVariableResponse' :: Maybe [Variable]
-> Maybe [BatchGetVariableError] -> Int -> BatchGetVariableResponse
BatchGetVariableResponse'
{ $sel:variables:BatchGetVariableResponse' :: Maybe [Variable]
variables =
Maybe [Variable]
forall a. Maybe a
Prelude.Nothing,
$sel:errors:BatchGetVariableResponse' :: Maybe [BatchGetVariableError]
errors = Maybe [BatchGetVariableError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetVariableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetVariableResponse_variables :: Lens.Lens' BatchGetVariableResponse (Prelude.Maybe [Variable])
batchGetVariableResponse_variables :: (Maybe [Variable] -> f (Maybe [Variable]))
-> BatchGetVariableResponse -> f BatchGetVariableResponse
batchGetVariableResponse_variables = (BatchGetVariableResponse -> Maybe [Variable])
-> (BatchGetVariableResponse
-> Maybe [Variable] -> BatchGetVariableResponse)
-> Lens
BatchGetVariableResponse
BatchGetVariableResponse
(Maybe [Variable])
(Maybe [Variable])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetVariableResponse' {Maybe [Variable]
variables :: Maybe [Variable]
$sel:variables:BatchGetVariableResponse' :: BatchGetVariableResponse -> Maybe [Variable]
variables} -> Maybe [Variable]
variables) (\s :: BatchGetVariableResponse
s@BatchGetVariableResponse' {} Maybe [Variable]
a -> BatchGetVariableResponse
s {$sel:variables:BatchGetVariableResponse' :: Maybe [Variable]
variables = Maybe [Variable]
a} :: BatchGetVariableResponse) ((Maybe [Variable] -> f (Maybe [Variable]))
-> BatchGetVariableResponse -> f BatchGetVariableResponse)
-> ((Maybe [Variable] -> f (Maybe [Variable]))
-> Maybe [Variable] -> f (Maybe [Variable]))
-> (Maybe [Variable] -> f (Maybe [Variable]))
-> BatchGetVariableResponse
-> f BatchGetVariableResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Variable] [Variable] [Variable] [Variable]
-> Iso
(Maybe [Variable])
(Maybe [Variable])
(Maybe [Variable])
(Maybe [Variable])
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 [Variable] [Variable] [Variable] [Variable]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetVariableResponse_errors :: Lens.Lens' BatchGetVariableResponse (Prelude.Maybe [BatchGetVariableError])
batchGetVariableResponse_errors :: (Maybe [BatchGetVariableError]
-> f (Maybe [BatchGetVariableError]))
-> BatchGetVariableResponse -> f BatchGetVariableResponse
batchGetVariableResponse_errors = (BatchGetVariableResponse -> Maybe [BatchGetVariableError])
-> (BatchGetVariableResponse
-> Maybe [BatchGetVariableError] -> BatchGetVariableResponse)
-> Lens
BatchGetVariableResponse
BatchGetVariableResponse
(Maybe [BatchGetVariableError])
(Maybe [BatchGetVariableError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetVariableResponse' {Maybe [BatchGetVariableError]
errors :: Maybe [BatchGetVariableError]
$sel:errors:BatchGetVariableResponse' :: BatchGetVariableResponse -> Maybe [BatchGetVariableError]
errors} -> Maybe [BatchGetVariableError]
errors) (\s :: BatchGetVariableResponse
s@BatchGetVariableResponse' {} Maybe [BatchGetVariableError]
a -> BatchGetVariableResponse
s {$sel:errors:BatchGetVariableResponse' :: Maybe [BatchGetVariableError]
errors = Maybe [BatchGetVariableError]
a} :: BatchGetVariableResponse) ((Maybe [BatchGetVariableError]
-> f (Maybe [BatchGetVariableError]))
-> BatchGetVariableResponse -> f BatchGetVariableResponse)
-> ((Maybe [BatchGetVariableError]
-> f (Maybe [BatchGetVariableError]))
-> Maybe [BatchGetVariableError]
-> f (Maybe [BatchGetVariableError]))
-> (Maybe [BatchGetVariableError]
-> f (Maybe [BatchGetVariableError]))
-> BatchGetVariableResponse
-> f BatchGetVariableResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BatchGetVariableError]
[BatchGetVariableError]
[BatchGetVariableError]
[BatchGetVariableError]
-> Iso
(Maybe [BatchGetVariableError])
(Maybe [BatchGetVariableError])
(Maybe [BatchGetVariableError])
(Maybe [BatchGetVariableError])
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
[BatchGetVariableError]
[BatchGetVariableError]
[BatchGetVariableError]
[BatchGetVariableError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetVariableResponse_httpStatus :: Lens.Lens' BatchGetVariableResponse Prelude.Int
batchGetVariableResponse_httpStatus :: (Int -> f Int)
-> BatchGetVariableResponse -> f BatchGetVariableResponse
batchGetVariableResponse_httpStatus = (BatchGetVariableResponse -> Int)
-> (BatchGetVariableResponse -> Int -> BatchGetVariableResponse)
-> Lens BatchGetVariableResponse BatchGetVariableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetVariableResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetVariableResponse' :: BatchGetVariableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetVariableResponse
s@BatchGetVariableResponse' {} Int
a -> BatchGetVariableResponse
s {$sel:httpStatus:BatchGetVariableResponse' :: Int
httpStatus = Int
a} :: BatchGetVariableResponse)
instance Prelude.NFData BatchGetVariableResponse