{-# 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.XRay.Types.SamplingRuleUpdate
-- 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.XRay.Types.SamplingRuleUpdate where

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

-- | A document specifying changes to a sampling rule\'s configuration.
--
-- /See:/ 'newSamplingRuleUpdate' smart constructor.
data SamplingRuleUpdate = SamplingRuleUpdate'
  { -- | Matches the HTTP method of a request.
    SamplingRuleUpdate -> Maybe Text
hTTPMethod :: Prelude.Maybe Prelude.Text,
    -- | The priority of the sampling rule.
    SamplingRuleUpdate -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | The name of the sampling rule. Specify a rule by either name or ARN, but
    -- not both.
    SamplingRuleUpdate -> Maybe Text
ruleName :: Prelude.Maybe Prelude.Text,
    -- | A fixed number of matching requests to instrument per second, prior to
    -- applying the fixed rate. The reservoir is not used directly by services,
    -- but applies to all services using the rule collectively.
    SamplingRuleUpdate -> Maybe Int
reservoirSize :: Prelude.Maybe Prelude.Int,
    -- | The percentage of matching requests to instrument, after the reservoir
    -- is exhausted.
    SamplingRuleUpdate -> Maybe Double
fixedRate :: Prelude.Maybe Prelude.Double,
    -- | Matches the ARN of the Amazon Web Services resource on which the service
    -- runs.
    SamplingRuleUpdate -> Maybe Text
resourceARN :: Prelude.Maybe Prelude.Text,
    -- | Matches attributes derived from the request.
    SamplingRuleUpdate -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Matches the @name@ that the service uses to identify itself in segments.
    SamplingRuleUpdate -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text,
    -- | Matches the @origin@ that the service uses to identify its type in
    -- segments.
    SamplingRuleUpdate -> Maybe Text
serviceType :: Prelude.Maybe Prelude.Text,
    -- | Matches the hostname from a request URL.
    SamplingRuleUpdate -> Maybe Text
host :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the sampling rule. Specify a rule by either name or ARN, but
    -- not both.
    SamplingRuleUpdate -> Maybe Text
ruleARN :: Prelude.Maybe Prelude.Text,
    -- | Matches the path from a request URL.
    SamplingRuleUpdate -> Maybe Text
uRLPath :: Prelude.Maybe Prelude.Text
  }
  deriving (SamplingRuleUpdate -> SamplingRuleUpdate -> Bool
(SamplingRuleUpdate -> SamplingRuleUpdate -> Bool)
-> (SamplingRuleUpdate -> SamplingRuleUpdate -> Bool)
-> Eq SamplingRuleUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SamplingRuleUpdate -> SamplingRuleUpdate -> Bool
$c/= :: SamplingRuleUpdate -> SamplingRuleUpdate -> Bool
== :: SamplingRuleUpdate -> SamplingRuleUpdate -> Bool
$c== :: SamplingRuleUpdate -> SamplingRuleUpdate -> Bool
Prelude.Eq, ReadPrec [SamplingRuleUpdate]
ReadPrec SamplingRuleUpdate
Int -> ReadS SamplingRuleUpdate
ReadS [SamplingRuleUpdate]
(Int -> ReadS SamplingRuleUpdate)
-> ReadS [SamplingRuleUpdate]
-> ReadPrec SamplingRuleUpdate
-> ReadPrec [SamplingRuleUpdate]
-> Read SamplingRuleUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SamplingRuleUpdate]
$creadListPrec :: ReadPrec [SamplingRuleUpdate]
readPrec :: ReadPrec SamplingRuleUpdate
$creadPrec :: ReadPrec SamplingRuleUpdate
readList :: ReadS [SamplingRuleUpdate]
$creadList :: ReadS [SamplingRuleUpdate]
readsPrec :: Int -> ReadS SamplingRuleUpdate
$creadsPrec :: Int -> ReadS SamplingRuleUpdate
Prelude.Read, Int -> SamplingRuleUpdate -> ShowS
[SamplingRuleUpdate] -> ShowS
SamplingRuleUpdate -> String
(Int -> SamplingRuleUpdate -> ShowS)
-> (SamplingRuleUpdate -> String)
-> ([SamplingRuleUpdate] -> ShowS)
-> Show SamplingRuleUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SamplingRuleUpdate] -> ShowS
$cshowList :: [SamplingRuleUpdate] -> ShowS
show :: SamplingRuleUpdate -> String
$cshow :: SamplingRuleUpdate -> String
showsPrec :: Int -> SamplingRuleUpdate -> ShowS
$cshowsPrec :: Int -> SamplingRuleUpdate -> ShowS
Prelude.Show, (forall x. SamplingRuleUpdate -> Rep SamplingRuleUpdate x)
-> (forall x. Rep SamplingRuleUpdate x -> SamplingRuleUpdate)
-> Generic SamplingRuleUpdate
forall x. Rep SamplingRuleUpdate x -> SamplingRuleUpdate
forall x. SamplingRuleUpdate -> Rep SamplingRuleUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SamplingRuleUpdate x -> SamplingRuleUpdate
$cfrom :: forall x. SamplingRuleUpdate -> Rep SamplingRuleUpdate x
Prelude.Generic)

