{-# 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.Route53RecoveryControlConfig.CreateSafetyRule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a safety rule in a control panel. Safety rules let you add
-- safeguards around changing routing control states, and for enabling and
-- disabling routing controls, to help prevent unexpected outcomes.
--
-- There are two types of safety rules: assertion rules and gating rules.
--
-- Assertion rule: An assertion rule enforces that, when you change a
-- routing control state, that a certain criteria is met. For example, the
-- criteria might be that at least one routing control state is On after
-- the transaction so that traffic continues to flow to at least one cell
-- for the application. This ensures that you avoid a fail-open scenario.
--
-- Gating rule: A gating rule lets you configure a gating routing control
-- as an overall \"on\/off\" switch for a group of routing controls. Or,
-- you can configure more complex gating scenarios, for example by
-- configuring multiple gating routing controls.
--
-- For more information, see
-- <https://docs.aws.amazon.com/r53recovery/latest/dg/routing-control.safety-rules.html Safety rules>
-- in the Amazon Route 53 Application Recovery Controller Developer Guide.
module Amazonka.Route53RecoveryControlConfig.CreateSafetyRule
  ( -- * Creating a Request
    CreateSafetyRule (..),
    newCreateSafetyRule,

    -- * Request Lenses
    createSafetyRule_assertionRule,
    createSafetyRule_clientToken,
    createSafetyRule_gatingRule,
    createSafetyRule_tags,

    -- * Destructuring the Response
    CreateSafetyRuleResponse (..),
    newCreateSafetyRuleResponse,

    -- * Response Lenses
    createSafetyRuleResponse_assertionRule,
    createSafetyRuleResponse_gatingRule,
    createSafetyRuleResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53RecoveryControlConfig.Types

-- | The request body that you include when you create a safety rule.
--
-- /See:/ 'newCreateSafetyRule' smart constructor.
data CreateSafetyRule = CreateSafetyRule'
  { -- | The assertion rule requested.
    CreateSafetyRule -> Maybe NewAssertionRule
assertionRule :: Prelude.Maybe NewAssertionRule,
    -- | A unique, case-sensitive string of up to 64 ASCII characters. To make an
    -- idempotent API request with an action, specify a client token in the
    -- request.
    CreateSafetyRule -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The gating rule requested.
    CreateSafetyRule -> Maybe NewGatingRule
gatingRule :: Prelude.Maybe NewGatingRule,
    -- | The tags associated with the safety rule.
    CreateSafetyRule -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CreateSafetyRule -> CreateSafetyRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSafetyRule -> CreateSafetyRule -> Bool
$c/= :: CreateSafetyRule -> CreateSafetyRule -> Bool
== :: CreateSafetyRule -> CreateSafetyRule -> Bool
$c== :: CreateSafetyRule -> CreateSafetyRule -> Bool
Prelude.Eq, ReadPrec [CreateSafetyRule]
ReadPrec CreateSafetyRule
Int -> ReadS CreateSafetyRule
ReadS [CreateSafetyRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSafetyRule]
$creadListPrec :: ReadPrec [CreateSafetyRule]
readPrec :: ReadPrec CreateSafetyRule
$creadPrec :: ReadPrec CreateSafetyRule
readList :: ReadS [CreateSafetyRule]
$creadList :: ReadS [CreateSafetyRule]
readsPrec :: Int -> ReadS CreateSafetyRule
$creadsPrec :: Int -> ReadS CreateSafetyRule
Prelude.Read, Int -> CreateSafetyRule -> ShowS
[CreateSafetyRule] -> ShowS
CreateSafetyRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSafetyRule] -> ShowS
$cshowList :: [CreateSafetyRule] -> ShowS
show :: CreateSafetyRule -> String
$cshow :: CreateSafetyRule -> String
showsPrec :: Int -> CreateSafetyRule -> ShowS
$cshowsPrec :: Int -> CreateSafetyRule -> ShowS
Prelude.Show, forall x. Rep CreateSafetyRule x -> CreateSafetyRule
forall x. CreateSafetyRule -> Rep CreateSafetyRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSafetyRule x -> CreateSafetyRule
$cfrom :: forall x. CreateSafetyRule -> Rep CreateSafetyRule x
Prelude.Generic)

-- |
-- Create a value of 'CreateSafetyRule' 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:
--
-- 'assertionRule', 'createSafetyRule_assertionRule' - The assertion rule requested.
--
-- 'clientToken', 'createSafetyRule_clientToken' - A unique, case-sensitive string of up to 64 ASCII characters. To make an
-- idempotent API request with an action, specify a client token in the
-- request.
--
-- 'gatingRule', 'createSafetyRule_gatingRule' - The gating rule requested.
--
-- 'tags', 'createSafetyRule_tags' - The tags associated with the safety rule.
newCreateSafetyRule ::
  CreateSafetyRule
newCreateSafetyRule :: CreateSafetyRule
newCreateSafetyRule =
  CreateSafetyRule'
    { $sel:assertionRule:CreateSafetyRule' :: Maybe NewAssertionRule
assertionRule = forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:CreateSafetyRule' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
      $sel:gatingRule:CreateSafetyRule' :: Maybe NewGatingRule
gatingRule = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateSafetyRule' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The assertion rule requested.
createSafetyRule_assertionRule :: Lens.Lens' CreateSafetyRule (Prelude.Maybe NewAssertionRule)
createSafetyRule_assertionRule :: Lens' CreateSafetyRule (Maybe NewAssertionRule)
createSafetyRule_assertionRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSafetyRule' {Maybe NewAssertionRule
assertionRule :: Maybe NewAssertionRule
$sel:assertionRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewAssertionRule
assertionRule} -> Maybe NewAssertionRule
assertionRule) (\s :: CreateSafetyRule
s@CreateSafetyRule' {} Maybe NewAssertionRule
a -> CreateSafetyRule
s {$sel:assertionRule:CreateSafetyRule' :: Maybe NewAssertionRule
assertionRule = Maybe NewAssertionRule
a} :: CreateSafetyRule)

