{-# 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.CreateVariable
(
CreateVariable (..),
newCreateVariable,
createVariable_variableType,
createVariable_description,
createVariable_tags,
createVariable_name,
createVariable_dataType,
createVariable_dataSource,
createVariable_defaultValue,
CreateVariableResponse (..),
newCreateVariableResponse,
createVariableResponse_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 CreateVariable = CreateVariable'
{
CreateVariable -> Maybe Text
variableType :: Prelude.Maybe Prelude.Text,
CreateVariable -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateVariable -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateVariable -> Text
name :: Prelude.Text,
CreateVariable -> DataType
dataType :: DataType,
CreateVariable -> DataSource
dataSource :: DataSource,
CreateVariable -> Text
defaultValue :: Prelude.Text
}
deriving (CreateVariable -> CreateVariable -> Bool
(CreateVariable -> CreateVariable -> Bool)
-> (CreateVariable -> CreateVariable -> Bool) -> Eq CreateVariable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVariable -> CreateVariable -> Bool
$c/= :: CreateVariable -> CreateVariable -> Bool
== :: CreateVariable -> CreateVariable -> Bool
$c== :: CreateVariable -> CreateVariable -> Bool
Prelude.Eq, ReadPrec [CreateVariable]
ReadPrec CreateVariable
Int -> ReadS CreateVariable
ReadS [CreateVariable]
(Int -> ReadS CreateVariable)
-> ReadS [CreateVariable]
-> ReadPrec CreateVariable
-> ReadPrec [CreateVariable]
-> Read CreateVariable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVariable]
$creadListPrec :: ReadPrec [CreateVariable]
readPrec :: ReadPrec CreateVariable
$creadPrec :: ReadPrec CreateVariable
readList :: ReadS [CreateVariable]
$creadList :: ReadS [CreateVariable]
readsPrec :: Int -> ReadS CreateVariable
$creadsPrec :: Int -> ReadS CreateVariable
Prelude.Read, Int -> CreateVariable -> ShowS
[CreateVariable] -> ShowS
CreateVariable -> String
(Int -> CreateVariable -> ShowS)
-> (CreateVariable -> String)
-> ([CreateVariable] -> ShowS)
-> Show CreateVariable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVariable] -> ShowS
$cshowList :: [CreateVariable] -> ShowS
show :: CreateVariable -> String
$cshow :: CreateVariable -> String
showsPrec :: Int -> CreateVariable -> ShowS
$cshowsPrec :: Int -> CreateVariable -> ShowS
Prelude.Show, (forall x. CreateVariable -> Rep CreateVariable x)
-> (forall x. Rep CreateVariable x -> CreateVariable)
-> Generic CreateVariable
forall x. Rep CreateVariable x -> CreateVariable
forall x. CreateVariable -> Rep CreateVariable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVariable x -> CreateVariable
$cfrom :: forall x. CreateVariable -> Rep CreateVariable x
Prelude.Generic)
newCreateVariable ::
Prelude.Text ->
DataType ->
DataSource ->
Prelude.Text ->
CreateVariable
newCreateVariable :: Text -> DataType -> DataSource -> Text -> CreateVariable
newCreateVariable
Text
pName_
DataType
pDataType_
DataSource
pDataSource_
Text
pDefaultValue_ =
CreateVariable' :: Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> DataType
-> DataSource
-> Text
-> CreateVariable
CreateVariable'
{ $sel:variableType:CreateVariable' :: Maybe Text
variableType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateVariable' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateVariable' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateVariable' :: Text
name = Text
pName_,
$sel:dataType:CreateVariable' :: DataType
dataType = DataType
pDataType_,
$sel:dataSource:CreateVariable' :: DataSource
dataSource = DataSource
pDataSource_,
$sel:defaultValue:CreateVariable' :: Text
defaultValue = Text
pDefaultValue_
}
createVariable_variableType :: Lens.Lens' CreateVariable (Prelude.Maybe Prelude.Text)
createVariable_variableType :: (Maybe Text -> f (Maybe Text))
-> CreateVariable -> f CreateVariable
createVariable_variableType = (CreateVariable -> Maybe Text)
-> (CreateVariable -> Maybe Text -> CreateVariable)
-> Lens CreateVariable CreateVariable (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {Maybe Text
variableType :: Maybe Text
$sel:variableType:CreateVariable' :: CreateVariable -> Maybe Text
variableType} -> Maybe Text
variableType) (\s :: CreateVariable
s@CreateVariable' {} Maybe Text
a -> CreateVariable
s {$sel:variableType:CreateVariable' :: Maybe Text
variableType = Maybe Text
a} :: CreateVariable)
createVariable_description :: Lens.Lens' CreateVariable (Prelude.Maybe Prelude.Text)
createVariable_description :: (Maybe Text -> f (Maybe Text))
-> CreateVariable -> f CreateVariable
createVariable_description = (CreateVariable -> Maybe Text)
-> (CreateVariable -> Maybe Text -> CreateVariable)
-> Lens CreateVariable CreateVariable (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {Maybe Text
description :: Maybe Text
$sel:description:CreateVariable' :: CreateVariable -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateVariable
s@CreateVariable' {} Maybe Text
a -> CreateVariable
s {$sel:description:CreateVariable' :: Maybe Text
description = Maybe Text
a} :: CreateVariable)
createVariable_tags :: Lens.Lens' CreateVariable (Prelude.Maybe [Tag])
createVariable_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateVariable -> f CreateVariable
createVariable_tags = (CreateVariable -> Maybe [Tag])
-> (CreateVariable -> Maybe [Tag] -> CreateVariable)
-> Lens CreateVariable CreateVariable (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateVariable' :: CreateVariable -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateVariable
s@CreateVariable' {} Maybe [Tag]
a -> CreateVariable
s {$sel:tags:CreateVariable' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateVariable) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateVariable -> f CreateVariable)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateVariable
-> f CreateVariable
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
createVariable_name :: Lens.Lens' CreateVariable Prelude.Text
createVariable_name :: (Text -> f Text) -> CreateVariable -> f CreateVariable
createVariable_name = (CreateVariable -> Text)
-> (CreateVariable -> Text -> CreateVariable)
-> Lens CreateVariable CreateVariable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {Text
name :: Text
$sel:name:CreateVariable' :: CreateVariable -> Text
name} -> Text
name) (\s :: CreateVariable
s@CreateVariable' {} Text
a -> CreateVariable
s {$sel:name:CreateVariable' :: Text
name = Text
a} :: CreateVariable)
createVariable_dataType :: Lens.Lens' CreateVariable DataType
createVariable_dataType :: (DataType -> f DataType) -> CreateVariable -> f CreateVariable
createVariable_dataType = (CreateVariable -> DataType)
-> (CreateVariable -> DataType -> CreateVariable)
-> Lens CreateVariable CreateVariable DataType DataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {DataType
dataType :: DataType
$sel:dataType:CreateVariable' :: CreateVariable -> DataType
dataType} -> DataType
dataType) (\s :: CreateVariable
s@CreateVariable' {} DataType
a -> CreateVariable
s {$sel:dataType:CreateVariable' :: DataType
dataType = DataType
a} :: CreateVariable)
createVariable_dataSource :: Lens.Lens' CreateVariable DataSource
createVariable_dataSource :: (DataSource -> f DataSource) -> CreateVariable -> f CreateVariable
createVariable_dataSource = (CreateVariable -> DataSource)
-> (CreateVariable -> DataSource -> CreateVariable)
-> Lens CreateVariable CreateVariable DataSource DataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {DataSource
dataSource :: DataSource
$sel:dataSource:CreateVariable' :: CreateVariable -> DataSource
dataSource} -> DataSource
dataSource) (\s :: CreateVariable
s@CreateVariable' {} DataSource
a -> CreateVariable
s {$sel:dataSource:CreateVariable' :: DataSource
dataSource = DataSource
a} :: CreateVariable)
createVariable_defaultValue :: Lens.Lens' CreateVariable Prelude.Text
createVariable_defaultValue :: (Text -> f Text) -> CreateVariable -> f CreateVariable
createVariable_defaultValue = (CreateVariable -> Text)
-> (CreateVariable -> Text -> CreateVariable)
-> Lens CreateVariable CreateVariable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariable' {Text
defaultValue :: Text
$sel:defaultValue:CreateVariable' :: CreateVariable -> Text
defaultValue} -> Text
defaultValue) (\s :: CreateVariable
s@CreateVariable' {} Text
a -> CreateVariable
s {$sel:defaultValue:CreateVariable' :: Text
defaultValue = Text
a} :: CreateVariable)
instance Core.AWSRequest CreateVariable where
type
AWSResponse CreateVariable =
CreateVariableResponse
request :: CreateVariable -> Request CreateVariable
request = Service -> CreateVariable -> Request CreateVariable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateVariable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateVariable)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateVariable))
-> Logger
-> Service
-> Proxy CreateVariable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateVariable)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreateVariableResponse
CreateVariableResponse'
(Int -> CreateVariableResponse)
-> Either String Int -> Either String CreateVariableResponse
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))
)
instance Prelude.Hashable CreateVariable
instance Prelude.NFData CreateVariable
instance Core.ToHeaders CreateVariable where
toHeaders :: CreateVariable -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateVariable -> 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.CreateVariable" ::
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 CreateVariable where
toJSON :: CreateVariable -> Value
toJSON CreateVariable' {Maybe [Tag]
Maybe Text
Text
DataSource
DataType
defaultValue :: Text
dataSource :: DataSource
dataType :: DataType
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
variableType :: Maybe Text
$sel:defaultValue:CreateVariable' :: CreateVariable -> Text
$sel:dataSource:CreateVariable' :: CreateVariable -> DataSource
$sel:dataType:CreateVariable' :: CreateVariable -> DataType
$sel:name:CreateVariable' :: CreateVariable -> Text
$sel:tags:CreateVariable' :: CreateVariable -> Maybe [Tag]
$sel:description:CreateVariable' :: CreateVariable -> Maybe Text
$sel:variableType:CreateVariable' :: CreateVariable -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"variableType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
variableType,
(Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> 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 (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataType" Text -> DataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataType
dataType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataSource" Text -> DataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataSource
dataSource),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"defaultValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
defaultValue)
]
)
instance Core.ToPath CreateVariable where
toPath :: CreateVariable -> ByteString
toPath = ByteString -> CreateVariable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateVariable where
toQuery :: CreateVariable -> QueryString
toQuery = QueryString -> CreateVariable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateVariableResponse = CreateVariableResponse'
{
CreateVariableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateVariableResponse -> CreateVariableResponse -> Bool
(CreateVariableResponse -> CreateVariableResponse -> Bool)
-> (CreateVariableResponse -> CreateVariableResponse -> Bool)
-> Eq CreateVariableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVariableResponse -> CreateVariableResponse -> Bool
$c/= :: CreateVariableResponse -> CreateVariableResponse -> Bool
== :: CreateVariableResponse -> CreateVariableResponse -> Bool
$c== :: CreateVariableResponse -> CreateVariableResponse -> Bool
Prelude.Eq, ReadPrec [CreateVariableResponse]
ReadPrec CreateVariableResponse
Int -> ReadS CreateVariableResponse
ReadS [CreateVariableResponse]
(Int -> ReadS CreateVariableResponse)
-> ReadS [CreateVariableResponse]
-> ReadPrec CreateVariableResponse
-> ReadPrec [CreateVariableResponse]
-> Read CreateVariableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVariableResponse]
$creadListPrec :: ReadPrec [CreateVariableResponse]
readPrec :: ReadPrec CreateVariableResponse
$creadPrec :: ReadPrec CreateVariableResponse
readList :: ReadS [CreateVariableResponse]
$creadList :: ReadS [CreateVariableResponse]
readsPrec :: Int -> ReadS CreateVariableResponse
$creadsPrec :: Int -> ReadS CreateVariableResponse
Prelude.Read, Int -> CreateVariableResponse -> ShowS
[CreateVariableResponse] -> ShowS
CreateVariableResponse -> String
(Int -> CreateVariableResponse -> ShowS)
-> (CreateVariableResponse -> String)
-> ([CreateVariableResponse] -> ShowS)
-> Show CreateVariableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVariableResponse] -> ShowS
$cshowList :: [CreateVariableResponse] -> ShowS
show :: CreateVariableResponse -> String
$cshow :: CreateVariableResponse -> String
showsPrec :: Int -> CreateVariableResponse -> ShowS
$cshowsPrec :: Int -> CreateVariableResponse -> ShowS
Prelude.Show, (forall x. CreateVariableResponse -> Rep CreateVariableResponse x)
-> (forall x.
Rep CreateVariableResponse x -> CreateVariableResponse)
-> Generic CreateVariableResponse
forall x. Rep CreateVariableResponse x -> CreateVariableResponse
forall x. CreateVariableResponse -> Rep CreateVariableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVariableResponse x -> CreateVariableResponse
$cfrom :: forall x. CreateVariableResponse -> Rep CreateVariableResponse x
Prelude.Generic)
newCreateVariableResponse ::
Prelude.Int ->
CreateVariableResponse
newCreateVariableResponse :: Int -> CreateVariableResponse
newCreateVariableResponse Int
pHttpStatus_ =
CreateVariableResponse' :: Int -> CreateVariableResponse
CreateVariableResponse' {$sel:httpStatus:CreateVariableResponse' :: Int
httpStatus = Int
pHttpStatus_}
createVariableResponse_httpStatus :: Lens.Lens' CreateVariableResponse Prelude.Int
createVariableResponse_httpStatus :: (Int -> f Int)
-> CreateVariableResponse -> f CreateVariableResponse
createVariableResponse_httpStatus = (CreateVariableResponse -> Int)
-> (CreateVariableResponse -> Int -> CreateVariableResponse)
-> Lens CreateVariableResponse CreateVariableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVariableResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateVariableResponse' :: CreateVariableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateVariableResponse
s@CreateVariableResponse' {} Int
a -> CreateVariableResponse
s {$sel:httpStatus:CreateVariableResponse' :: Int
httpStatus = Int
a} :: CreateVariableResponse)
instance Prelude.NFData CreateVariableResponse