{-# 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.FraudDetector.CreateRule
-- 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 rule for use with the specified detector.
module Amazonka.FraudDetector.CreateRule
  ( -- * Creating a Request
    CreateRule (..),
    newCreateRule,

    -- * Request Lenses
    createRule_description,
    createRule_tags,
    createRule_ruleId,
    createRule_detectorId,
    createRule_expression,
    createRule_language,
    createRule_outcomes,

    -- * Destructuring the Response
    CreateRuleResponse (..),
    newCreateRuleResponse,

    -- * Response Lenses
    createRuleResponse_rule,
    createRuleResponse_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

-- | /See:/ 'newCreateRule' smart constructor.
data CreateRule = CreateRule'
  { -- | The rule description.
    CreateRule -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A collection of key and value pairs.
    CreateRule -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The rule ID.
    CreateRule -> Text
ruleId :: Prelude.Text,
    -- | The detector ID for the rule\'s parent detector.
    CreateRule -> Text
detectorId :: Prelude.Text,
    -- | The rule expression.
    CreateRule -> Sensitive Text
expression :: Core.Sensitive Prelude.Text,
    -- | The language of the rule.
    CreateRule -> Language
language :: Language,
    -- | The outcome or outcomes returned when the rule expression matches.
    CreateRule -> NonEmpty Text
outcomes :: Prelude.NonEmpty Prelude.Text
  }
  deriving (CreateRule -> CreateRule -> Bool
(CreateRule -> CreateRule -> Bool)
-> (CreateRule -> CreateRule -> Bool) -> Eq CreateRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRule -> CreateRule -> Bool
$c/= :: CreateRule -> CreateRule -> Bool
== :: CreateRule -> CreateRule -> Bool
$c== :: CreateRule -> CreateRule -> Bool
Prelude.Eq, Int -> CreateRule -> ShowS
[CreateRule] -> ShowS
CreateRule -> String
(Int -> CreateRule -> ShowS)
-> (CreateRule -> String)
-> ([CreateRule] -> ShowS)
-> Show CreateRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRule] -> ShowS
$cshowList :: [CreateRule] -> ShowS
show :: CreateRule -> String
$cshow :: CreateRule -> String
showsPrec :: Int -> CreateRule -> ShowS
$cshowsPrec :: Int -> CreateRule -> ShowS
Prelude.Show, (forall x. CreateRule -> Rep CreateRule x)
-> (forall x. Rep CreateRule x -> CreateRule) -> Generic CreateRule
forall x. Rep CreateRule x -> CreateRule
forall x. CreateRule -> Rep CreateRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRule x -> CreateRule
$cfrom :: forall x. CreateRule -> Rep CreateRule x
Prelude.Generic)

-- |
-- Create a value of 'CreateRule' 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:
--
-- 'description', 'createRule_description' - The rule description.
--
-- 'tags', 'createRule_tags' - A collection of key and value pairs.
--
-- 'ruleId', 'createRule_ruleId' - The rule ID.
--
-- 'detectorId', 'createRule_detectorId' - The detector ID for the rule\'s parent detector.
--
-- 'expression', 'createRule_expression' - The rule expression.
--
-- 'language', 'createRule_language' - The language of the rule.
--
-- 'outcomes', 'createRule_outcomes' - The outcome or outcomes returned when the rule expression matches.
newCreateRule ::
  -- | 'ruleId'
  Prelude.Text ->
  -- | 'detectorId'
  Prelude.Text ->
  -- | 'expression'
  Prelude.Text ->
  -- | 'language'
  Language ->
  -- | 'outcomes'
  Prelude.NonEmpty Prelude.Text ->
  CreateRule
newCreateRule :: Text -> Text -> Text -> Language -> NonEmpty Text -> CreateRule
newCreateRule
  Text
pRuleId_
  Text
pDetectorId_
  Text
pExpression_
  Language
pLanguage_
  NonEmpty Text
pOutcomes_ =
    CreateRule' :: Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Sensitive Text
-> Language
-> NonEmpty Text
-> CreateRule
CreateRule'
      { $sel:description:CreateRule' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateRule' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:ruleId:CreateRule' :: Text
ruleId = Text
pRuleId_,
        $sel:detectorId:CreateRule' :: Text
detectorId = Text
pDetectorId_,
        $sel:expression:CreateRule' :: Sensitive Text
expression = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pExpression_,
        $sel:language:CreateRule' :: Language
language = Language
pLanguage_,
        $sel:outcomes:CreateRule' :: NonEmpty Text
outcomes = 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
pOutcomes_
      }

-- | The rule description.
createRule_description :: Lens.Lens' CreateRule (Prelude.Maybe Prelude.Text)
createRule_description :: (Maybe Text -> f (Maybe Text)) -> CreateRule -> f CreateRule
createRule_description = (CreateRule -> Maybe Text)
-> (CreateRule -> Maybe Text -> CreateRule)
-> Lens CreateRule CreateRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe Text
description :: Maybe Text
$sel:description:CreateRule' :: CreateRule -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateRule
s@CreateRule' {} Maybe Text
a -> CreateRule
s {$sel:description:CreateRule' :: Maybe Text
description = Maybe Text
a} :: CreateRule)

-- | A collection of key and value pairs.
createRule_tags :: Lens.Lens' CreateRule (Prelude.Maybe [Tag])
createRule_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateRule -> f CreateRule
createRule_tags = (CreateRule -> Maybe [Tag])
-> (CreateRule -> Maybe [Tag] -> CreateRule)
-> Lens CreateRule CreateRule (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateRule' :: CreateRule -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateRule
s@CreateRule' {} Maybe [Tag]
a -> CreateRule
s {$sel:tags:CreateRule' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateRule) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateRule -> f CreateRule)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateRule
-> f CreateRule
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 rule ID.
createRule_ruleId :: Lens.Lens' CreateRule Prelude.Text
createRule_ruleId :: (Text -> f Text) -> CreateRule -> f CreateRule
createRule_ruleId = (CreateRule -> Text)
-> (CreateRule -> Text -> CreateRule)
-> Lens CreateRule CreateRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Text
ruleId :: Text
$sel:ruleId:CreateRule' :: CreateRule -> Text
ruleId} -> Text
ruleId) (\s :: CreateRule
s@CreateRule' {} Text
a -> CreateRule
s {$sel:ruleId:CreateRule' :: Text
ruleId = Text
a} :: CreateRule)

-- | The detector ID for the rule\'s parent detector.
createRule_detectorId :: Lens.Lens' CreateRule Prelude.Text
createRule_detectorId :: (Text -> f Text) -> CreateRule -> f CreateRule
createRule_detectorId = (CreateRule -> Text)
-> (CreateRule -> Text -> CreateRule)
-> Lens CreateRule CreateRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Text
detectorId :: Text
$sel:detectorId:CreateRule' :: CreateRule -> Text
detectorId} -> Text
detectorId) (\s :: CreateRule
s@CreateRule' {} Text
a -> CreateRule
s {$sel:detectorId:CreateRule' :: Text
detectorId = Text
a} :: CreateRule)

-- | The rule expression.
createRule_expression :: Lens.Lens' CreateRule Prelude.Text
createRule_expression :: (Text -> f Text) -> CreateRule -> f CreateRule
createRule_expression = (CreateRule -> Sensitive Text)
-> (CreateRule -> Sensitive Text -> CreateRule)
-> Lens CreateRule CreateRule (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Sensitive Text
expression :: Sensitive Text
$sel:expression:CreateRule' :: CreateRule -> Sensitive Text
expression} -> Sensitive Text
expression) (\s :: CreateRule
s@CreateRule' {} Sensitive Text
a -> CreateRule
s {$sel:expression:CreateRule' :: Sensitive Text
expression = Sensitive Text
a} :: CreateRule) ((Sensitive Text -> f (Sensitive Text))
 -> CreateRule -> f CreateRule)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateRule
-> f CreateRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The language of the rule.
createRule_language :: Lens.Lens' CreateRule Language
createRule_language :: (Language -> f Language) -> CreateRule -> f CreateRule
createRule_language = (CreateRule -> Language)
-> (CreateRule -> Language -> CreateRule)
-> Lens CreateRule CreateRule Language Language
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Language
language :: Language
$sel:language:CreateRule' :: CreateRule -> Language
language} -> Language
language) (\s :: CreateRule
s@CreateRule' {} Language
a -> CreateRule
s {$sel:language:CreateRule' :: Language
language = Language
a} :: CreateRule)

