{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTEvents.CreateDetectorModel
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a detector model.
module Amazonka.IoTEvents.CreateDetectorModel
  ( -- * Creating a Request
    CreateDetectorModel (..),
    newCreateDetectorModel,

    -- * Request Lenses
    createDetectorModel_detectorModelDescription,
    createDetectorModel_key,
    createDetectorModel_evaluationMethod,
    createDetectorModel_tags,
    createDetectorModel_detectorModelName,
    createDetectorModel_detectorModelDefinition,
    createDetectorModel_roleArn,

    -- * Destructuring the Response
    CreateDetectorModelResponse (..),
    newCreateDetectorModelResponse,

    -- * Response Lenses
    createDetectorModelResponse_detectorModelConfiguration,
    createDetectorModelResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.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

-- | /See:/ 'newCreateDetectorModel' smart constructor.
data CreateDetectorModel = CreateDetectorModel'
  { -- | A brief description of the detector model.
    CreateDetectorModel -> Maybe Text
detectorModelDescription :: Prelude.Maybe Prelude.Text,
    -- | The input attribute key used to identify a device or system to create a
    -- detector (an instance of the detector model) and then to route each
    -- input received to the appropriate detector (instance). This parameter
    -- uses a JSON-path expression in the message payload of each input to
    -- specify the attribute-value pair that is used to identify the device
    -- associated with the input.
    CreateDetectorModel -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | Information about the order in which events are evaluated and how
    -- actions are executed.
    CreateDetectorModel -> Maybe EvaluationMethod
evaluationMethod :: Prelude.Maybe EvaluationMethod,
    -- | Metadata that can be used to manage the detector model.
    CreateDetectorModel -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the detector model.
    CreateDetectorModel -> Text
detectorModelName :: Prelude.Text,
    -- | Information that defines how the detectors operate.
    CreateDetectorModel -> DetectorModelDefinition
detectorModelDefinition :: DetectorModelDefinition,
    -- | The ARN of the role that grants permission to AWS IoT Events to perform
    -- its operations.
    CreateDetectorModel -> Text
roleArn :: Prelude.Text
  }
  deriving (CreateDetectorModel -> CreateDetectorModel -> Bool
(CreateDetectorModel -> CreateDetectorModel -> Bool)
-> (CreateDetectorModel -> CreateDetectorModel -> Bool)
-> Eq CreateDetectorModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDetectorModel -> CreateDetectorModel -> Bool
$c/= :: CreateDetectorModel -> CreateDetectorModel -> Bool
== :: CreateDetectorModel -> CreateDetectorModel -> Bool
$c== :: CreateDetectorModel -> CreateDetectorModel -> Bool
Prelude.Eq, ReadPrec [CreateDetectorModel]
ReadPrec CreateDetectorModel
Int -> ReadS CreateDetectorModel
ReadS [CreateDetectorModel]
(Int -> ReadS CreateDetectorModel)
-> ReadS [CreateDetectorModel]
-> ReadPrec CreateDetectorModel
-> ReadPrec [CreateDetectorModel]
-> Read CreateDetectorModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDetectorModel]
$creadListPrec :: ReadPrec [CreateDetectorModel]
readPrec :: ReadPrec CreateDetectorModel
$creadPrec :: ReadPrec CreateDetectorModel
readList :: ReadS [CreateDetectorModel]
$creadList :: ReadS [CreateDetectorModel]
readsPrec :: Int -> ReadS CreateDetectorModel
$creadsPrec :: Int -> ReadS CreateDetectorModel
Prelude.Read, Int -> CreateDetectorModel -> ShowS
[CreateDetectorModel] -> ShowS
CreateDetectorModel -> String
(Int -> CreateDetectorModel -> ShowS)
-> (CreateDetectorModel -> String)
-> ([CreateDetectorModel] -> ShowS)
-> Show CreateDetectorModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDetectorModel] -> ShowS
$cshowList :: [CreateDetectorModel] -> ShowS
show :: CreateDetectorModel -> String
$cshow :: CreateDetectorModel -> String
showsPrec :: Int -> CreateDetectorModel -> ShowS
$cshowsPrec :: Int -> CreateDetectorModel -> ShowS
Prelude.Show, (forall x. CreateDetectorModel -> Rep CreateDetectorModel x)
-> (forall x. Rep CreateDetectorModel x -> CreateDetectorModel)
-> Generic CreateDetectorModel
forall x. Rep CreateDetectorModel x -> CreateDetectorModel
forall x. CreateDetectorModel -> Rep CreateDetectorModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDetectorModel x -> CreateDetectorModel
$cfrom :: forall x. CreateDetectorModel -> Rep CreateDetectorModel x
Prelude.Generic)

