{-# 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.GuardDuty.CreateDetector
-- 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 single Amazon GuardDuty detector. A detector is a resource
-- that represents the GuardDuty service. To start using GuardDuty, you
-- must create a detector in each Region where you enable the service. You
-- can have only one detector per account per Region. All data sources are
-- enabled in a new detector by default.
module Amazonka.GuardDuty.CreateDetector
  ( -- * Creating a Request
    CreateDetector (..),
    newCreateDetector,

    -- * Request Lenses
    createDetector_clientToken,
    createDetector_findingPublishingFrequency,
    createDetector_dataSources,
    createDetector_tags,
    createDetector_enable,

    -- * Destructuring the Response
    CreateDetectorResponse (..),
    newCreateDetectorResponse,

    -- * Response Lenses
    createDetectorResponse_detectorId,
    createDetectorResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.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:/ 'newCreateDetector' smart constructor.
data CreateDetector = CreateDetector'
  { -- | The idempotency token for the create request.
    CreateDetector -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A value that specifies how frequently updated findings are exported.
    CreateDetector -> Maybe FindingPublishingFrequency
findingPublishingFrequency :: Prelude.Maybe FindingPublishingFrequency,
    -- | Describes which data sources will be enabled for the detector.
    CreateDetector -> Maybe DataSourceConfigurations
dataSources :: Prelude.Maybe DataSourceConfigurations,
    -- | The tags to be added to a new detector resource.
    CreateDetector -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A Boolean value that specifies whether the detector is to be enabled.
    CreateDetector -> Bool
enable :: Prelude.Bool
  }
  deriving (CreateDetector -> CreateDetector -> Bool
(CreateDetector -> CreateDetector -> Bool)
-> (CreateDetector -> CreateDetector -> Bool) -> Eq CreateDetector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDetector -> CreateDetector -> Bool
$c/= :: CreateDetector -> CreateDetector -> Bool
== :: CreateDetector -> CreateDetector -> Bool
$c== :: CreateDetector -> CreateDetector -> Bool
Prelude.Eq, ReadPrec [CreateDetector]
ReadPrec CreateDetector
Int -> ReadS CreateDetector
ReadS [CreateDetector]
(Int -> ReadS CreateDetector)
-> ReadS [CreateDetector]
-> ReadPrec CreateDetector
-> ReadPrec [CreateDetector]
-> Read CreateDetector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDetector]
$creadListPrec :: ReadPrec [CreateDetector]
readPrec :: ReadPrec CreateDetector
$creadPrec :: ReadPrec CreateDetector
readList :: ReadS [CreateDetector]
$creadList :: ReadS [CreateDetector]
readsPrec :: Int -> ReadS CreateDetector
$creadsPrec :: Int -> ReadS CreateDetector
Prelude.Read, Int -> CreateDetector -> ShowS
[CreateDetector] -> ShowS
CreateDetector -> String
(Int -> CreateDetector -> ShowS)
-> (CreateDetector -> String)
-> ([CreateDetector] -> ShowS)
-> Show CreateDetector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDetector] -> ShowS
$cshowList :: [CreateDetector] -> ShowS
show :: CreateDetector -> String
$cshow :: CreateDetector -> String
showsPrec :: Int -> CreateDetector -> ShowS
$cshowsPrec :: Int -> CreateDetector -> ShowS
Prelude.Show, (forall x. CreateDetector -> Rep CreateDetector x)
-> (forall x. Rep CreateDetector x -> CreateDetector)
-> Generic CreateDetector
forall x. Rep CreateDetector x -> CreateDetector
forall x. CreateDetector -> Rep CreateDetector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDetector x -> CreateDetector
$cfrom :: forall x. CreateDetector -> Rep CreateDetector x
Prelude.Generic)