-- |
-- Create a value of 'SamplingRuleUpdate' 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:
--
-- 'hTTPMethod', 'samplingRuleUpdate_hTTPMethod' - Matches the HTTP method of a request.
--
-- 'priority', 'samplingRuleUpdate_priority' - The priority of the sampling rule.
--
-- 'ruleName', 'samplingRuleUpdate_ruleName' - The name of the sampling rule. Specify a rule by either name or ARN, but
-- not both.
--
-- 'reservoirSize', 'samplingRuleUpdate_reservoirSize' - A fixed number of matching requests to instrument per second, prior to
-- applying the fixed rate. The reservoir is not used directly by services,
-- but applies to all services using the rule collectively.
--
-- 'fixedRate', 'samplingRuleUpdate_fixedRate' - The percentage of matching requests to instrument, after the reservoir
-- is exhausted.
--
-- 'resourceARN', 'samplingRuleUpdate_resourceARN' - Matches the ARN of the Amazon Web Services resource on which the service
-- runs.
--
-- 'attributes', 'samplingRuleUpdate_attributes' - Matches attributes derived from the request.
--
-- 'serviceName', 'samplingRuleUpdate_serviceName' - Matches the @name@ that the service uses to identify itself in segments.
--
-- 'serviceType', 'samplingRuleUpdate_serviceType' - Matches the @origin@ that the service uses to identify its type in
-- segments.
--
-- 'host', 'samplingRuleUpdate_host' - Matches the hostname from a request URL.
--
-- 'ruleARN', 'samplingRuleUpdate_ruleARN' - The ARN of the sampling rule. Specify a rule by either name or ARN, but
-- not both.
--
-- 'uRLPath', 'samplingRuleUpdate_uRLPath' - Matches the path from a request URL.
newSamplingRuleUpdate ::
  SamplingRuleUpdate
newSamplingRuleUpdate :: SamplingRuleUpdate
newSamplingRuleUpdate =
  SamplingRuleUpdate' :: Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Double
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SamplingRuleUpdate
SamplingRuleUpdate'
    { $sel:hTTPMethod:SamplingRuleUpdate' :: Maybe Text
hTTPMethod = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:SamplingRuleUpdate' :: Maybe Int
priority = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleName:SamplingRuleUpdate' :: Maybe Text
ruleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reservoirSize:SamplingRuleUpdate' :: Maybe Int
reservoirSize = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:fixedRate:SamplingRuleUpdate' :: Maybe Double
fixedRate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceARN:SamplingRuleUpdate' :: Maybe Text
resourceARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:SamplingRuleUpdate' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:SamplingRuleUpdate' :: Maybe Text
serviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceType:SamplingRuleUpdate' :: Maybe Text
serviceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:host:SamplingRuleUpdate' :: Maybe Text
host = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleARN:SamplingRuleUpdate' :: Maybe Text
ruleARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:uRLPath:SamplingRuleUpdate' :: Maybe Text
uRLPath = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Matches the HTTP method of a request.
samplingRuleUpdate_hTTPMethod :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_hTTPMethod :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_hTTPMethod = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
hTTPMethod :: Maybe Text
$sel:hTTPMethod:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
hTTPMethod} -> Maybe Text
hTTPMethod) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:hTTPMethod:SamplingRuleUpdate' :: Maybe Text
hTTPMethod = Maybe Text
a} :: SamplingRuleUpdate)

-- | The priority of the sampling rule.
samplingRuleUpdate_priority :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Int)
samplingRuleUpdate_priority :: (Maybe Int -> f (Maybe Int))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_priority = (SamplingRuleUpdate -> Maybe Int)
-> (SamplingRuleUpdate -> Maybe Int -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Int
priority :: Maybe Int
$sel:priority:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Int
priority} -> Maybe Int
priority) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Int
a -> SamplingRuleUpdate
s {$sel:priority:SamplingRuleUpdate' :: Maybe Int
priority = Maybe Int
a} :: SamplingRuleUpdate)

-- | The name of the sampling rule. Specify a rule by either name or ARN, but
-- not both.
samplingRuleUpdate_ruleName :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_ruleName :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_ruleName = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
ruleName :: Maybe Text
$sel:ruleName:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
ruleName} -> Maybe Text
ruleName) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:ruleName:SamplingRuleUpdate' :: Maybe Text
ruleName = Maybe Text
a} :: SamplingRuleUpdate)

-- | A fixed number of matching requests to instrument per second, prior to
-- applying the fixed rate. The reservoir is not used directly by services,
-- but applies to all services using the rule collectively.
samplingRuleUpdate_reservoirSize :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Int)
samplingRuleUpdate_reservoirSize :: (Maybe Int -> f (Maybe Int))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_reservoirSize = (SamplingRuleUpdate -> Maybe Int)
-> (SamplingRuleUpdate -> Maybe Int -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Int
reservoirSize :: Maybe Int
$sel:reservoirSize:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Int
reservoirSize} -> Maybe Int
reservoirSize) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Int
a -> SamplingRuleUpdate
s {$sel:reservoirSize:SamplingRuleUpdate' :: Maybe Int
reservoirSize = Maybe Int
a} :: SamplingRuleUpdate)

-- | The percentage of matching requests to instrument, after the reservoir
-- is exhausted.
samplingRuleUpdate_fixedRate :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Double)
samplingRuleUpdate_fixedRate :: (Maybe Double -> f (Maybe Double))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_fixedRate = (SamplingRuleUpdate -> Maybe Double)
-> (SamplingRuleUpdate -> Maybe Double -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Double
fixedRate :: Maybe Double
$sel:fixedRate:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Double
fixedRate} -> Maybe Double
fixedRate) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Double
a -> SamplingRuleUpdate
s {$sel:fixedRate:SamplingRuleUpdate' :: Maybe Double
fixedRate = Maybe Double
a} :: SamplingRuleUpdate)

-- | Matches the ARN of the Amazon Web Services resource on which the service
-- runs.
samplingRuleUpdate_resourceARN :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_resourceARN :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_resourceARN = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
resourceARN :: Maybe Text
$sel:resourceARN:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
resourceARN} -> Maybe Text
resourceARN) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:resourceARN:SamplingRuleUpdate' :: Maybe Text
resourceARN = Maybe Text
a} :: SamplingRuleUpdate)

-- | Matches attributes derived from the request.
samplingRuleUpdate_attributes :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
samplingRuleUpdate_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_attributes = (SamplingRuleUpdate -> Maybe (HashMap Text Text))
-> (SamplingRuleUpdate
    -> Maybe (HashMap Text Text) -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate
     SamplingRuleUpdate
     (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 (\SamplingRuleUpdate' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe (HashMap Text Text)
a -> SamplingRuleUpdate
s {$sel:attributes:SamplingRuleUpdate' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: SamplingRuleUpdate) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> SamplingRuleUpdate -> f SamplingRuleUpdate)
-> ((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)))
-> SamplingRuleUpdate
-> f SamplingRuleUpdate
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

-- | Matches the @name@ that the service uses to identify itself in segments.
samplingRuleUpdate_serviceName :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_serviceName :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_serviceName = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:serviceName:SamplingRuleUpdate' :: Maybe Text
serviceName = Maybe Text
a} :: SamplingRuleUpdate)

-- | Matches the @origin@ that the service uses to identify its type in
-- segments.
samplingRuleUpdate_serviceType :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_serviceType :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_serviceType = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
serviceType :: Maybe Text
$sel:serviceType:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
serviceType} -> Maybe Text
serviceType) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:serviceType:SamplingRuleUpdate' :: Maybe Text
serviceType = Maybe Text
a} :: SamplingRuleUpdate)

-- | Matches the hostname from a request URL.
samplingRuleUpdate_host :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_host :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_host = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
host :: Maybe Text
$sel:host:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
host} -> Maybe Text
host) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:host:SamplingRuleUpdate' :: Maybe Text
host = Maybe Text
a} :: SamplingRuleUpdate)

-- | The ARN of the sampling rule. Specify a rule by either name or ARN, but
-- not both.
samplingRuleUpdate_ruleARN :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_ruleARN :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_ruleARN = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
ruleARN :: Maybe Text
$sel:ruleARN:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
ruleARN} -> Maybe Text
ruleARN) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:ruleARN:SamplingRuleUpdate' :: Maybe Text
ruleARN = Maybe Text
a} :: SamplingRuleUpdate)

-- | Matches the path from a request URL.
samplingRuleUpdate_uRLPath :: Lens.Lens' SamplingRuleUpdate (Prelude.Maybe Prelude.Text)
samplingRuleUpdate_uRLPath :: (Maybe Text -> f (Maybe Text))
-> SamplingRuleUpdate -> f SamplingRuleUpdate
samplingRuleUpdate_uRLPath = (SamplingRuleUpdate -> Maybe Text)
-> (SamplingRuleUpdate -> Maybe Text -> SamplingRuleUpdate)
-> Lens
     SamplingRuleUpdate SamplingRuleUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRuleUpdate' {Maybe Text
uRLPath :: Maybe Text
$sel:uRLPath:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
uRLPath} -> Maybe Text
uRLPath) (\s :: SamplingRuleUpdate
s@SamplingRuleUpdate' {} Maybe Text
a -> SamplingRuleUpdate
s {$sel:uRLPath:SamplingRuleUpdate' :: Maybe Text
uRLPath = Maybe Text
a} :: SamplingRuleUpdate)

instance Prelude.Hashable SamplingRuleUpdate

instance Prelude.NFData SamplingRuleUpdate

instance Core.ToJSON SamplingRuleUpdate where
  toJSON :: SamplingRuleUpdate -> Value
toJSON SamplingRuleUpdate' {Maybe Double
Maybe Int
Maybe Text
Maybe (HashMap Text Text)
uRLPath :: Maybe Text
ruleARN :: Maybe Text
host :: Maybe Text
serviceType :: Maybe Text
serviceName :: Maybe Text
attributes :: Maybe (HashMap Text Text)
resourceARN :: Maybe Text
fixedRate :: Maybe Double
reservoirSize :: Maybe Int
ruleName :: Maybe Text
priority :: Maybe Int
hTTPMethod :: Maybe Text
$sel:uRLPath:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:ruleARN:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:host:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:serviceType:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:serviceName:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:attributes:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe (HashMap Text Text)
$sel:resourceARN:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:fixedRate:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Double
$sel:reservoirSize:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Int
$sel:ruleName:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
$sel:priority:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Int
$sel:hTTPMethod:SamplingRuleUpdate' :: SamplingRuleUpdate -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HTTPMethod" 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
hTTPMethod,
            (Text
"Priority" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
priority,
            (Text
"RuleName" 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
ruleName,
            (Text
"ReservoirSize" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
reservoirSize,
            (Text
"FixedRate" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
fixedRate,
            (Text
"ResourceARN" 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
resourceARN,
            (Text
"Attributes" 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)
attributes,
            (Text
"ServiceName" 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
serviceName,
            (Text
"ServiceType" 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
serviceType,
            (Text
"Host" 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
host,
            (Text
"RuleARN" 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
ruleARN,
            (Text
"URLPath" 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
uRLPath
          ]
      )