{-# 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.APIGateway.Types.MethodSetting
-- 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.APIGateway.Types.MethodSetting where

import Amazonka.APIGateway.Types.UnauthorizedCacheControlHeaderStrategy
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the method setting properties.
--
-- /See:/ 'newMethodSetting' smart constructor.
data MethodSetting = MethodSetting'
  { -- | Specifies the time to live (TTL), in seconds, for cached responses. The
    -- higher the TTL, the longer the response will be cached. The PATCH path
    -- for this setting is @\/{method_setting_key}\/caching\/ttlInSeconds@, and
    -- the value is an integer.
    MethodSetting -> Maybe Int
cacheTtlInSeconds :: Prelude.Maybe Prelude.Int,
    -- | Specifies whether data trace logging is enabled for this method, which
    -- affects the log entries pushed to Amazon CloudWatch Logs. The PATCH path
    -- for this setting is @\/{method_setting_key}\/logging\/dataTrace@, and
    -- the value is a Boolean.
    MethodSetting -> Maybe Bool
dataTraceEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the throttling burst limit. The PATCH path for this setting is
    -- @\/{method_setting_key}\/throttling\/burstLimit@, and the value is an
    -- integer.
    MethodSetting -> Maybe Int
throttlingBurstLimit :: Prelude.Maybe Prelude.Int,
    -- | Specifies whether the cached responses are encrypted. The PATCH path for
    -- this setting is @\/{method_setting_key}\/caching\/dataEncrypted@, and
    -- the value is a Boolean.
    MethodSetting -> Maybe Bool
cacheDataEncrypted :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the logging level for this method, which affects the log
    -- entries pushed to Amazon CloudWatch Logs. The PATCH path for this
    -- setting is @\/{method_setting_key}\/logging\/loglevel@, and the
    -- available levels are @OFF@, @ERROR@, and @INFO@. Choose @ERROR@ to write
    -- only error-level entries to CloudWatch Logs, or choose @INFO@ to include
    -- all @ERROR@ events as well as extra informational events.
    MethodSetting -> Maybe Text
loggingLevel :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether authorization is required for a cache invalidation
    -- request. The PATCH path for this setting is
    -- @\/{method_setting_key}\/caching\/requireAuthorizationForCacheControl@,
    -- and the value is a Boolean.
    MethodSetting -> Maybe Bool
requireAuthorizationForCacheControl :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether responses should be cached and returned for requests.
    -- A cache cluster must be enabled on the stage for responses to be cached.
    -- The PATCH path for this setting is
    -- @\/{method_setting_key}\/caching\/enabled@, and the value is a Boolean.
    MethodSetting -> Maybe Bool
cachingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether Amazon CloudWatch metrics are enabled for this method.
    -- The PATCH path for this setting is
    -- @\/{method_setting_key}\/metrics\/enabled@, and the value is a Boolean.
    MethodSetting -> Maybe Bool
metricsEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the throttling rate limit. The PATCH path for this setting is
    -- @\/{method_setting_key}\/throttling\/rateLimit@, and the value is a
    -- double.
    MethodSetting -> Maybe Double
throttlingRateLimit :: Prelude.Maybe Prelude.Double,
    -- | Specifies how to handle unauthorized requests for cache invalidation.
    -- The PATCH path for this setting is
    -- @\/{method_setting_key}\/caching\/unauthorizedCacheControlHeaderStrategy@,
    -- and the available values are @FAIL_WITH_403@,
    -- @SUCCEED_WITH_RESPONSE_HEADER@, @SUCCEED_WITHOUT_RESPONSE_HEADER@.
    MethodSetting -> Maybe UnauthorizedCacheControlHeaderStrategy
unauthorizedCacheControlHeaderStrategy :: Prelude.Maybe UnauthorizedCacheControlHeaderStrategy
  }
  deriving (MethodSetting -> MethodSetting -> Bool
(MethodSetting -> MethodSetting -> Bool)
-> (MethodSetting -> MethodSetting -> Bool) -> Eq MethodSetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MethodSetting -> MethodSetting -> Bool
$c/= :: MethodSetting -> MethodSetting -> Bool
== :: MethodSetting -> MethodSetting -> Bool
$c== :: MethodSetting -> MethodSetting -> Bool
Prelude.Eq, ReadPrec [MethodSetting]
ReadPrec MethodSetting
Int -> ReadS MethodSetting
ReadS [MethodSetting]
(Int -> ReadS MethodSetting)
-> ReadS [MethodSetting]
-> ReadPrec MethodSetting
-> ReadPrec [MethodSetting]
-> Read MethodSetting
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MethodSetting]
$creadListPrec :: ReadPrec [MethodSetting]
readPrec :: ReadPrec MethodSetting
$creadPrec :: ReadPrec MethodSetting
readList :: ReadS [MethodSetting]
$creadList :: ReadS [MethodSetting]
readsPrec :: Int -> ReadS MethodSetting
$creadsPrec :: Int -> ReadS MethodSetting
Prelude.Read, Int -> MethodSetting -> ShowS
[MethodSetting] -> ShowS
MethodSetting -> String
(Int -> MethodSetting -> ShowS)
-> (MethodSetting -> String)
-> ([MethodSetting] -> ShowS)
-> Show MethodSetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MethodSetting] -> ShowS
$cshowList :: [MethodSetting] -> ShowS
show :: MethodSetting -> String
$cshow :: MethodSetting -> String
showsPrec :: Int -> MethodSetting -> ShowS
$cshowsPrec :: Int -> MethodSetting -> ShowS
Prelude.Show, (forall x. MethodSetting -> Rep MethodSetting x)
-> (forall x. Rep MethodSetting x -> MethodSetting)
-> Generic MethodSetting
forall x. Rep MethodSetting x -> MethodSetting
forall x. MethodSetting -> Rep MethodSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MethodSetting x -> MethodSetting
$cfrom :: forall x. MethodSetting -> Rep MethodSetting x
Prelude.Generic)