-- |
-- Create a value of 'CreateDetector' 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:
--
-- 'clientToken', 'createDetector_clientToken' - The idempotency token for the create request.
--
-- 'findingPublishingFrequency', 'createDetector_findingPublishingFrequency' - A value that specifies how frequently updated findings are exported.
--
-- 'dataSources', 'createDetector_dataSources' - Describes which data sources will be enabled for the detector.
--
-- 'tags', 'createDetector_tags' - The tags to be added to a new detector resource.
--
-- 'enable', 'createDetector_enable' - A Boolean value that specifies whether the detector is to be enabled.
newCreateDetector ::
  -- | 'enable'
  Prelude.Bool ->
  CreateDetector
newCreateDetector :: Bool -> CreateDetector
newCreateDetector Bool
pEnable_ =
  CreateDetector' :: Maybe Text
-> Maybe FindingPublishingFrequency
-> Maybe DataSourceConfigurations
-> Maybe (HashMap Text Text)
-> Bool
-> CreateDetector
CreateDetector'
    { $sel:clientToken:CreateDetector' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:findingPublishingFrequency:CreateDetector' :: Maybe FindingPublishingFrequency
findingPublishingFrequency = Maybe FindingPublishingFrequency
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSources:CreateDetector' :: Maybe DataSourceConfigurations
dataSources = Maybe DataSourceConfigurations
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDetector' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:enable:CreateDetector' :: Bool
enable = Bool
pEnable_
    }

-- | The idempotency token for the create request.
createDetector_clientToken :: Lens.Lens' CreateDetector (Prelude.Maybe Prelude.Text)
createDetector_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateDetector -> f CreateDetector
createDetector_clientToken = (CreateDetector -> Maybe Text)
-> (CreateDetector -> Maybe Text -> CreateDetector)
-> Lens CreateDetector CreateDetector (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetector' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateDetector' :: CreateDetector -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateDetector
s@CreateDetector' {} Maybe Text
a -> CreateDetector
s {$sel:clientToken:CreateDetector' :: Maybe Text
clientToken = Maybe Text
a} :: CreateDetector)

-- | A value that specifies how frequently updated findings are exported.
createDetector_findingPublishingFrequency :: Lens.Lens' CreateDetector (Prelude.Maybe FindingPublishingFrequency)
createDetector_findingPublishingFrequency :: (Maybe FindingPublishingFrequency
 -> f (Maybe FindingPublishingFrequency))
-> CreateDetector -> f CreateDetector
createDetector_findingPublishingFrequency = (CreateDetector -> Maybe FindingPublishingFrequency)
-> (CreateDetector
    -> Maybe FindingPublishingFrequency -> CreateDetector)
-> Lens
     CreateDetector
     CreateDetector
     (Maybe FindingPublishingFrequency)
     (Maybe FindingPublishingFrequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetector' {Maybe FindingPublishingFrequency
findingPublishingFrequency :: Maybe FindingPublishingFrequency
$sel:findingPublishingFrequency:CreateDetector' :: CreateDetector -> Maybe FindingPublishingFrequency
findingPublishingFrequency} -> Maybe FindingPublishingFrequency
findingPublishingFrequency) (\s :: CreateDetector
s@CreateDetector' {} Maybe FindingPublishingFrequency
a -> CreateDetector
s {$sel:findingPublishingFrequency:CreateDetector' :: Maybe FindingPublishingFrequency
findingPublishingFrequency = Maybe FindingPublishingFrequency
a} :: CreateDetector)

-- | Describes which data sources will be enabled for the detector.
createDetector_dataSources :: Lens.Lens' CreateDetector (Prelude.Maybe DataSourceConfigurations)
createDetector_dataSources :: (Maybe DataSourceConfigurations
 -> f (Maybe DataSourceConfigurations))
-> CreateDetector -> f CreateDetector
createDetector_dataSources = (CreateDetector -> Maybe DataSourceConfigurations)
-> (CreateDetector
    -> Maybe DataSourceConfigurations -> CreateDetector)
-> Lens
     CreateDetector
     CreateDetector
     (Maybe DataSourceConfigurations)
     (Maybe DataSourceConfigurations)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetector' {Maybe DataSourceConfigurations
dataSources :: Maybe DataSourceConfigurations
$sel:dataSources:CreateDetector' :: CreateDetector -> Maybe DataSourceConfigurations
dataSources} -> Maybe DataSourceConfigurations
dataSources) (\s :: CreateDetector
s@CreateDetector' {} Maybe DataSourceConfigurations
a -> CreateDetector
s {$sel:dataSources:CreateDetector' :: Maybe DataSourceConfigurations
dataSources = Maybe DataSourceConfigurations
a} :: CreateDetector)

-- | The tags to be added to a new detector resource.
createDetector_tags :: Lens.Lens' CreateDetector (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDetector_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDetector -> f CreateDetector
createDetector_tags = (CreateDetector -> Maybe (HashMap Text Text))
-> (CreateDetector -> Maybe (HashMap Text Text) -> CreateDetector)
-> Lens
     CreateDetector
     CreateDetector
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetector' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDetector' :: CreateDetector -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDetector
s@CreateDetector' {} Maybe (HashMap Text Text)
a -> CreateDetector
s {$sel:tags:CreateDetector' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDetector) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDetector -> f CreateDetector)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDetector
-> f CreateDetector
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A Boolean value that specifies whether the detector is to be enabled.
createDetector_enable :: Lens.Lens' CreateDetector Prelude.Bool
createDetector_enable :: (Bool -> f Bool) -> CreateDetector -> f CreateDetector
createDetector_enable = (CreateDetector -> Bool)
-> (CreateDetector -> Bool -> CreateDetector)
-> Lens CreateDetector CreateDetector Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetector' {Bool
enable :: Bool
$sel:enable:CreateDetector' :: CreateDetector -> Bool
enable} -> Bool
enable) (\s :: CreateDetector
s@CreateDetector' {} Bool
a -> CreateDetector
s {$sel:enable:CreateDetector' :: Bool
enable = Bool
a} :: CreateDetector)

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

instance Prelude.NFData CreateDetector

instance Core.ToHeaders CreateDetector where
  toHeaders :: CreateDetector -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDetector -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateDetector where
  toJSON :: CreateDetector -> Value
toJSON CreateDetector' {Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe FindingPublishingFrequency
Maybe DataSourceConfigurations
enable :: Bool
tags :: Maybe (HashMap Text Text)
dataSources :: Maybe DataSourceConfigurations
findingPublishingFrequency :: Maybe FindingPublishingFrequency
clientToken :: Maybe Text
$sel:enable:CreateDetector' :: CreateDetector -> Bool
$sel:tags:CreateDetector' :: CreateDetector -> Maybe (HashMap Text Text)
$sel:dataSources:CreateDetector' :: CreateDetector -> Maybe DataSourceConfigurations
$sel:findingPublishingFrequency:CreateDetector' :: CreateDetector -> Maybe FindingPublishingFrequency
$sel:clientToken:CreateDetector' :: CreateDetector -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" 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
clientToken,
            (Text
"findingPublishingFrequency" Text -> FindingPublishingFrequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FindingPublishingFrequency -> Pair)
-> Maybe FindingPublishingFrequency -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingPublishingFrequency
findingPublishingFrequency,
            (Text
"dataSources" Text -> DataSourceConfigurations -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DataSourceConfigurations -> Pair)
-> Maybe DataSourceConfigurations -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceConfigurations
dataSources,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"enable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enable)
          ]
      )

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

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

