{-# 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.BatchCreateVariable
(
BatchCreateVariable (..),
newBatchCreateVariable,
batchCreateVariable_tags,
batchCreateVariable_variableEntries,
BatchCreateVariableResponse (..),
newBatchCreateVariableResponse,
batchCreateVariableResponse_errors,
batchCreateVariableResponse_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 BatchCreateVariable = BatchCreateVariable'
{
BatchCreateVariable -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
BatchCreateVariable -> NonEmpty VariableEntry
variableEntries :: Prelude.NonEmpty VariableEntry
}
deriving (BatchCreateVariable -> BatchCreateVariable -> Bool
(BatchCreateVariable -> BatchCreateVariable -> Bool)
-> (BatchCreateVariable -> BatchCreateVariable -> Bool)
-> Eq BatchCreateVariable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateVariable -> BatchCreateVariable -> Bool
$c/= :: BatchCreateVariable -> BatchCreateVariable -> Bool
== :: BatchCreateVariable -> BatchCreateVariable -> Bool
$c== :: BatchCreateVariable -> BatchCreateVariable -> Bool
Prelude.Eq, ReadPrec [BatchCreateVariable]
ReadPrec BatchCreateVariable
Int -> ReadS BatchCreateVariable
ReadS [BatchCreateVariable]
(Int -> ReadS BatchCreateVariable)
-> ReadS [BatchCreateVariable]
-> ReadPrec BatchCreateVariable
-> ReadPrec [BatchCreateVariable]
-> Read BatchCreateVariable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateVariable]
$creadListPrec :: ReadPrec [BatchCreateVariable]
readPrec :: ReadPrec BatchCreateVariable
$creadPrec :: ReadPrec BatchCreateVariable
readList :: ReadS [BatchCreateVariable]
$creadList :: ReadS [BatchCreateVariable]
readsPrec :: Int -> ReadS BatchCreateVariable
$creadsPrec :: Int -> ReadS BatchCreateVariable
Prelude.Read, Int -> BatchCreateVariable -> ShowS
[BatchCreateVariable] -> ShowS
BatchCreateVariable -> String
(Int -> BatchCreateVariable -> ShowS)
-> (BatchCreateVariable -> String)
-> ([BatchCreateVariable] -> ShowS)
-> Show BatchCreateVariable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateVariable] -> ShowS
$cshowList :: [BatchCreateVariable] -> ShowS
show :: BatchCreateVariable -> String
$cshow :: BatchCreateVariable -> String
showsPrec :: Int -> BatchCreateVariable -> ShowS
$cshowsPrec :: Int -> BatchCreateVariable -> ShowS
Prelude.Show, (forall x. BatchCreateVariable -> Rep BatchCreateVariable x)
-> (forall x. Rep BatchCreateVariable x -> BatchCreateVariable)
-> Generic BatchCreateVariable
forall x. Rep BatchCreateVariable x -> BatchCreateVariable
forall x. BatchCreateVariable -> Rep BatchCreateVariable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchCreateVariable x -> BatchCreateVariable
$cfrom :: forall x. BatchCreateVariable -> Rep BatchCreateVariable x
Prelude.Generic)
newBatchCreateVariable ::
Prelude.NonEmpty VariableEntry ->
BatchCreateVariable
newBatchCreateVariable :: NonEmpty VariableEntry -> BatchCreateVariable
newBatchCreateVariable NonEmpty VariableEntry
pVariableEntries_ =
BatchCreateVariable' :: Maybe [Tag] -> NonEmpty VariableEntry -> BatchCreateVariable
BatchCreateVariable'
{ $sel:tags:BatchCreateVariable' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:variableEntries:BatchCreateVariable' :: NonEmpty VariableEntry
variableEntries =
Tagged (NonEmpty VariableEntry) (Identity (NonEmpty VariableEntry))
-> Tagged
(NonEmpty VariableEntry) (Identity (NonEmpty VariableEntry))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty VariableEntry) (Identity (NonEmpty VariableEntry))
-> Tagged
(NonEmpty VariableEntry) (Identity (NonEmpty VariableEntry)))
-> NonEmpty VariableEntry -> NonEmpty VariableEntry
forall t b. AReview t b -> b -> t
Lens.# NonEmpty VariableEntry
pVariableEntries_
}
batchCreateVariable_tags :: Lens.Lens' BatchCreateVariable (Prelude.Maybe [Tag])
batchCreateVariable_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> BatchCreateVariable -> f BatchCreateVariable
batchCreateVariable_tags = (BatchCreateVariable -> Maybe [Tag])
-> (BatchCreateVariable -> Maybe [Tag] -> BatchCreateVariable)
-> Lens
BatchCreateVariable BatchCreateVariable (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateVariable' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:BatchCreateVariable' :: BatchCreateVariable -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: BatchCreateVariable
s@BatchCreateVariable' {} Maybe [Tag]
a -> BatchCreateVariable
s {$sel:tags:BatchCreateVariable' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: BatchCreateVariable) ((Maybe [Tag] -> f (Maybe [Tag]))
-> BatchCreateVariable -> f BatchCreateVariable)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> BatchCreateVariable
-> f BatchCreateVariable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchCreateVariable_variableEntries :: Lens.Lens' BatchCreateVariable (Prelude.NonEmpty VariableEntry)
batchCreateVariable_variableEntries :: (NonEmpty VariableEntry -> f (NonEmpty VariableEntry))
-> BatchCreateVariable -> f BatchCreateVariable
batchCreateVariable_variableEntries = (BatchCreateVariable -> NonEmpty VariableEntry)
-> (BatchCreateVariable
-> NonEmpty VariableEntry -> BatchCreateVariable)
-> Lens
BatchCreateVariable
BatchCreateVariable
(NonEmpty VariableEntry)
(NonEmpty VariableEntry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateVariable' {NonEmpty VariableEntry
variableEntries :: NonEmpty VariableEntry
$sel:variableEntries:BatchCreateVariable' :: BatchCreateVariable -> NonEmpty VariableEntry
variableEntries} -> NonEmpty VariableEntry
variableEntries) (\s :: BatchCreateVariable
s@BatchCreateVariable' {} NonEmpty VariableEntry
a -> BatchCreateVariable
s {$sel:variableEntries:BatchCreateVariable' :: NonEmpty VariableEntry
variableEntries = NonEmpty VariableEntry
a} :: BatchCreateVariable) ((NonEmpty VariableEntry -> f (NonEmpty VariableEntry))
-> BatchCreateVariable -> f BatchCreateVariable)
-> ((NonEmpty VariableEntry -> f (NonEmpty VariableEntry))
-> NonEmpty VariableEntry -> f (NonEmpty VariableEntry))
-> (NonEmpty VariableEntry -> f (NonEmpty VariableEntry))
-> BatchCreateVariable
-> f BatchCreateVariable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty VariableEntry -> f (NonEmpty VariableEntry))
-> NonEmpty VariableEntry -> f (NonEmpty VariableEntry)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchCreateVariable where
type
AWSResponse BatchCreateVariable =
BatchCreateVariableResponse
request :: BatchCreateVariable -> Request BatchCreateVariable
request = Service -> BatchCreateVariable -> Request BatchCreateVariable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchCreateVariable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateVariable)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchCreateVariable))
-> Logger
-> Service
-> Proxy BatchCreateVariable
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateVariable)))
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 [BatchCreateVariableError]
-> Int -> BatchCreateVariableResponse
BatchCreateVariableResponse'
(Maybe [BatchCreateVariableError]
-> Int -> BatchCreateVariableResponse)
-> Either String (Maybe [BatchCreateVariableError])
-> Either String (Int -> BatchCreateVariableResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key -> Either String (Maybe (Maybe [BatchCreateVariableError]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"errors" Either String (Maybe (Maybe [BatchCreateVariableError]))
-> Maybe [BatchCreateVariableError]
-> Either String (Maybe [BatchCreateVariableError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchCreateVariableError]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchCreateVariableResponse)
-> Either String Int -> Either String BatchCreateVariableResponse
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 BatchCreateVariable
instance Prelude.NFData BatchCreateVariable
instance Core.ToHeaders BatchCreateVariable where
toHeaders :: BatchCreateVariable -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchCreateVariable -> 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.BatchCreateVariable" ::
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 BatchCreateVariable where
toJSON :: BatchCreateVariable -> Value
toJSON BatchCreateVariable' {Maybe [Tag]
NonEmpty VariableEntry
variableEntries :: NonEmpty VariableEntry
tags :: Maybe [Tag]
$sel:variableEntries:BatchCreateVariable' :: BatchCreateVariable -> NonEmpty VariableEntry
$sel:tags:BatchCreateVariable' :: BatchCreateVariable -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"tags" Key -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Key
"variableEntries" Key -> NonEmpty VariableEntry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty VariableEntry
variableEntries)
]
)
instance Core.ToPath BatchCreateVariable where
toPath :: BatchCreateVariable -> ByteString
toPath = ByteString -> BatchCreateVariable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchCreateVariable where
toQuery :: BatchCreateVariable -> QueryString
toQuery = QueryString -> BatchCreateVariable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchCreateVariableResponse = BatchCreateVariableResponse'
{
BatchCreateVariableResponse -> Maybe [BatchCreateVariableError]
errors :: Prelude.Maybe [BatchCreateVariableError],
BatchCreateVariableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchCreateVariableResponse -> BatchCreateVariableResponse -> Bool
(BatchCreateVariableResponse
-> BatchCreateVariableResponse -> Bool)
-> (BatchCreateVariableResponse
-> BatchCreateVariableResponse -> Bool)
-> Eq BatchCreateVariableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateVariableResponse -> BatchCreateVariableResponse -> Bool
$c/= :: BatchCreateVariableResponse -> BatchCreateVariableResponse -> Bool
== :: BatchCreateVariableResponse -> BatchCreateVariableResponse -> Bool
$c== :: BatchCreateVariableResponse -> BatchCreateVariableResponse -> Bool
Prelude.Eq, ReadPrec [BatchCreateVariableResponse]
ReadPrec BatchCreateVariableResponse
Int -> ReadS BatchCreateVariableResponse
ReadS [BatchCreateVariableResponse]
(Int -> ReadS BatchCreateVariableResponse)
-> ReadS [BatchCreateVariableResponse]
-> ReadPrec BatchCreateVariableResponse
-> ReadPrec [BatchCreateVariableResponse]
-> Read BatchCreateVariableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateVariableResponse]
$creadListPrec :: ReadPrec [BatchCreateVariableResponse]
readPrec :: ReadPrec BatchCreateVariableResponse
$creadPrec :: ReadPrec BatchCreateVariableResponse
readList :: ReadS [BatchCreateVariableResponse]
$creadList :: ReadS [BatchCreateVariableResponse]
readsPrec :: Int -> ReadS BatchCreateVariableResponse
$creadsPrec :: Int -> ReadS BatchCreateVariableResponse
Prelude.Read, Int -> BatchCreateVariableResponse -> ShowS
[BatchCreateVariableResponse] -> ShowS
BatchCreateVariableResponse -> String
(Int -> BatchCreateVariableResponse -> ShowS)
-> (BatchCreateVariableResponse -> String)
-> ([BatchCreateVariableResponse] -> ShowS)
-> Show BatchCreateVariableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateVariableResponse] -> ShowS
$cshowList :: [BatchCreateVariableResponse] -> ShowS
show :: BatchCreateVariableResponse -> String
$cshow :: BatchCreateVariableResponse -> String
showsPrec :: Int -> BatchCreateVariableResponse -> ShowS
$cshowsPrec :: Int -> BatchCreateVariableResponse -> ShowS
Prelude.Show, (forall x.
BatchCreateVariableResponse -> Rep BatchCreateVariableResponse x)
-> (forall x.
Rep BatchCreateVariableResponse x -> BatchCreateVariableResponse)
-> Generic BatchCreateVariableResponse
forall x.
Rep BatchCreateVariableResponse x -> BatchCreateVariableResponse
forall x.
BatchCreateVariableResponse -> Rep BatchCreateVariableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateVariableResponse x -> BatchCreateVariableResponse
$cfrom :: forall x.
BatchCreateVariableResponse -> Rep BatchCreateVariableResponse x
Prelude.Generic)
newBatchCreateVariableResponse ::
Prelude.Int ->
BatchCreateVariableResponse
newBatchCreateVariableResponse :: Int -> BatchCreateVariableResponse
newBatchCreateVariableResponse Int
pHttpStatus_ =
BatchCreateVariableResponse' :: Maybe [BatchCreateVariableError]
-> Int -> BatchCreateVariableResponse
BatchCreateVariableResponse'
{ $sel:errors:BatchCreateVariableResponse' :: Maybe [BatchCreateVariableError]
errors =
Maybe [BatchCreateVariableError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchCreateVariableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchCreateVariableResponse_errors :: Lens.Lens' BatchCreateVariableResponse (Prelude.Maybe [BatchCreateVariableError])
batchCreateVariableResponse_errors :: (Maybe [BatchCreateVariableError]
-> f (Maybe [BatchCreateVariableError]))
-> BatchCreateVariableResponse -> f BatchCreateVariableResponse
batchCreateVariableResponse_errors = (BatchCreateVariableResponse -> Maybe [BatchCreateVariableError])
-> (BatchCreateVariableResponse
-> Maybe [BatchCreateVariableError] -> BatchCreateVariableResponse)
-> Lens
BatchCreateVariableResponse
BatchCreateVariableResponse
(Maybe [BatchCreateVariableError])
(Maybe [BatchCreateVariableError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateVariableResponse' {Maybe [BatchCreateVariableError]
errors :: Maybe [BatchCreateVariableError]
$sel:errors:BatchCreateVariableResponse' :: BatchCreateVariableResponse -> Maybe [BatchCreateVariableError]
errors} -> Maybe [BatchCreateVariableError]
errors) (\s :: BatchCreateVariableResponse
s@BatchCreateVariableResponse' {} Maybe [BatchCreateVariableError]
a -> BatchCreateVariableResponse
s {$sel:errors:BatchCreateVariableResponse' :: Maybe [BatchCreateVariableError]
errors = Maybe [BatchCreateVariableError]
a} :: BatchCreateVariableResponse) ((Maybe [BatchCreateVariableError]
-> f (Maybe [BatchCreateVariableError]))
-> BatchCreateVariableResponse -> f BatchCreateVariableResponse)
-> ((Maybe [BatchCreateVariableError]
-> f (Maybe [BatchCreateVariableError]))
-> Maybe [BatchCreateVariableError]
-> f (Maybe [BatchCreateVariableError]))
-> (Maybe [BatchCreateVariableError]
-> f (Maybe [BatchCreateVariableError]))
-> BatchCreateVariableResponse
-> f BatchCreateVariableResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BatchCreateVariableError]
[BatchCreateVariableError]
[BatchCreateVariableError]
[BatchCreateVariableError]
-> Iso
(Maybe [BatchCreateVariableError])
(Maybe [BatchCreateVariableError])
(Maybe [BatchCreateVariableError])
(Maybe [BatchCreateVariableError])
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
[BatchCreateVariableError]
[BatchCreateVariableError]
[BatchCreateVariableError]
[BatchCreateVariableError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchCreateVariableResponse_httpStatus :: Lens.Lens' BatchCreateVariableResponse Prelude.Int
batchCreateVariableResponse_httpStatus :: (Int -> f Int)
-> BatchCreateVariableResponse -> f BatchCreateVariableResponse
batchCreateVariableResponse_httpStatus = (BatchCreateVariableResponse -> Int)
-> (BatchCreateVariableResponse
-> Int -> BatchCreateVariableResponse)
-> Lens
BatchCreateVariableResponse BatchCreateVariableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateVariableResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchCreateVariableResponse' :: BatchCreateVariableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchCreateVariableResponse
s@BatchCreateVariableResponse' {} Int
a -> BatchCreateVariableResponse
s {$sel:httpStatus:BatchCreateVariableResponse' :: Int
httpStatus = Int
a} :: BatchCreateVariableResponse)
instance Prelude.NFData BatchCreateVariableResponse