-- |
-- Create a value of 'MethodSetting' 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:
--
-- 'cacheTtlInSeconds', 'methodSetting_cacheTtlInSeconds' - Specifies the time to live (TTL), in seconds, for cached responses. The
-- higher the TTL, the longer the response will be cached. The PATCH path
-- for this setting is @\/{method_setting_key}\/caching\/ttlInSeconds@, and
-- the value is an integer.
--
-- 'dataTraceEnabled', 'methodSetting_dataTraceEnabled' - Specifies whether data trace logging is enabled for this method, which
-- affects the log entries pushed to Amazon CloudWatch Logs. The PATCH path
-- for this setting is @\/{method_setting_key}\/logging\/dataTrace@, and
-- the value is a Boolean.
--
-- 'throttlingBurstLimit', 'methodSetting_throttlingBurstLimit' - Specifies the throttling burst limit. The PATCH path for this setting is
-- @\/{method_setting_key}\/throttling\/burstLimit@, and the value is an
-- integer.
--
-- 'cacheDataEncrypted', 'methodSetting_cacheDataEncrypted' - Specifies whether the cached responses are encrypted. The PATCH path for
-- this setting is @\/{method_setting_key}\/caching\/dataEncrypted@, and
-- the value is a Boolean.
--
-- 'loggingLevel', 'methodSetting_loggingLevel' - Specifies the logging level for this method, which affects the log
-- entries pushed to Amazon CloudWatch Logs. The PATCH path for this
-- setting is @\/{method_setting_key}\/logging\/loglevel@, and the
-- available levels are @OFF@, @ERROR@, and @INFO@. Choose @ERROR@ to write
-- only error-level entries to CloudWatch Logs, or choose @INFO@ to include
-- all @ERROR@ events as well as extra informational events.
--
-- 'requireAuthorizationForCacheControl', 'methodSetting_requireAuthorizationForCacheControl' - Specifies whether authorization is required for a cache invalidation
-- request. The PATCH path for this setting is
-- @\/{method_setting_key}\/caching\/requireAuthorizationForCacheControl@,
-- and the value is a Boolean.
--
-- 'cachingEnabled', 'methodSetting_cachingEnabled' - Specifies whether responses should be cached and returned for requests.
-- A cache cluster must be enabled on the stage for responses to be cached.
-- The PATCH path for this setting is
-- @\/{method_setting_key}\/caching\/enabled@, and the value is a Boolean.
--
-- 'metricsEnabled', 'methodSetting_metricsEnabled' - Specifies whether Amazon CloudWatch metrics are enabled for this method.
-- The PATCH path for this setting is
-- @\/{method_setting_key}\/metrics\/enabled@, and the value is a Boolean.
--
-- 'throttlingRateLimit', 'methodSetting_throttlingRateLimit' - Specifies the throttling rate limit. The PATCH path for this setting is
-- @\/{method_setting_key}\/throttling\/rateLimit@, and the value is a
-- double.
--
-- 'unauthorizedCacheControlHeaderStrategy', 'methodSetting_unauthorizedCacheControlHeaderStrategy' - Specifies how to handle unauthorized requests for cache invalidation.
-- The PATCH path for this setting is
-- @\/{method_setting_key}\/caching\/unauthorizedCacheControlHeaderStrategy@,
-- and the available values are @FAIL_WITH_403@,
-- @SUCCEED_WITH_RESPONSE_HEADER@, @SUCCEED_WITHOUT_RESPONSE_HEADER@.
newMethodSetting ::
  MethodSetting
newMethodSetting :: MethodSetting
newMethodSetting =
  MethodSetting' :: Maybe Int
-> Maybe Bool
-> Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Double
-> Maybe UnauthorizedCacheControlHeaderStrategy
-> MethodSetting
MethodSetting'
    { $sel:cacheTtlInSeconds:MethodSetting' :: Maybe Int
cacheTtlInSeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:dataTraceEnabled:MethodSetting' :: Maybe Bool
dataTraceEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:throttlingBurstLimit:MethodSetting' :: Maybe Int
throttlingBurstLimit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheDataEncrypted:MethodSetting' :: Maybe Bool
cacheDataEncrypted = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:loggingLevel:MethodSetting' :: Maybe Text
loggingLevel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requireAuthorizationForCacheControl:MethodSetting' :: Maybe Bool
requireAuthorizationForCacheControl =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cachingEnabled:MethodSetting' :: Maybe Bool
cachingEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:metricsEnabled:MethodSetting' :: Maybe Bool
metricsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:throttlingRateLimit:MethodSetting' :: Maybe Double
throttlingRateLimit = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:unauthorizedCacheControlHeaderStrategy:MethodSetting' :: Maybe UnauthorizedCacheControlHeaderStrategy
unauthorizedCacheControlHeaderStrategy =
        Maybe UnauthorizedCacheControlHeaderStrategy
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the time to live (TTL), in seconds, for cached responses. The
-- higher the TTL, the longer the response will be cached. The PATCH path
-- for this setting is @\/{method_setting_key}\/caching\/ttlInSeconds@, and
-- the value is an integer.
methodSetting_cacheTtlInSeconds :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Int)
methodSetting_cacheTtlInSeconds :: (Maybe Int -> f (Maybe Int)) -> MethodSetting -> f MethodSetting
methodSetting_cacheTtlInSeconds = (MethodSetting -> Maybe Int)
-> (MethodSetting -> Maybe Int -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Int
cacheTtlInSeconds :: Maybe Int
$sel:cacheTtlInSeconds:MethodSetting' :: MethodSetting -> Maybe Int
cacheTtlInSeconds} -> Maybe Int
cacheTtlInSeconds) (\s :: MethodSetting
s@MethodSetting' {} Maybe Int
a -> MethodSetting
s {$sel:cacheTtlInSeconds:MethodSetting' :: Maybe Int
cacheTtlInSeconds = Maybe Int
a} :: MethodSetting)

-- | Specifies whether data trace logging is enabled for this method, which
-- affects the log entries pushed to Amazon CloudWatch Logs. The PATCH path
-- for this setting is @\/{method_setting_key}\/logging\/dataTrace@, and
-- the value is a Boolean.
methodSetting_dataTraceEnabled :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Bool)
methodSetting_dataTraceEnabled :: (Maybe Bool -> f (Maybe Bool)) -> MethodSetting -> f MethodSetting
methodSetting_dataTraceEnabled = (MethodSetting -> Maybe Bool)
-> (MethodSetting -> Maybe Bool -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Bool
dataTraceEnabled :: Maybe Bool
$sel:dataTraceEnabled:MethodSetting' :: MethodSetting -> Maybe Bool
dataTraceEnabled} -> Maybe Bool
dataTraceEnabled) (\s :: MethodSetting
s@MethodSetting' {} Maybe Bool
a -> MethodSetting
s {$sel:dataTraceEnabled:MethodSetting' :: Maybe Bool
dataTraceEnabled = Maybe Bool
a} :: MethodSetting)

-- | Specifies the throttling burst limit. The PATCH path for this setting is
-- @\/{method_setting_key}\/throttling\/burstLimit@, and the value is an
-- integer.
methodSetting_throttlingBurstLimit :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Int)
methodSetting_throttlingBurstLimit :: (Maybe Int -> f (Maybe Int)) -> MethodSetting -> f MethodSetting
methodSetting_throttlingBurstLimit = (MethodSetting -> Maybe Int)
-> (MethodSetting -> Maybe Int -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Int
throttlingBurstLimit :: Maybe Int
$sel:throttlingBurstLimit:MethodSetting' :: MethodSetting -> Maybe Int
throttlingBurstLimit} -> Maybe Int
throttlingBurstLimit) (\s :: MethodSetting
s@MethodSetting' {} Maybe Int
a -> MethodSetting
s {$sel:throttlingBurstLimit:MethodSetting' :: Maybe Int
throttlingBurstLimit = Maybe Int
a} :: MethodSetting)

-- | Specifies whether the cached responses are encrypted. The PATCH path for
-- this setting is @\/{method_setting_key}\/caching\/dataEncrypted@, and
-- the value is a Boolean.
methodSetting_cacheDataEncrypted :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Bool)
methodSetting_cacheDataEncrypted :: (Maybe Bool -> f (Maybe Bool)) -> MethodSetting -> f MethodSetting
methodSetting_cacheDataEncrypted = (MethodSetting -> Maybe Bool)
-> (MethodSetting -> Maybe Bool -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Bool
cacheDataEncrypted :: Maybe Bool
$sel:cacheDataEncrypted:MethodSetting' :: MethodSetting -> Maybe Bool
cacheDataEncrypted} -> Maybe Bool
cacheDataEncrypted) (\s :: MethodSetting
s@MethodSetting' {} Maybe Bool
a -> MethodSetting
s {$sel:cacheDataEncrypted:MethodSetting' :: Maybe Bool
cacheDataEncrypted = Maybe Bool
a} :: MethodSetting)

-- | Specifies the logging level for this method, which affects the log
-- entries pushed to Amazon CloudWatch Logs. The PATCH path for this
-- setting is @\/{method_setting_key}\/logging\/loglevel@, and the
-- available levels are @OFF@, @ERROR@, and @INFO@. Choose @ERROR@ to write
-- only error-level entries to CloudWatch Logs, or choose @INFO@ to include
-- all @ERROR@ events as well as extra informational events.
methodSetting_loggingLevel :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Text)
methodSetting_loggingLevel :: (Maybe Text -> f (Maybe Text)) -> MethodSetting -> f MethodSetting
methodSetting_loggingLevel = (MethodSetting -> Maybe Text)
-> (MethodSetting -> Maybe Text -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Text
loggingLevel :: Maybe Text
$sel:loggingLevel:MethodSetting' :: MethodSetting -> Maybe Text
loggingLevel} -> Maybe Text
loggingLevel) (\s :: MethodSetting
s@MethodSetting' {} Maybe Text
a -> MethodSetting
s {$sel:loggingLevel:MethodSetting' :: Maybe Text
loggingLevel = Maybe Text
a} :: MethodSetting)

-- | Specifies whether authorization is required for a cache invalidation
-- request. The PATCH path for this setting is
-- @\/{method_setting_key}\/caching\/requireAuthorizationForCacheControl@,
-- and the value is a Boolean.
methodSetting_requireAuthorizationForCacheControl :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Bool)
methodSetting_requireAuthorizationForCacheControl :: (Maybe Bool -> f (Maybe Bool)) -> MethodSetting -> f MethodSetting
methodSetting_requireAuthorizationForCacheControl = (MethodSetting -> Maybe Bool)
-> (MethodSetting -> Maybe Bool -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Bool
requireAuthorizationForCacheControl :: Maybe Bool
$sel:requireAuthorizationForCacheControl:MethodSetting' :: MethodSetting -> Maybe Bool
requireAuthorizationForCacheControl} -> Maybe Bool
requireAuthorizationForCacheControl) (\s :: MethodSetting
s@MethodSetting' {} Maybe Bool
a -> MethodSetting
s {$sel:requireAuthorizationForCacheControl:MethodSetting' :: Maybe Bool
requireAuthorizationForCacheControl = Maybe Bool
a} :: MethodSetting)

-- | Specifies whether responses should be cached and returned for requests.
-- A cache cluster must be enabled on the stage for responses to be cached.
-- The PATCH path for this setting is
-- @\/{method_setting_key}\/caching\/enabled@, and the value is a Boolean.
methodSetting_cachingEnabled :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Bool)
methodSetting_cachingEnabled :: (Maybe Bool -> f (Maybe Bool)) -> MethodSetting -> f MethodSetting
methodSetting_cachingEnabled = (MethodSetting -> Maybe Bool)
-> (MethodSetting -> Maybe Bool -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Bool
cachingEnabled :: Maybe Bool
$sel:cachingEnabled:MethodSetting' :: MethodSetting -> Maybe Bool
cachingEnabled} -> Maybe Bool
cachingEnabled) (\s :: MethodSetting
s@MethodSetting' {} Maybe Bool
a -> MethodSetting
s {$sel:cachingEnabled:MethodSetting' :: Maybe Bool
cachingEnabled = Maybe Bool
a} :: MethodSetting)

-- | Specifies whether Amazon CloudWatch metrics are enabled for this method.
-- The PATCH path for this setting is
-- @\/{method_setting_key}\/metrics\/enabled@, and the value is a Boolean.
methodSetting_metricsEnabled :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Bool)
methodSetting_metricsEnabled :: (Maybe Bool -> f (Maybe Bool)) -> MethodSetting -> f MethodSetting
methodSetting_metricsEnabled = (MethodSetting -> Maybe Bool)
-> (MethodSetting -> Maybe Bool -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Bool
metricsEnabled :: Maybe Bool
$sel:metricsEnabled:MethodSetting' :: MethodSetting -> Maybe Bool
metricsEnabled} -> Maybe Bool
metricsEnabled) (\s :: MethodSetting
s@MethodSetting' {} Maybe Bool
a -> MethodSetting
s {$sel:metricsEnabled:MethodSetting' :: Maybe Bool
metricsEnabled = Maybe Bool
a} :: MethodSetting)

-- | Specifies the throttling rate limit. The PATCH path for this setting is
-- @\/{method_setting_key}\/throttling\/rateLimit@, and the value is a
-- double.
methodSetting_throttlingRateLimit :: Lens.Lens' MethodSetting (Prelude.Maybe Prelude.Double)
methodSetting_throttlingRateLimit :: (Maybe Double -> f (Maybe Double))
-> MethodSetting -> f MethodSetting
methodSetting_throttlingRateLimit = (MethodSetting -> Maybe Double)
-> (MethodSetting -> Maybe Double -> MethodSetting)
-> Lens MethodSetting MethodSetting (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe Double
throttlingRateLimit :: Maybe Double
$sel:throttlingRateLimit:MethodSetting' :: MethodSetting -> Maybe Double
throttlingRateLimit} -> Maybe Double
throttlingRateLimit) (\s :: MethodSetting
s@MethodSetting' {} Maybe Double
a -> MethodSetting
s {$sel:throttlingRateLimit:MethodSetting' :: Maybe Double
throttlingRateLimit = Maybe Double
a} :: MethodSetting)

-- | Specifies how to handle unauthorized requests for cache invalidation.
-- The PATCH path for this setting is
-- @\/{method_setting_key}\/caching\/unauthorizedCacheControlHeaderStrategy@,
-- and the available values are @FAIL_WITH_403@,
-- @SUCCEED_WITH_RESPONSE_HEADER@, @SUCCEED_WITHOUT_RESPONSE_HEADER@.
methodSetting_unauthorizedCacheControlHeaderStrategy :: Lens.Lens' MethodSetting (Prelude.Maybe UnauthorizedCacheControlHeaderStrategy)
methodSetting_unauthorizedCacheControlHeaderStrategy :: (Maybe UnauthorizedCacheControlHeaderStrategy
 -> f (Maybe UnauthorizedCacheControlHeaderStrategy))
-> MethodSetting -> f MethodSetting
methodSetting_unauthorizedCacheControlHeaderStrategy = (MethodSetting -> Maybe UnauthorizedCacheControlHeaderStrategy)
-> (MethodSetting
    -> Maybe UnauthorizedCacheControlHeaderStrategy -> MethodSetting)
-> Lens
     MethodSetting
     MethodSetting
     (Maybe UnauthorizedCacheControlHeaderStrategy)
     (Maybe UnauthorizedCacheControlHeaderStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MethodSetting' {Maybe UnauthorizedCacheControlHeaderStrategy
unauthorizedCacheControlHeaderStrategy :: Maybe UnauthorizedCacheControlHeaderStrategy
$sel:unauthorizedCacheControlHeaderStrategy:MethodSetting' :: MethodSetting -> Maybe UnauthorizedCacheControlHeaderStrategy
unauthorizedCacheControlHeaderStrategy} -> Maybe UnauthorizedCacheControlHeaderStrategy
unauthorizedCacheControlHeaderStrategy) (\s :: MethodSetting
s@MethodSetting' {} Maybe UnauthorizedCacheControlHeaderStrategy
a -> MethodSetting
s {$sel:unauthorizedCacheControlHeaderStrategy:MethodSetting' :: Maybe UnauthorizedCacheControlHeaderStrategy
unauthorizedCacheControlHeaderStrategy = Maybe UnauthorizedCacheControlHeaderStrategy
a} :: MethodSetting)

instance Core.FromJSON MethodSetting where
  parseJSON :: Value -> Parser MethodSetting
parseJSON =
    String
-> (Object -> Parser MethodSetting)
-> Value
-> Parser MethodSetting
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MethodSetting"
      ( \Object
x ->
          Maybe Int
-> Maybe Bool
-> Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Double
-> Maybe UnauthorizedCacheControlHeaderStrategy
-> MethodSetting
MethodSetting'
            (Maybe Int
 -> Maybe Bool
 -> Maybe Int
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Double
 -> Maybe UnauthorizedCacheControlHeaderStrategy
 -> MethodSetting)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cacheTtlInSeconds")
            Parser
  (Maybe Bool
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Int
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataTraceEnabled")
            Parser
  (Maybe Int
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"throttlingBurstLimit")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cacheDataEncrypted")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"loggingLevel")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"requireAuthorizationForCacheControl")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy
      -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cachingEnabled")
            Parser
  (Maybe Bool
   -> Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy
   -> MethodSetting)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Double
      -> Maybe UnauthorizedCacheControlHeaderStrategy -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metricsEnabled")
            Parser
  (Maybe Double
   -> Maybe UnauthorizedCacheControlHeaderStrategy -> MethodSetting)
-> Parser (Maybe Double)
-> Parser
     (Maybe UnauthorizedCacheControlHeaderStrategy -> MethodSetting)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"throttlingRateLimit")
            Parser
  (Maybe UnauthorizedCacheControlHeaderStrategy -> MethodSetting)
-> Parser (Maybe UnauthorizedCacheControlHeaderStrategy)
-> Parser MethodSetting
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            Object
-> Text -> Parser (Maybe UnauthorizedCacheControlHeaderStrategy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"unauthorizedCacheControlHeaderStrategy"
                        )
      )

instance Prelude.Hashable MethodSetting

instance Prelude.NFData MethodSetting