-- | /See:/ 'newCreateDetectorResponse' smart constructor.
data CreateDetectorResponse = CreateDetectorResponse'
  { -- | The unique ID of the created detector.
    CreateDetectorResponse -> Maybe Text
detectorId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateDetectorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDetectorResponse -> CreateDetectorResponse -> Bool
(CreateDetectorResponse -> CreateDetectorResponse -> Bool)
-> (CreateDetectorResponse -> CreateDetectorResponse -> Bool)
-> Eq CreateDetectorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDetectorResponse -> CreateDetectorResponse -> Bool
$c/= :: CreateDetectorResponse -> CreateDetectorResponse -> Bool
== :: CreateDetectorResponse -> CreateDetectorResponse -> Bool
$c== :: CreateDetectorResponse -> CreateDetectorResponse -> Bool
Prelude.Eq, ReadPrec [CreateDetectorResponse]
ReadPrec CreateDetectorResponse
Int -> ReadS CreateDetectorResponse
ReadS [CreateDetectorResponse]
(Int -> ReadS CreateDetectorResponse)
-> ReadS [CreateDetectorResponse]
-> ReadPrec CreateDetectorResponse
-> ReadPrec [CreateDetectorResponse]
-> Read CreateDetectorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDetectorResponse]
$creadListPrec :: ReadPrec [CreateDetectorResponse]
readPrec :: ReadPrec CreateDetectorResponse
$creadPrec :: ReadPrec CreateDetectorResponse
readList :: ReadS [CreateDetectorResponse]
$creadList :: ReadS [CreateDetectorResponse]
readsPrec :: Int -> ReadS CreateDetectorResponse
$creadsPrec :: Int -> ReadS CreateDetectorResponse
Prelude.Read, Int -> CreateDetectorResponse -> ShowS
[CreateDetectorResponse] -> ShowS
CreateDetectorResponse -> String
(Int -> CreateDetectorResponse -> ShowS)
-> (CreateDetectorResponse -> String)
-> ([CreateDetectorResponse] -> ShowS)
-> Show CreateDetectorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDetectorResponse] -> ShowS
$cshowList :: [CreateDetectorResponse] -> ShowS
show :: CreateDetectorResponse -> String
$cshow :: CreateDetectorResponse -> String
showsPrec :: Int -> CreateDetectorResponse -> ShowS
$cshowsPrec :: Int -> CreateDetectorResponse -> ShowS
Prelude.Show, (forall x. CreateDetectorResponse -> Rep CreateDetectorResponse x)
-> (forall x.
    Rep CreateDetectorResponse x -> CreateDetectorResponse)
-> Generic CreateDetectorResponse
forall x. Rep CreateDetectorResponse x -> CreateDetectorResponse
forall x. CreateDetectorResponse -> Rep CreateDetectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDetectorResponse x -> CreateDetectorResponse
$cfrom :: forall x. CreateDetectorResponse -> Rep CreateDetectorResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDetectorResponse' 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:
--
-- 'detectorId', 'createDetectorResponse_detectorId' - The unique ID of the created detector.
--
-- 'httpStatus', 'createDetectorResponse_httpStatus' - The response's http status code.
newCreateDetectorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDetectorResponse
newCreateDetectorResponse :: Int -> CreateDetectorResponse
newCreateDetectorResponse Int
pHttpStatus_ =
  CreateDetectorResponse' :: Maybe Text -> Int -> CreateDetectorResponse
CreateDetectorResponse'
    { $sel:detectorId:CreateDetectorResponse' :: Maybe Text
detectorId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDetectorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID of the created detector.
createDetectorResponse_detectorId :: Lens.Lens' CreateDetectorResponse (Prelude.Maybe Prelude.Text)
createDetectorResponse_detectorId :: (Maybe Text -> f (Maybe Text))
-> CreateDetectorResponse -> f CreateDetectorResponse
createDetectorResponse_detectorId = (CreateDetectorResponse -> Maybe Text)
-> (CreateDetectorResponse -> Maybe Text -> CreateDetectorResponse)
-> Lens
     CreateDetectorResponse
     CreateDetectorResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorResponse' {Maybe Text
detectorId :: Maybe Text
$sel:detectorId:CreateDetectorResponse' :: CreateDetectorResponse -> Maybe Text
detectorId} -> Maybe Text
detectorId) (\s :: CreateDetectorResponse
s@CreateDetectorResponse' {} Maybe Text
a -> CreateDetectorResponse
s {$sel:detectorId:CreateDetectorResponse' :: Maybe Text
detectorId = Maybe Text
a} :: CreateDetectorResponse)

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

instance Prelude.NFData CreateDetectorResponse