-- | A unique, case-sensitive string of up to 64 ASCII characters. To make an
-- idempotent API request with an action, specify a client token in the
-- request.
createSafetyRule_clientToken :: Lens.Lens' CreateSafetyRule (Prelude.Maybe Prelude.Text)
createSafetyRule_clientToken :: Lens' CreateSafetyRule (Maybe Text)
createSafetyRule_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSafetyRule' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateSafetyRule' :: CreateSafetyRule -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateSafetyRule
s@CreateSafetyRule' {} Maybe Text
a -> CreateSafetyRule
s {$sel:clientToken:CreateSafetyRule' :: Maybe Text
clientToken = Maybe Text
a} :: CreateSafetyRule)

-- | The gating rule requested.
createSafetyRule_gatingRule :: Lens.Lens' CreateSafetyRule (Prelude.Maybe NewGatingRule)
createSafetyRule_gatingRule :: Lens' CreateSafetyRule (Maybe NewGatingRule)
createSafetyRule_gatingRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSafetyRule' {Maybe NewGatingRule
gatingRule :: Maybe NewGatingRule
$sel:gatingRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewGatingRule
gatingRule} -> Maybe NewGatingRule
gatingRule) (\s :: CreateSafetyRule
s@CreateSafetyRule' {} Maybe NewGatingRule
a -> CreateSafetyRule
s {$sel:gatingRule:CreateSafetyRule' :: Maybe NewGatingRule
gatingRule = Maybe NewGatingRule
a} :: CreateSafetyRule)

-- | The tags associated with the safety rule.
createSafetyRule_tags :: Lens.Lens' CreateSafetyRule (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSafetyRule_tags :: Lens' CreateSafetyRule (Maybe (HashMap Text Text))
createSafetyRule_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSafetyRule' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateSafetyRule' :: CreateSafetyRule -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateSafetyRule
s@CreateSafetyRule' {} Maybe (HashMap Text Text)
a -> CreateSafetyRule
s {$sel:tags:CreateSafetyRule' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateSafetyRule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateSafetyRule where
  type
    AWSResponse CreateSafetyRule =
      CreateSafetyRuleResponse
  request :: (Service -> Service)
-> CreateSafetyRule -> Request CreateSafetyRule
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSafetyRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSafetyRule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe AssertionRule
-> Maybe GatingRule -> Int -> CreateSafetyRuleResponse
CreateSafetyRuleResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AssertionRule")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"GatingRule")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateSafetyRule where
  hashWithSalt :: Int -> CreateSafetyRule -> Int
hashWithSalt Int
_salt CreateSafetyRule' {Maybe Text
Maybe (HashMap Text Text)
Maybe NewGatingRule
Maybe NewAssertionRule
tags :: Maybe (HashMap Text Text)
gatingRule :: Maybe NewGatingRule
clientToken :: Maybe Text
assertionRule :: Maybe NewAssertionRule
$sel:tags:CreateSafetyRule' :: CreateSafetyRule -> Maybe (HashMap Text Text)
$sel:gatingRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewGatingRule
$sel:clientToken:CreateSafetyRule' :: CreateSafetyRule -> Maybe Text
$sel:assertionRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewAssertionRule
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NewAssertionRule
assertionRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NewGatingRule
gatingRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData CreateSafetyRule where
  rnf :: CreateSafetyRule -> ()
rnf CreateSafetyRule' {Maybe Text
Maybe (HashMap Text Text)
Maybe NewGatingRule
Maybe NewAssertionRule
tags :: Maybe (HashMap Text Text)
gatingRule :: Maybe NewGatingRule
clientToken :: Maybe Text
assertionRule :: Maybe NewAssertionRule
$sel:tags:CreateSafetyRule' :: CreateSafetyRule -> Maybe (HashMap Text Text)
$sel:gatingRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewGatingRule
$sel:clientToken:CreateSafetyRule' :: CreateSafetyRule -> Maybe Text
$sel:assertionRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewAssertionRule
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NewAssertionRule
assertionRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NewGatingRule
gatingRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags

instance Data.ToHeaders CreateSafetyRule where
  toHeaders :: CreateSafetyRule -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateSafetyRule where
  toJSON :: CreateSafetyRule -> Value
toJSON CreateSafetyRule' {Maybe Text
Maybe (HashMap Text Text)
Maybe NewGatingRule
Maybe NewAssertionRule
tags :: Maybe (HashMap Text Text)
gatingRule :: Maybe NewGatingRule
clientToken :: Maybe Text
assertionRule :: Maybe NewAssertionRule
$sel:tags:CreateSafetyRule' :: CreateSafetyRule -> Maybe (HashMap Text Text)
$sel:gatingRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewGatingRule
$sel:clientToken:CreateSafetyRule' :: CreateSafetyRule -> Maybe Text
$sel:assertionRule:CreateSafetyRule' :: CreateSafetyRule -> Maybe NewAssertionRule
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AssertionRule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NewAssertionRule
assertionRule,
            (Key
"ClientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Key
"GatingRule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NewGatingRule
gatingRule,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
          ]
      )

