{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.RulePriorityPair
-- 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)
module Amazonka.ELBV2.Types.RulePriorityPair where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the priorities for the rules for a listener.
--
-- /See:/ 'newRulePriorityPair' smart constructor.
data RulePriorityPair = RulePriorityPair'
  { -- | The rule priority.
    RulePriorityPair -> Maybe Natural
priority :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the rule.
    RulePriorityPair -> Maybe Text
ruleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (RulePriorityPair -> RulePriorityPair -> Bool
(RulePriorityPair -> RulePriorityPair -> Bool)
-> (RulePriorityPair -> RulePriorityPair -> Bool)
-> Eq RulePriorityPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RulePriorityPair -> RulePriorityPair -> Bool
$c/= :: RulePriorityPair -> RulePriorityPair -> Bool
== :: RulePriorityPair -> RulePriorityPair -> Bool
$c== :: RulePriorityPair -> RulePriorityPair -> Bool
Prelude.Eq, ReadPrec [RulePriorityPair]
ReadPrec RulePriorityPair
Int -> ReadS RulePriorityPair
ReadS [RulePriorityPair]
(Int -> ReadS RulePriorityPair)
-> ReadS [RulePriorityPair]
-> ReadPrec RulePriorityPair
-> ReadPrec [RulePriorityPair]
-> Read RulePriorityPair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RulePriorityPair]
$creadListPrec :: ReadPrec [RulePriorityPair]
readPrec :: ReadPrec RulePriorityPair
$creadPrec :: ReadPrec RulePriorityPair
readList :: ReadS [RulePriorityPair]
$creadList :: ReadS [RulePriorityPair]
readsPrec :: Int -> ReadS RulePriorityPair
$creadsPrec :: Int -> ReadS RulePriorityPair
Prelude.Read, Int -> RulePriorityPair -> ShowS
[RulePriorityPair] -> ShowS
RulePriorityPair -> String
(Int -> RulePriorityPair -> ShowS)
-> (RulePriorityPair -> String)
-> ([RulePriorityPair] -> ShowS)
-> Show RulePriorityPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RulePriorityPair] -> ShowS
$cshowList :: [RulePriorityPair] -> ShowS
show :: RulePriorityPair -> String
$cshow :: RulePriorityPair -> String
showsPrec :: Int -> RulePriorityPair -> ShowS
$cshowsPrec :: Int -> RulePriorityPair -> ShowS
Prelude.Show, (forall x. RulePriorityPair -> Rep RulePriorityPair x)
-> (forall x. Rep RulePriorityPair x -> RulePriorityPair)
-> Generic RulePriorityPair
forall x. Rep RulePriorityPair x -> RulePriorityPair
forall x. RulePriorityPair -> Rep RulePriorityPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RulePriorityPair x -> RulePriorityPair
$cfrom :: forall x. RulePriorityPair -> Rep RulePriorityPair x
Prelude.Generic)

-- |
-- Create a value of 'RulePriorityPair' 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:
--
-- 'priority', 'rulePriorityPair_priority' - The rule priority.
--
-- 'ruleArn', 'rulePriorityPair_ruleArn' - The Amazon Resource Name (ARN) of the rule.
newRulePriorityPair ::
  RulePriorityPair
newRulePriorityPair :: RulePriorityPair
newRulePriorityPair =
  RulePriorityPair' :: Maybe Natural -> Maybe Text -> RulePriorityPair
RulePriorityPair'
    { $sel:priority:RulePriorityPair' :: Maybe Natural
priority = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleArn:RulePriorityPair' :: Maybe Text
ruleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The rule priority.
rulePriorityPair_priority :: Lens.Lens' RulePriorityPair (Prelude.Maybe Prelude.Natural)
rulePriorityPair_priority :: (Maybe Natural -> f (Maybe Natural))
-> RulePriorityPair -> f RulePriorityPair
rulePriorityPair_priority = (RulePriorityPair -> Maybe Natural)
-> (RulePriorityPair -> Maybe Natural -> RulePriorityPair)
-> Lens
     RulePriorityPair RulePriorityPair (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulePriorityPair' {Maybe Natural
priority :: Maybe Natural
$sel:priority:RulePriorityPair' :: RulePriorityPair -> Maybe Natural
priority} -> Maybe Natural
priority) (\s :: RulePriorityPair
s@RulePriorityPair' {} Maybe Natural
a -> RulePriorityPair
s {$sel:priority:RulePriorityPair' :: Maybe Natural
priority = Maybe Natural
a} :: RulePriorityPair)

-- | The Amazon Resource Name (ARN) of the rule.
rulePriorityPair_ruleArn :: Lens.Lens' RulePriorityPair (Prelude.Maybe Prelude.Text)
rulePriorityPair_ruleArn :: (Maybe Text -> f (Maybe Text))
-> RulePriorityPair -> f RulePriorityPair
rulePriorityPair_ruleArn = (RulePriorityPair -> Maybe Text)
-> (RulePriorityPair -> Maybe Text -> RulePriorityPair)
-> Lens RulePriorityPair RulePriorityPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulePriorityPair' {Maybe Text
ruleArn :: Maybe Text
$sel:ruleArn:RulePriorityPair' :: RulePriorityPair -> Maybe Text
ruleArn} -> Maybe Text
ruleArn) (\s :: RulePriorityPair
s@RulePriorityPair' {} Maybe Text
a -> RulePriorityPair
s {$sel:ruleArn:RulePriorityPair' :: Maybe Text
ruleArn = Maybe Text
a} :: RulePriorityPair)

instance Prelude.Hashable RulePriorityPair

instance Prelude.NFData RulePriorityPair

instance Core.ToQuery RulePriorityPair where
  toQuery :: RulePriorityPair -> QueryString
toQuery RulePriorityPair' {Maybe Natural
Maybe Text
ruleArn :: Maybe Text
priority :: Maybe Natural
$sel:ruleArn:RulePriorityPair' :: RulePriorityPair -> Maybe Text
$sel:priority:RulePriorityPair' :: RulePriorityPair -> Maybe Natural
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Priority" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
priority,
        ByteString
"RuleArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
ruleArn
      ]