-- | The outcome or outcomes returned when the rule expression matches.
createRule_outcomes :: Lens.Lens' CreateRule (Prelude.NonEmpty Prelude.Text)
createRule_outcomes :: (NonEmpty Text -> f (NonEmpty Text)) -> CreateRule -> f CreateRule
createRule_outcomes = (CreateRule -> NonEmpty Text)
-> (CreateRule -> NonEmpty Text -> CreateRule)
-> Lens CreateRule CreateRule (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {NonEmpty Text
outcomes :: NonEmpty Text
$sel:outcomes:CreateRule' :: CreateRule -> NonEmpty Text
outcomes} -> NonEmpty Text
outcomes) (\s :: CreateRule
s@CreateRule' {} NonEmpty Text
a -> CreateRule
s {$sel:outcomes:CreateRule' :: NonEmpty Text
outcomes = NonEmpty Text
a} :: CreateRule) ((NonEmpty Text -> f (NonEmpty Text))
 -> CreateRule -> f CreateRule)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateRule
-> f CreateRule
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 CreateRule where
  type AWSResponse CreateRule = CreateRuleResponse
  request :: CreateRule -> Request CreateRule
request = Service -> CreateRule -> Request CreateRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRule))
-> Logger
-> Service
-> Proxy CreateRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRule)))
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 Rule -> Int -> CreateRuleResponse
CreateRuleResponse'
            (Maybe Rule -> Int -> CreateRuleResponse)
-> Either String (Maybe Rule)
-> Either String (Int -> CreateRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Rule)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"rule")
            Either String (Int -> CreateRuleResponse)
-> Either String Int -> Either String CreateRuleResponse
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 CreateRule

instance Prelude.NFData CreateRule

instance Core.ToHeaders CreateRule where
  toHeaders :: CreateRule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateRule -> 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.CreateRule" ::
                          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 CreateRule where
  toJSON :: CreateRule -> Value
toJSON CreateRule' {Maybe [Tag]
Maybe Text
NonEmpty Text
Text
Sensitive Text
Language
outcomes :: NonEmpty Text
language :: Language
expression :: Sensitive Text
detectorId :: Text
ruleId :: Text
tags :: Maybe [Tag]
description :: Maybe Text
$sel:outcomes:CreateRule' :: CreateRule -> NonEmpty Text
$sel:language:CreateRule' :: CreateRule -> Language
$sel:expression:CreateRule' :: CreateRule -> Sensitive Text
$sel:detectorId:CreateRule' :: CreateRule -> Text
$sel:ruleId:CreateRule' :: CreateRule -> Text
$sel:tags:CreateRule' :: CreateRule -> Maybe [Tag]
$sel:description:CreateRule' :: CreateRule -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"ruleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"detectorId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
detectorId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"expression" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
expression),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"language" Text -> Language -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Language
language),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"outcomes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
outcomes)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateRuleResponse' 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:
--
-- 'rule', 'createRuleResponse_rule' - The created rule.
--
-- 'httpStatus', 'createRuleResponse_httpStatus' - The response's http status code.
newCreateRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRuleResponse
newCreateRuleResponse :: Int -> CreateRuleResponse
newCreateRuleResponse Int
pHttpStatus_ =
  CreateRuleResponse' :: Maybe Rule -> Int -> CreateRuleResponse
CreateRuleResponse'
    { $sel:rule:CreateRuleResponse' :: Maybe Rule
rule = Maybe Rule
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The created rule.
createRuleResponse_rule :: Lens.Lens' CreateRuleResponse (Prelude.Maybe Rule)
createRuleResponse_rule :: (Maybe Rule -> f (Maybe Rule))
-> CreateRuleResponse -> f CreateRuleResponse
createRuleResponse_rule = (CreateRuleResponse -> Maybe Rule)
-> (CreateRuleResponse -> Maybe Rule -> CreateRuleResponse)
-> Lens
     CreateRuleResponse CreateRuleResponse (Maybe Rule) (Maybe Rule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleResponse' {Maybe Rule
rule :: Maybe Rule
$sel:rule:CreateRuleResponse' :: CreateRuleResponse -> Maybe Rule
rule} -> Maybe Rule
rule) (\s :: CreateRuleResponse
s@CreateRuleResponse' {} Maybe Rule
a -> CreateRuleResponse
s {$sel:rule:CreateRuleResponse' :: Maybe Rule
rule = Maybe Rule
a} :: CreateRuleResponse)

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

instance Prelude.NFData CreateRuleResponse