instance Data.ToPath CreateSafetyRule where
  toPath :: CreateSafetyRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/safetyrule"

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

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

-- |
-- Create a value of 'CreateSafetyRuleResponse' 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:
--
-- 'assertionRule', 'createSafetyRuleResponse_assertionRule' - The assertion rule created.
--
-- 'gatingRule', 'createSafetyRuleResponse_gatingRule' - The gating rule created.
--
-- 'httpStatus', 'createSafetyRuleResponse_httpStatus' - The response's http status code.
newCreateSafetyRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSafetyRuleResponse
newCreateSafetyRuleResponse :: Int -> CreateSafetyRuleResponse
newCreateSafetyRuleResponse Int
pHttpStatus_ =
  CreateSafetyRuleResponse'
    { $sel:assertionRule:CreateSafetyRuleResponse' :: Maybe AssertionRule
assertionRule =
        forall a. Maybe a
Prelude.Nothing,
      $sel:gatingRule:CreateSafetyRuleResponse' :: Maybe GatingRule
gatingRule = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSafetyRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The assertion rule created.
createSafetyRuleResponse_assertionRule :: Lens.Lens' CreateSafetyRuleResponse (Prelude.Maybe AssertionRule)
createSafetyRuleResponse_assertionRule :: Lens' CreateSafetyRuleResponse (Maybe AssertionRule)
createSafetyRuleResponse_assertionRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSafetyRuleResponse' {Maybe AssertionRule
assertionRule :: Maybe AssertionRule
$sel:assertionRule:CreateSafetyRuleResponse' :: CreateSafetyRuleResponse -> Maybe AssertionRule
assertionRule} -> Maybe AssertionRule
assertionRule) (\s :: CreateSafetyRuleResponse
s@CreateSafetyRuleResponse' {} Maybe AssertionRule
a -> CreateSafetyRuleResponse
s {$sel:assertionRule:CreateSafetyRuleResponse' :: Maybe AssertionRule
assertionRule = Maybe AssertionRule
a} :: CreateSafetyRuleResponse)

-- | The gating rule created.
createSafetyRuleResponse_gatingRule :: Lens.Lens' CreateSafetyRuleResponse (Prelude.Maybe GatingRule)
createSafetyRuleResponse_gatingRule :: Lens' CreateSafetyRuleResponse (Maybe GatingRule)
createSafetyRuleResponse_gatingRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSafetyRuleResponse' {Maybe GatingRule
gatingRule :: Maybe GatingRule
$sel:gatingRule:CreateSafetyRuleResponse' :: CreateSafetyRuleResponse -> Maybe GatingRule
gatingRule} -> Maybe GatingRule
gatingRule) (\s :: CreateSafetyRuleResponse
s@CreateSafetyRuleResponse' {} Maybe GatingRule
a -> CreateSafetyRuleResponse
s {$sel:gatingRule:CreateSafetyRuleResponse' :: Maybe GatingRule
gatingRule = Maybe GatingRule
a} :: CreateSafetyRuleResponse)

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

instance Prelude.NFData CreateSafetyRuleResponse where
  rnf :: CreateSafetyRuleResponse -> ()
rnf CreateSafetyRuleResponse' {Int
Maybe GatingRule
Maybe AssertionRule
httpStatus :: Int
gatingRule :: Maybe GatingRule
assertionRule :: Maybe AssertionRule
$sel:httpStatus:CreateSafetyRuleResponse' :: CreateSafetyRuleResponse -> Int
$sel:gatingRule:CreateSafetyRuleResponse' :: CreateSafetyRuleResponse -> Maybe GatingRule
$sel:assertionRule:CreateSafetyRuleResponse' :: CreateSafetyRuleResponse -> Maybe AssertionRule
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AssertionRule
assertionRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GatingRule
gatingRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus