{-# 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.ELBV2.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 the specified listener. The listener must be
-- associated with an Application Load Balancer.
--
-- Each rule consists of a priority, one or more actions, and one or more
-- conditions. Rules are evaluated in priority order, from the lowest value
-- to the highest value. When the conditions for a rule are met, its
-- actions are performed. If the conditions for no rules are met, the
-- actions for the default rule are performed. For more information, see
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules Listener rules>
-- in the /Application Load Balancers Guide/.
module Amazonka.ELBV2.CreateRule
  ( -- * Creating a Request
    CreateRule (..),
    newCreateRule,

    -- * Request Lenses
    createRule_tags,
    createRule_listenerArn,
    createRule_conditions,
    createRule_priority,
    createRule_actions,

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

    -- * Response Lenses
    createRuleResponse_rules,
    createRuleResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.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 tags to assign to the rule.
    CreateRule -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The Amazon Resource Name (ARN) of the listener.
    CreateRule -> Text
listenerArn :: Prelude.Text,
    -- | The conditions.
    CreateRule -> [RuleCondition]
conditions :: [RuleCondition],
    -- | The rule priority. A listener can\'t have multiple rules with the same
    -- priority.
    CreateRule -> Natural
priority :: Prelude.Natural,
    -- | The actions.
    CreateRule -> [Action]
actions :: [Action]
  }
  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, ReadPrec [CreateRule]
ReadPrec CreateRule
Int -> ReadS CreateRule
ReadS [CreateRule]
(Int -> ReadS CreateRule)
-> ReadS [CreateRule]
-> ReadPrec CreateRule
-> ReadPrec [CreateRule]
-> Read CreateRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRule]
$creadListPrec :: ReadPrec [CreateRule]
readPrec :: ReadPrec CreateRule
$creadPrec :: ReadPrec CreateRule
readList :: ReadS [CreateRule]
$creadList :: ReadS [CreateRule]
readsPrec :: Int -> ReadS CreateRule
$creadsPrec :: Int -> ReadS CreateRule
Prelude.Read, 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:
--
-- 'tags', 'createRule_tags' - The tags to assign to the rule.
--
-- 'listenerArn', 'createRule_listenerArn' - The Amazon Resource Name (ARN) of the listener.
--
-- 'conditions', 'createRule_conditions' - The conditions.
--
-- 'priority', 'createRule_priority' - The rule priority. A listener can\'t have multiple rules with the same
-- priority.
--
-- 'actions', 'createRule_actions' - The actions.
newCreateRule ::
  -- | 'listenerArn'
  Prelude.Text ->
  -- | 'priority'
  Prelude.Natural ->
  CreateRule
newCreateRule :: Text -> Natural -> CreateRule
newCreateRule Text
pListenerArn_ Natural
pPriority_ =
  CreateRule' :: Maybe (NonEmpty Tag)
-> Text -> [RuleCondition] -> Natural -> [Action] -> CreateRule
CreateRule'
    { $sel:tags:CreateRule' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:listenerArn:CreateRule' :: Text
listenerArn = Text
pListenerArn_,
      $sel:conditions:CreateRule' :: [RuleCondition]
conditions = [RuleCondition]
forall a. Monoid a => a
Prelude.mempty,
      $sel:priority:CreateRule' :: Natural
priority = Natural
pPriority_,
      $sel:actions:CreateRule' :: [Action]
actions = [Action]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The tags to assign to the rule.
createRule_tags :: Lens.Lens' CreateRule (Prelude.Maybe (Prelude.NonEmpty Tag))
createRule_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateRule -> f CreateRule
createRule_tags = (CreateRule -> Maybe (NonEmpty Tag))
-> (CreateRule -> Maybe (NonEmpty Tag) -> CreateRule)
-> Lens
     CreateRule CreateRule (Maybe (NonEmpty Tag)) (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateRule' :: CreateRule -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateRule
s@CreateRule' {} Maybe (NonEmpty Tag)
a -> CreateRule
s {$sel:tags:CreateRule' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateRule) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateRule -> f CreateRule)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateRule
-> f CreateRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty 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 (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the listener.
createRule_listenerArn :: Lens.Lens' CreateRule Prelude.Text
createRule_listenerArn :: (Text -> f Text) -> CreateRule -> f CreateRule
createRule_listenerArn = (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
listenerArn :: Text
$sel:listenerArn:CreateRule' :: CreateRule -> Text
listenerArn} -> Text
listenerArn) (\s :: CreateRule
s@CreateRule' {} Text
a -> CreateRule
s {$sel:listenerArn:CreateRule' :: Text
listenerArn = Text
a} :: CreateRule)

-- | The conditions.
createRule_conditions :: Lens.Lens' CreateRule [RuleCondition]
createRule_conditions :: ([RuleCondition] -> f [RuleCondition])
-> CreateRule -> f CreateRule
createRule_conditions = (CreateRule -> [RuleCondition])
-> (CreateRule -> [RuleCondition] -> CreateRule)
-> Lens CreateRule CreateRule [RuleCondition] [RuleCondition]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {[RuleCondition]
conditions :: [RuleCondition]
$sel:conditions:CreateRule' :: CreateRule -> [RuleCondition]
conditions} -> [RuleCondition]
conditions) (\s :: CreateRule
s@CreateRule' {} [RuleCondition]
a -> CreateRule
s {$sel:conditions:CreateRule' :: [RuleCondition]
conditions = [RuleCondition]
a} :: CreateRule) (([RuleCondition] -> f [RuleCondition])
 -> CreateRule -> f CreateRule)
-> (([RuleCondition] -> f [RuleCondition])
    -> [RuleCondition] -> f [RuleCondition])
-> ([RuleCondition] -> f [RuleCondition])
-> CreateRule
-> f CreateRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RuleCondition] -> f [RuleCondition])
-> [RuleCondition] -> f [RuleCondition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The rule priority. A listener can\'t have multiple rules with the same
-- priority.
createRule_priority :: Lens.Lens' CreateRule Prelude.Natural
createRule_priority :: (Natural -> f Natural) -> CreateRule -> f CreateRule
createRule_priority = (CreateRule -> Natural)
-> (CreateRule -> Natural -> CreateRule)
-> Lens CreateRule CreateRule Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {Natural
priority :: Natural
$sel:priority:CreateRule' :: CreateRule -> Natural
priority} -> Natural
priority) (\s :: CreateRule
s@CreateRule' {} Natural
a -> CreateRule
s {$sel:priority:CreateRule' :: Natural
priority = Natural
a} :: CreateRule)

-- | The actions.
createRule_actions :: Lens.Lens' CreateRule [Action]
createRule_actions :: ([Action] -> f [Action]) -> CreateRule -> f CreateRule
createRule_actions = (CreateRule -> [Action])
-> (CreateRule -> [Action] -> CreateRule)
-> Lens CreateRule CreateRule [Action] [Action]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRule' {[Action]
actions :: [Action]
$sel:actions:CreateRule' :: CreateRule -> [Action]
actions} -> [Action]
actions) (\s :: CreateRule
s@CreateRule' {} [Action]
a -> CreateRule
s {$sel:actions:CreateRule' :: [Action]
actions = [Action]
a} :: CreateRule) (([Action] -> f [Action]) -> CreateRule -> f CreateRule)
-> (([Action] -> f [Action]) -> [Action] -> f [Action])
-> ([Action] -> f [Action])
-> CreateRule
-> f CreateRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Action] -> f [Action]) -> [Action] -> f [Action]
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 => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRule)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateRule))
-> Logger
-> Service
-> Proxy CreateRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRule)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateRuleResult"
      ( \Int
s ResponseHeaders
h [Node]
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.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Rules" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [Rule]))
-> Either String (Maybe [Rule])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Rule])
-> [Node] -> Either String (Maybe [Rule])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Rule]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            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
forall a. Monoid a => a
Prelude.mempty

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 CreateRule' {Natural
[RuleCondition]
[Action]
Maybe (NonEmpty Tag)
Text
actions :: [Action]
priority :: Natural
conditions :: [RuleCondition]
listenerArn :: Text
tags :: Maybe (NonEmpty Tag)
$sel:actions:CreateRule' :: CreateRule -> [Action]
$sel:priority:CreateRule' :: CreateRule -> Natural
$sel:conditions:CreateRule' :: CreateRule -> [RuleCondition]
$sel:listenerArn:CreateRule' :: CreateRule -> Text
$sel:tags:CreateRule' :: CreateRule -> Maybe (NonEmpty Tag)
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateRule" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> NonEmpty Tag -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty Tag -> QueryString)
-> Maybe (NonEmpty Tag) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags),
        ByteString
"ListenerArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
listenerArn,
        ByteString
"Conditions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [RuleCondition] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [RuleCondition]
conditions,
        ByteString
"Priority" ByteString -> Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Natural
priority,
        ByteString
"Actions" ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Action] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Action]
actions
      ]

-- | /See:/ 'newCreateRuleResponse' smart constructor.
data CreateRuleResponse = CreateRuleResponse'
  { -- | Information about the rule.
    CreateRuleResponse -> Maybe [Rule]
rules :: 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:
--
-- 'rules', 'createRuleResponse_rules' - Information about the 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:rules:CreateRuleResponse' :: Maybe [Rule]
rules = Maybe [Rule]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the rule.
createRuleResponse_rules :: Lens.Lens' CreateRuleResponse (Prelude.Maybe [Rule])
createRuleResponse_rules :: (Maybe [Rule] -> f (Maybe [Rule]))
-> CreateRuleResponse -> f CreateRuleResponse
createRuleResponse_rules = (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]
rules :: Maybe [Rule]
$sel:rules:CreateRuleResponse' :: CreateRuleResponse -> Maybe [Rule]
rules} -> Maybe [Rule]
rules) (\s :: CreateRuleResponse
s@CreateRuleResponse' {} Maybe [Rule]
a -> CreateRuleResponse
s {$sel:rules:CreateRuleResponse' :: Maybe [Rule]
rules = Maybe [Rule]
a} :: CreateRuleResponse) ((Maybe [Rule] -> f (Maybe [Rule]))
 -> CreateRuleResponse -> f CreateRuleResponse)
-> ((Maybe [Rule] -> f (Maybe [Rule]))
    -> Maybe [Rule] -> f (Maybe [Rule]))
-> (Maybe [Rule] -> f (Maybe [Rule]))
-> CreateRuleResponse
-> f CreateRuleResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Rule] [Rule] [Rule] [Rule]
-> Iso (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule])
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 [Rule] [Rule] [Rule] [Rule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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