-- |
-- Create a value of 'CreateDetectorModel' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'detectorModelDescription', 'createDetectorModel_detectorModelDescription' - A brief description of the detector model.
--
-- 'key', 'createDetectorModel_key' - The input attribute key used to identify a device or system to create a
-- detector (an instance of the detector model) and then to route each
-- input received to the appropriate detector (instance). This parameter
-- uses a JSON-path expression in the message payload of each input to
-- specify the attribute-value pair that is used to identify the device
-- associated with the input.
--
-- 'evaluationMethod', 'createDetectorModel_evaluationMethod' - Information about the order in which events are evaluated and how
-- actions are executed.
--
-- 'tags', 'createDetectorModel_tags' - Metadata that can be used to manage the detector model.
--
-- 'detectorModelName', 'createDetectorModel_detectorModelName' - The name of the detector model.
--
-- 'detectorModelDefinition', 'createDetectorModel_detectorModelDefinition' - Information that defines how the detectors operate.
--
-- 'roleArn', 'createDetectorModel_roleArn' - The ARN of the role that grants permission to AWS IoT Events to perform
-- its operations.
newCreateDetectorModel ::
  -- | 'detectorModelName'
  Prelude.Text ->
  -- | 'detectorModelDefinition'
  DetectorModelDefinition ->
  -- | 'roleArn'
  Prelude.Text ->
  CreateDetectorModel
newCreateDetectorModel :: Text -> DetectorModelDefinition -> Text -> CreateDetectorModel
newCreateDetectorModel
  Text
pDetectorModelName_
  DetectorModelDefinition
pDetectorModelDefinition_
  Text
pRoleArn_ =
    CreateDetectorModel' :: Maybe Text
-> Maybe Text
-> Maybe EvaluationMethod
-> Maybe [Tag]
-> Text
-> DetectorModelDefinition
-> Text
-> CreateDetectorModel
CreateDetectorModel'
      { $sel:detectorModelDescription:CreateDetectorModel' :: Maybe Text
detectorModelDescription =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:key:CreateDetectorModel' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:evaluationMethod:CreateDetectorModel' :: Maybe EvaluationMethod
evaluationMethod = Maybe EvaluationMethod
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDetectorModel' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:detectorModelName:CreateDetectorModel' :: Text
detectorModelName = Text
pDetectorModelName_,
        $sel:detectorModelDefinition:CreateDetectorModel' :: DetectorModelDefinition
detectorModelDefinition = DetectorModelDefinition
pDetectorModelDefinition_,
        $sel:roleArn:CreateDetectorModel' :: Text
roleArn = Text
pRoleArn_
      }

-- | A brief description of the detector model.
createDetectorModel_detectorModelDescription :: Lens.Lens' CreateDetectorModel (Prelude.Maybe Prelude.Text)
createDetectorModel_detectorModelDescription :: (Maybe Text -> f (Maybe Text))
-> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_detectorModelDescription = (CreateDetectorModel -> Maybe Text)
-> (CreateDetectorModel -> Maybe Text -> CreateDetectorModel)
-> Lens
     CreateDetectorModel CreateDetectorModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {Maybe Text
detectorModelDescription :: Maybe Text
$sel:detectorModelDescription:CreateDetectorModel' :: CreateDetectorModel -> Maybe Text
detectorModelDescription} -> Maybe Text
detectorModelDescription) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} Maybe Text
a -> CreateDetectorModel
s {$sel:detectorModelDescription:CreateDetectorModel' :: Maybe Text
detectorModelDescription = Maybe Text
a} :: CreateDetectorModel)

-- | The input attribute key used to identify a device or system to create a
-- detector (an instance of the detector model) and then to route each
-- input received to the appropriate detector (instance). This parameter
-- uses a JSON-path expression in the message payload of each input to
-- specify the attribute-value pair that is used to identify the device
-- associated with the input.
createDetectorModel_key :: Lens.Lens' CreateDetectorModel (Prelude.Maybe Prelude.Text)
createDetectorModel_key :: (Maybe Text -> f (Maybe Text))
-> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_key = (CreateDetectorModel -> Maybe Text)
-> (CreateDetectorModel -> Maybe Text -> CreateDetectorModel)
-> Lens
     CreateDetectorModel CreateDetectorModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {Maybe Text
key :: Maybe Text
$sel:key:CreateDetectorModel' :: CreateDetectorModel -> Maybe Text
key} -> Maybe Text
key) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} Maybe Text
a -> CreateDetectorModel
s {$sel:key:CreateDetectorModel' :: Maybe Text
key = Maybe Text
a} :: CreateDetectorModel)

-- | Information about the order in which events are evaluated and how
-- actions are executed.
createDetectorModel_evaluationMethod :: Lens.Lens' CreateDetectorModel (Prelude.Maybe EvaluationMethod)
createDetectorModel_evaluationMethod :: (Maybe EvaluationMethod -> f (Maybe EvaluationMethod))
-> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_evaluationMethod = (CreateDetectorModel -> Maybe EvaluationMethod)
-> (CreateDetectorModel
    -> Maybe EvaluationMethod -> CreateDetectorModel)
-> Lens
     CreateDetectorModel
     CreateDetectorModel
     (Maybe EvaluationMethod)
     (Maybe EvaluationMethod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {Maybe EvaluationMethod
evaluationMethod :: Maybe EvaluationMethod
$sel:evaluationMethod:CreateDetectorModel' :: CreateDetectorModel -> Maybe EvaluationMethod
evaluationMethod} -> Maybe EvaluationMethod
evaluationMethod) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} Maybe EvaluationMethod
a -> CreateDetectorModel
s {$sel:evaluationMethod:CreateDetectorModel' :: Maybe EvaluationMethod
evaluationMethod = Maybe EvaluationMethod
a} :: CreateDetectorModel)

-- | Metadata that can be used to manage the detector model.
createDetectorModel_tags :: Lens.Lens' CreateDetectorModel (Prelude.Maybe [Tag])
createDetectorModel_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_tags = (CreateDetectorModel -> Maybe [Tag])
-> (CreateDetectorModel -> Maybe [Tag] -> CreateDetectorModel)
-> Lens
     CreateDetectorModel CreateDetectorModel (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDetectorModel' :: CreateDetectorModel -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} Maybe [Tag]
a -> CreateDetectorModel
s {$sel:tags:CreateDetectorModel' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDetectorModel) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDetectorModel -> f CreateDetectorModel)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDetectorModel
-> f CreateDetectorModel
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

-- | The name of the detector model.
createDetectorModel_detectorModelName :: Lens.Lens' CreateDetectorModel Prelude.Text
createDetectorModel_detectorModelName :: (Text -> f Text) -> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_detectorModelName = (CreateDetectorModel -> Text)
-> (CreateDetectorModel -> Text -> CreateDetectorModel)
-> Lens CreateDetectorModel CreateDetectorModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {Text
detectorModelName :: Text
$sel:detectorModelName:CreateDetectorModel' :: CreateDetectorModel -> Text
detectorModelName} -> Text
detectorModelName) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} Text
a -> CreateDetectorModel
s {$sel:detectorModelName:CreateDetectorModel' :: Text
detectorModelName = Text
a} :: CreateDetectorModel)

-- | Information that defines how the detectors operate.
createDetectorModel_detectorModelDefinition :: Lens.Lens' CreateDetectorModel DetectorModelDefinition
createDetectorModel_detectorModelDefinition :: (DetectorModelDefinition -> f DetectorModelDefinition)
-> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_detectorModelDefinition = (CreateDetectorModel -> DetectorModelDefinition)
-> (CreateDetectorModel
    -> DetectorModelDefinition -> CreateDetectorModel)
-> Lens
     CreateDetectorModel
     CreateDetectorModel
     DetectorModelDefinition
     DetectorModelDefinition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {DetectorModelDefinition
detectorModelDefinition :: DetectorModelDefinition
$sel:detectorModelDefinition:CreateDetectorModel' :: CreateDetectorModel -> DetectorModelDefinition
detectorModelDefinition} -> DetectorModelDefinition
detectorModelDefinition) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} DetectorModelDefinition
a -> CreateDetectorModel
s {$sel:detectorModelDefinition:CreateDetectorModel' :: DetectorModelDefinition
detectorModelDefinition = DetectorModelDefinition
a} :: CreateDetectorModel)

-- | The ARN of the role that grants permission to AWS IoT Events to perform
-- its operations.
createDetectorModel_roleArn :: Lens.Lens' CreateDetectorModel Prelude.Text
createDetectorModel_roleArn :: (Text -> f Text) -> CreateDetectorModel -> f CreateDetectorModel
createDetectorModel_roleArn = (CreateDetectorModel -> Text)
-> (CreateDetectorModel -> Text -> CreateDetectorModel)
-> Lens CreateDetectorModel CreateDetectorModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModel' {Text
roleArn :: Text
$sel:roleArn:CreateDetectorModel' :: CreateDetectorModel -> Text
roleArn} -> Text
roleArn) (\s :: CreateDetectorModel
s@CreateDetectorModel' {} Text
a -> CreateDetectorModel
s {$sel:roleArn:CreateDetectorModel' :: Text
roleArn = Text
a} :: CreateDetectorModel)

instance Core.AWSRequest CreateDetectorModel where
  type
    AWSResponse CreateDetectorModel =
      CreateDetectorModelResponse
  request :: CreateDetectorModel -> Request CreateDetectorModel
request = Service -> CreateDetectorModel -> Request CreateDetectorModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDetectorModel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDetectorModel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDetectorModel))
-> Logger
-> Service
-> Proxy CreateDetectorModel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDetectorModel)))
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 DetectorModelConfiguration
-> Int -> CreateDetectorModelResponse
CreateDetectorModelResponse'
            (Maybe DetectorModelConfiguration
 -> Int -> CreateDetectorModelResponse)
-> Either String (Maybe DetectorModelConfiguration)
-> Either String (Int -> CreateDetectorModelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DetectorModelConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"detectorModelConfiguration")
            Either String (Int -> CreateDetectorModelResponse)
-> Either String Int -> Either String CreateDetectorModelResponse
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 CreateDetectorModel

instance Prelude.NFData CreateDetectorModel

instance Core.ToHeaders CreateDetectorModel where
  toHeaders :: CreateDetectorModel -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDetectorModel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateDetectorModel where
  toJSON :: CreateDetectorModel -> Value
toJSON CreateDetectorModel' {Maybe [Tag]
Maybe Text
Maybe EvaluationMethod
Text
DetectorModelDefinition
roleArn :: Text
detectorModelDefinition :: DetectorModelDefinition
detectorModelName :: Text
tags :: Maybe [Tag]
evaluationMethod :: Maybe EvaluationMethod
key :: Maybe Text
detectorModelDescription :: Maybe Text
$sel:roleArn:CreateDetectorModel' :: CreateDetectorModel -> Text
$sel:detectorModelDefinition:CreateDetectorModel' :: CreateDetectorModel -> DetectorModelDefinition
$sel:detectorModelName:CreateDetectorModel' :: CreateDetectorModel -> Text
$sel:tags:CreateDetectorModel' :: CreateDetectorModel -> Maybe [Tag]
$sel:evaluationMethod:CreateDetectorModel' :: CreateDetectorModel -> Maybe EvaluationMethod
$sel:key:CreateDetectorModel' :: CreateDetectorModel -> Maybe Text
$sel:detectorModelDescription:CreateDetectorModel' :: CreateDetectorModel -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"detectorModelDescription" 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
detectorModelDescription,
            (Text
"key" 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
key,
            (Text
"evaluationMethod" Text -> EvaluationMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EvaluationMethod -> Pair) -> Maybe EvaluationMethod -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EvaluationMethod
evaluationMethod,
            (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
"detectorModelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
detectorModelName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"detectorModelDefinition"
                  Text -> DetectorModelDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DetectorModelDefinition
detectorModelDefinition
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )

instance Core.ToPath CreateDetectorModel where
  toPath :: CreateDetectorModel -> ByteString
toPath = ByteString -> CreateDetectorModel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/detector-models"

instance Core.ToQuery CreateDetectorModel where
  toQuery :: CreateDetectorModel -> QueryString
toQuery = QueryString -> CreateDetectorModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateDetectorModelResponse' smart constructor.
data CreateDetectorModelResponse = CreateDetectorModelResponse'
  { -- | Information about how the detector model is configured.
    CreateDetectorModelResponse -> Maybe DetectorModelConfiguration
detectorModelConfiguration :: Prelude.Maybe DetectorModelConfiguration,
    -- | The response's http status code.
    CreateDetectorModelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDetectorModelResponse -> CreateDetectorModelResponse -> Bool
(CreateDetectorModelResponse
 -> CreateDetectorModelResponse -> Bool)
-> (CreateDetectorModelResponse
    -> CreateDetectorModelResponse -> Bool)
-> Eq CreateDetectorModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDetectorModelResponse -> CreateDetectorModelResponse -> Bool
$c/= :: CreateDetectorModelResponse -> CreateDetectorModelResponse -> Bool
== :: CreateDetectorModelResponse -> CreateDetectorModelResponse -> Bool
$c== :: CreateDetectorModelResponse -> CreateDetectorModelResponse -> Bool
Prelude.Eq, ReadPrec [CreateDetectorModelResponse]
ReadPrec CreateDetectorModelResponse
Int -> ReadS CreateDetectorModelResponse
ReadS [CreateDetectorModelResponse]
(Int -> ReadS CreateDetectorModelResponse)
-> ReadS [CreateDetectorModelResponse]
-> ReadPrec CreateDetectorModelResponse
-> ReadPrec [CreateDetectorModelResponse]
-> Read CreateDetectorModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDetectorModelResponse]
$creadListPrec :: ReadPrec [CreateDetectorModelResponse]
readPrec :: ReadPrec CreateDetectorModelResponse
$creadPrec :: ReadPrec CreateDetectorModelResponse
readList :: ReadS [CreateDetectorModelResponse]
$creadList :: ReadS [CreateDetectorModelResponse]
readsPrec :: Int -> ReadS CreateDetectorModelResponse
$creadsPrec :: Int -> ReadS CreateDetectorModelResponse
Prelude.Read, Int -> CreateDetectorModelResponse -> ShowS
[CreateDetectorModelResponse] -> ShowS
CreateDetectorModelResponse -> String
(Int -> CreateDetectorModelResponse -> ShowS)
-> (CreateDetectorModelResponse -> String)
-> ([CreateDetectorModelResponse] -> ShowS)
-> Show CreateDetectorModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDetectorModelResponse] -> ShowS
$cshowList :: [CreateDetectorModelResponse] -> ShowS
show :: CreateDetectorModelResponse -> String
$cshow :: CreateDetectorModelResponse -> String
showsPrec :: Int -> CreateDetectorModelResponse -> ShowS
$cshowsPrec :: Int -> CreateDetectorModelResponse -> ShowS
Prelude.Show, (forall x.
 CreateDetectorModelResponse -> Rep CreateDetectorModelResponse x)
-> (forall x.
    Rep CreateDetectorModelResponse x -> CreateDetectorModelResponse)
-> Generic CreateDetectorModelResponse
forall x.
Rep CreateDetectorModelResponse x -> CreateDetectorModelResponse
forall x.
CreateDetectorModelResponse -> Rep CreateDetectorModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDetectorModelResponse x -> CreateDetectorModelResponse
$cfrom :: forall x.
CreateDetectorModelResponse -> Rep CreateDetectorModelResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDetectorModelResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'detectorModelConfiguration', 'createDetectorModelResponse_detectorModelConfiguration' - Information about how the detector model is configured.
--
-- 'httpStatus', 'createDetectorModelResponse_httpStatus' - The response's http status code.
newCreateDetectorModelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDetectorModelResponse
newCreateDetectorModelResponse :: Int -> CreateDetectorModelResponse
newCreateDetectorModelResponse Int
pHttpStatus_ =
  CreateDetectorModelResponse' :: Maybe DetectorModelConfiguration
-> Int -> CreateDetectorModelResponse
CreateDetectorModelResponse'
    { $sel:detectorModelConfiguration:CreateDetectorModelResponse' :: Maybe DetectorModelConfiguration
detectorModelConfiguration =
        Maybe DetectorModelConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDetectorModelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about how the detector model is configured.
createDetectorModelResponse_detectorModelConfiguration :: Lens.Lens' CreateDetectorModelResponse (Prelude.Maybe DetectorModelConfiguration)
createDetectorModelResponse_detectorModelConfiguration :: (Maybe DetectorModelConfiguration
 -> f (Maybe DetectorModelConfiguration))
-> CreateDetectorModelResponse -> f CreateDetectorModelResponse
createDetectorModelResponse_detectorModelConfiguration = (CreateDetectorModelResponse -> Maybe DetectorModelConfiguration)
-> (CreateDetectorModelResponse
    -> Maybe DetectorModelConfiguration -> CreateDetectorModelResponse)
-> Lens
     CreateDetectorModelResponse
     CreateDetectorModelResponse
     (Maybe DetectorModelConfiguration)
     (Maybe DetectorModelConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModelResponse' {Maybe DetectorModelConfiguration
detectorModelConfiguration :: Maybe DetectorModelConfiguration
$sel:detectorModelConfiguration:CreateDetectorModelResponse' :: CreateDetectorModelResponse -> Maybe DetectorModelConfiguration
detectorModelConfiguration} -> Maybe DetectorModelConfiguration
detectorModelConfiguration) (\s :: CreateDetectorModelResponse
s@CreateDetectorModelResponse' {} Maybe DetectorModelConfiguration
a -> CreateDetectorModelResponse
s {$sel:detectorModelConfiguration:CreateDetectorModelResponse' :: Maybe DetectorModelConfiguration
detectorModelConfiguration = Maybe DetectorModelConfiguration
a} :: CreateDetectorModelResponse)

-- | The response's http status code.
createDetectorModelResponse_httpStatus :: Lens.Lens' CreateDetectorModelResponse Prelude.Int
createDetectorModelResponse_httpStatus :: (Int -> f Int)
-> CreateDetectorModelResponse -> f CreateDetectorModelResponse
createDetectorModelResponse_httpStatus = (CreateDetectorModelResponse -> Int)
-> (CreateDetectorModelResponse
    -> Int -> CreateDetectorModelResponse)
-> Lens
     CreateDetectorModelResponse CreateDetectorModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDetectorModelResponse' :: CreateDetectorModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDetectorModelResponse
s@CreateDetectorModelResponse' {} Int
a -> CreateDetectorModelResponse
s {$sel:httpStatus:CreateDetectorModelResponse' :: Int
httpStatus = Int
a} :: CreateDetectorModelResponse)

instance Prelude.NFData CreateDetectorModelResponse