{-# 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.Redshift.Types.UsageLimit
-- 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.Redshift.Types.UsageLimit where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.Tag
import Amazonka.Redshift.Types.UsageLimitBreachAction
import Amazonka.Redshift.Types.UsageLimitFeatureType
import Amazonka.Redshift.Types.UsageLimitLimitType
import Amazonka.Redshift.Types.UsageLimitPeriod

-- | Describes a usage limit object for a cluster.
--
-- /See:/ 'newUsageLimit' smart constructor.
data UsageLimit = UsageLimit'
  { -- | The limit amount. If time-based, this amount is in minutes. If
    -- data-based, this amount is in terabytes (TB).
    UsageLimit -> Maybe Integer
amount :: Prelude.Maybe Prelude.Integer,
    -- | The type of limit. Depending on the feature type, this can be based on a
    -- time duration or data size.
    UsageLimit -> Maybe UsageLimitLimitType
limitType :: Prelude.Maybe UsageLimitLimitType,
    -- | The identifier of the usage limit.
    UsageLimit -> Maybe Text
usageLimitId :: Prelude.Maybe Prelude.Text,
    -- | The time period that the amount applies to. A @weekly@ period begins on
    -- Sunday. The default is @monthly@.
    UsageLimit -> Maybe UsageLimitPeriod
period :: Prelude.Maybe UsageLimitPeriod,
    -- | The identifier of the cluster with a usage limit.
    UsageLimit -> Maybe Text
clusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The action that Amazon Redshift takes when the limit is reached.
    -- Possible values are:
    --
    -- -   __log__ - To log an event in a system table. The default is log.
    --
    -- -   __emit-metric__ - To emit CloudWatch metrics.
    --
    -- -   __disable__ - To disable the feature until the next usage period
    --     begins.
    UsageLimit -> Maybe UsageLimitBreachAction
breachAction :: Prelude.Maybe UsageLimitBreachAction,
    -- | The Amazon Redshift feature to which the limit applies.
    UsageLimit -> Maybe UsageLimitFeatureType
featureType :: Prelude.Maybe UsageLimitFeatureType,
    -- | A list of tag instances.
    UsageLimit -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (UsageLimit -> UsageLimit -> Bool
(UsageLimit -> UsageLimit -> Bool)
-> (UsageLimit -> UsageLimit -> Bool) -> Eq UsageLimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageLimit -> UsageLimit -> Bool
$c/= :: UsageLimit -> UsageLimit -> Bool
== :: UsageLimit -> UsageLimit -> Bool
$c== :: UsageLimit -> UsageLimit -> Bool
Prelude.Eq, ReadPrec [UsageLimit]
ReadPrec UsageLimit
Int -> ReadS UsageLimit
ReadS [UsageLimit]
(Int -> ReadS UsageLimit)
-> ReadS [UsageLimit]
-> ReadPrec UsageLimit
-> ReadPrec [UsageLimit]
-> Read UsageLimit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageLimit]
$creadListPrec :: ReadPrec [UsageLimit]
readPrec :: ReadPrec UsageLimit
$creadPrec :: ReadPrec UsageLimit
readList :: ReadS [UsageLimit]
$creadList :: ReadS [UsageLimit]
readsPrec :: Int -> ReadS UsageLimit
$creadsPrec :: Int -> ReadS UsageLimit
Prelude.Read, Int -> UsageLimit -> ShowS
[UsageLimit] -> ShowS
UsageLimit -> String
(Int -> UsageLimit -> ShowS)
-> (UsageLimit -> String)
-> ([UsageLimit] -> ShowS)
-> Show UsageLimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageLimit] -> ShowS
$cshowList :: [UsageLimit] -> ShowS
show :: UsageLimit -> String
$cshow :: UsageLimit -> String
showsPrec :: Int -> UsageLimit -> ShowS
$cshowsPrec :: Int -> UsageLimit -> ShowS
Prelude.Show, (forall x. UsageLimit -> Rep UsageLimit x)
-> (forall x. Rep UsageLimit x -> UsageLimit) -> Generic UsageLimit
forall x. Rep UsageLimit x -> UsageLimit
forall x. UsageLimit -> Rep UsageLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageLimit x -> UsageLimit
$cfrom :: forall x. UsageLimit -> Rep UsageLimit x
Prelude.Generic)

-- |
-- Create a value of 'UsageLimit' 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:
--
-- 'amount', 'usageLimit_amount' - The limit amount. If time-based, this amount is in minutes. If
-- data-based, this amount is in terabytes (TB).
--
-- 'limitType', 'usageLimit_limitType' - The type of limit. Depending on the feature type, this can be based on a
-- time duration or data size.
--
-- 'usageLimitId', 'usageLimit_usageLimitId' - The identifier of the usage limit.
--
-- 'period', 'usageLimit_period' - The time period that the amount applies to. A @weekly@ period begins on
-- Sunday. The default is @monthly@.
--
-- 'clusterIdentifier', 'usageLimit_clusterIdentifier' - The identifier of the cluster with a usage limit.
--
-- 'breachAction', 'usageLimit_breachAction' - The action that Amazon Redshift takes when the limit is reached.
-- Possible values are:
--
-- -   __log__ - To log an event in a system table. The default is log.
--
-- -   __emit-metric__ - To emit CloudWatch metrics.
--
-- -   __disable__ - To disable the feature until the next usage period
--     begins.
--
-- 'featureType', 'usageLimit_featureType' - The Amazon Redshift feature to which the limit applies.
--
-- 'tags', 'usageLimit_tags' - A list of tag instances.
newUsageLimit ::
  UsageLimit
newUsageLimit :: UsageLimit
newUsageLimit =
  UsageLimit' :: Maybe Integer
-> Maybe UsageLimitLimitType
-> Maybe Text
-> Maybe UsageLimitPeriod
-> Maybe Text
-> Maybe UsageLimitBreachAction
-> Maybe UsageLimitFeatureType
-> Maybe [Tag]
-> UsageLimit
UsageLimit'
    { $sel:amount:UsageLimit' :: Maybe Integer
amount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:limitType:UsageLimit' :: Maybe UsageLimitLimitType
limitType = Maybe UsageLimitLimitType
forall a. Maybe a
Prelude.Nothing,
      $sel:usageLimitId:UsageLimit' :: Maybe Text
usageLimitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:period:UsageLimit' :: Maybe UsageLimitPeriod
period = Maybe UsageLimitPeriod
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterIdentifier:UsageLimit' :: Maybe Text
clusterIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:breachAction:UsageLimit' :: Maybe UsageLimitBreachAction
breachAction = Maybe UsageLimitBreachAction
forall a. Maybe a
Prelude.Nothing,
      $sel:featureType:UsageLimit' :: Maybe UsageLimitFeatureType
featureType = Maybe UsageLimitFeatureType
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:UsageLimit' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | The limit amount. If time-based, this amount is in minutes. If
-- data-based, this amount is in terabytes (TB).
usageLimit_amount :: Lens.Lens' UsageLimit (Prelude.Maybe Prelude.Integer)
usageLimit_amount :: (Maybe Integer -> f (Maybe Integer)) -> UsageLimit -> f UsageLimit
usageLimit_amount = (UsageLimit -> Maybe Integer)
-> (UsageLimit -> Maybe Integer -> UsageLimit)
-> Lens UsageLimit UsageLimit (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe Integer
amount :: Maybe Integer
$sel:amount:UsageLimit' :: UsageLimit -> Maybe Integer
amount} -> Maybe Integer
amount) (\s :: UsageLimit
s@UsageLimit' {} Maybe Integer
a -> UsageLimit
s {$sel:amount:UsageLimit' :: Maybe Integer
amount = Maybe Integer
a} :: UsageLimit)

-- | The type of limit. Depending on the feature type, this can be based on a
-- time duration or data size.
usageLimit_limitType :: Lens.Lens' UsageLimit (Prelude.Maybe UsageLimitLimitType)
usageLimit_limitType :: (Maybe UsageLimitLimitType -> f (Maybe UsageLimitLimitType))
-> UsageLimit -> f UsageLimit
usageLimit_limitType = (UsageLimit -> Maybe UsageLimitLimitType)
-> (UsageLimit -> Maybe UsageLimitLimitType -> UsageLimit)
-> Lens
     UsageLimit
     UsageLimit
     (Maybe UsageLimitLimitType)
     (Maybe UsageLimitLimitType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe UsageLimitLimitType
limitType :: Maybe UsageLimitLimitType
$sel:limitType:UsageLimit' :: UsageLimit -> Maybe UsageLimitLimitType
limitType} -> Maybe UsageLimitLimitType
limitType) (\s :: UsageLimit
s@UsageLimit' {} Maybe UsageLimitLimitType
a -> UsageLimit
s {$sel:limitType:UsageLimit' :: Maybe UsageLimitLimitType
limitType = Maybe UsageLimitLimitType
a} :: UsageLimit)

-- | The identifier of the usage limit.
usageLimit_usageLimitId :: Lens.Lens' UsageLimit (Prelude.Maybe Prelude.Text)
usageLimit_usageLimitId :: (Maybe Text -> f (Maybe Text)) -> UsageLimit -> f UsageLimit
usageLimit_usageLimitId = (UsageLimit -> Maybe Text)
-> (UsageLimit -> Maybe Text -> UsageLimit)
-> Lens UsageLimit UsageLimit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe Text
usageLimitId :: Maybe Text
$sel:usageLimitId:UsageLimit' :: UsageLimit -> Maybe Text
usageLimitId} -> Maybe Text
usageLimitId) (\s :: UsageLimit
s@UsageLimit' {} Maybe Text
a -> UsageLimit
s {$sel:usageLimitId:UsageLimit' :: Maybe Text
usageLimitId = Maybe Text
a} :: UsageLimit)

-- | The time period that the amount applies to. A @weekly@ period begins on
-- Sunday. The default is @monthly@.
usageLimit_period :: Lens.Lens' UsageLimit (Prelude.Maybe UsageLimitPeriod)
usageLimit_period :: (Maybe UsageLimitPeriod -> f (Maybe UsageLimitPeriod))
-> UsageLimit -> f UsageLimit
usageLimit_period = (UsageLimit -> Maybe UsageLimitPeriod)
-> (UsageLimit -> Maybe UsageLimitPeriod -> UsageLimit)
-> Lens
     UsageLimit
     UsageLimit
     (Maybe UsageLimitPeriod)
     (Maybe UsageLimitPeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe UsageLimitPeriod
period :: Maybe UsageLimitPeriod
$sel:period:UsageLimit' :: UsageLimit -> Maybe UsageLimitPeriod
period} -> Maybe UsageLimitPeriod
period) (\s :: UsageLimit
s@UsageLimit' {} Maybe UsageLimitPeriod
a -> UsageLimit
s {$sel:period:UsageLimit' :: Maybe UsageLimitPeriod
period = Maybe UsageLimitPeriod
a} :: UsageLimit)

-- | The identifier of the cluster with a usage limit.
usageLimit_clusterIdentifier :: Lens.Lens' UsageLimit (Prelude.Maybe Prelude.Text)
usageLimit_clusterIdentifier :: (Maybe Text -> f (Maybe Text)) -> UsageLimit -> f UsageLimit
usageLimit_clusterIdentifier = (UsageLimit -> Maybe Text)
-> (UsageLimit -> Maybe Text -> UsageLimit)
-> Lens UsageLimit UsageLimit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe Text
clusterIdentifier :: Maybe Text
$sel:clusterIdentifier:UsageLimit' :: UsageLimit -> Maybe Text
clusterIdentifier} -> Maybe Text
clusterIdentifier) (\s :: UsageLimit
s@UsageLimit' {} Maybe Text
a -> UsageLimit
s {$sel:clusterIdentifier:UsageLimit' :: Maybe Text
clusterIdentifier = Maybe Text
a} :: UsageLimit)

-- | The action that Amazon Redshift takes when the limit is reached.
-- Possible values are:
--
-- -   __log__ - To log an event in a system table. The default is log.
--
-- -   __emit-metric__ - To emit CloudWatch metrics.
--
-- -   __disable__ - To disable the feature until the next usage period
--     begins.
usageLimit_breachAction :: Lens.Lens' UsageLimit (Prelude.Maybe UsageLimitBreachAction)
usageLimit_breachAction :: (Maybe UsageLimitBreachAction -> f (Maybe UsageLimitBreachAction))
-> UsageLimit -> f UsageLimit
usageLimit_breachAction = (UsageLimit -> Maybe UsageLimitBreachAction)
-> (UsageLimit -> Maybe UsageLimitBreachAction -> UsageLimit)
-> Lens
     UsageLimit
     UsageLimit
     (Maybe UsageLimitBreachAction)
     (Maybe UsageLimitBreachAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe UsageLimitBreachAction
breachAction :: Maybe UsageLimitBreachAction
$sel:breachAction:UsageLimit' :: UsageLimit -> Maybe UsageLimitBreachAction
breachAction} -> Maybe UsageLimitBreachAction
breachAction) (\s :: UsageLimit
s@UsageLimit' {} Maybe UsageLimitBreachAction
a -> UsageLimit
s {$sel:breachAction:UsageLimit' :: Maybe UsageLimitBreachAction
breachAction = Maybe UsageLimitBreachAction
a} :: UsageLimit)

-- | The Amazon Redshift feature to which the limit applies.
usageLimit_featureType :: Lens.Lens' UsageLimit (Prelude.Maybe UsageLimitFeatureType)
usageLimit_featureType :: (Maybe UsageLimitFeatureType -> f (Maybe UsageLimitFeatureType))
-> UsageLimit -> f UsageLimit
usageLimit_featureType = (UsageLimit -> Maybe UsageLimitFeatureType)
-> (UsageLimit -> Maybe UsageLimitFeatureType -> UsageLimit)
-> Lens
     UsageLimit
     UsageLimit
     (Maybe UsageLimitFeatureType)
     (Maybe UsageLimitFeatureType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe UsageLimitFeatureType
featureType :: Maybe UsageLimitFeatureType
$sel:featureType:UsageLimit' :: UsageLimit -> Maybe UsageLimitFeatureType
featureType} -> Maybe UsageLimitFeatureType
featureType) (\s :: UsageLimit
s@UsageLimit' {} Maybe UsageLimitFeatureType
a -> UsageLimit
s {$sel:featureType:UsageLimit' :: Maybe UsageLimitFeatureType
featureType = Maybe UsageLimitFeatureType
a} :: UsageLimit)

-- | A list of tag instances.
usageLimit_tags :: Lens.Lens' UsageLimit (Prelude.Maybe [Tag])
usageLimit_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> UsageLimit -> f UsageLimit
usageLimit_tags = (UsageLimit -> Maybe [Tag])
-> (UsageLimit -> Maybe [Tag] -> UsageLimit)
-> Lens UsageLimit UsageLimit (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageLimit' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:UsageLimit' :: UsageLimit -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: UsageLimit
s@UsageLimit' {} Maybe [Tag]
a -> UsageLimit
s {$sel:tags:UsageLimit' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: UsageLimit) ((Maybe [Tag] -> f (Maybe [Tag])) -> UsageLimit -> f UsageLimit)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> UsageLimit
-> f UsageLimit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromXML UsageLimit where
  parseXML :: [Node] -> Either String UsageLimit
parseXML [Node]
x =
    Maybe Integer
-> Maybe UsageLimitLimitType
-> Maybe Text
-> Maybe UsageLimitPeriod
-> Maybe Text
-> Maybe UsageLimitBreachAction
-> Maybe UsageLimitFeatureType
-> Maybe [Tag]
-> UsageLimit
UsageLimit'
      (Maybe Integer
 -> Maybe UsageLimitLimitType
 -> Maybe Text
 -> Maybe UsageLimitPeriod
 -> Maybe Text
 -> Maybe UsageLimitBreachAction
 -> Maybe UsageLimitFeatureType
 -> Maybe [Tag]
 -> UsageLimit)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe UsageLimitLimitType
      -> Maybe Text
      -> Maybe UsageLimitPeriod
      -> Maybe Text
      -> Maybe UsageLimitBreachAction
      -> Maybe UsageLimitFeatureType
      -> Maybe [Tag]
      -> UsageLimit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Amount")
      Either
  String
  (Maybe UsageLimitLimitType
   -> Maybe Text
   -> Maybe UsageLimitPeriod
   -> Maybe Text
   -> Maybe UsageLimitBreachAction
   -> Maybe UsageLimitFeatureType
   -> Maybe [Tag]
   -> UsageLimit)
-> Either String (Maybe UsageLimitLimitType)
-> Either
     String
     (Maybe Text
      -> Maybe UsageLimitPeriod
      -> Maybe Text
      -> Maybe UsageLimitBreachAction
      -> Maybe UsageLimitFeatureType
      -> Maybe [Tag]
      -> UsageLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe UsageLimitLimitType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LimitType")
      Either
  String
  (Maybe Text
   -> Maybe UsageLimitPeriod
   -> Maybe Text
   -> Maybe UsageLimitBreachAction
   -> Maybe UsageLimitFeatureType
   -> Maybe [Tag]
   -> UsageLimit)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe UsageLimitPeriod
      -> Maybe Text
      -> Maybe UsageLimitBreachAction
      -> Maybe UsageLimitFeatureType
      -> Maybe [Tag]
      -> UsageLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UsageLimitId")
      Either
  String
  (Maybe UsageLimitPeriod
   -> Maybe Text
   -> Maybe UsageLimitBreachAction
   -> Maybe UsageLimitFeatureType
   -> Maybe [Tag]
   -> UsageLimit)
-> Either String (Maybe UsageLimitPeriod)
-> Either
     String
     (Maybe Text
      -> Maybe UsageLimitBreachAction
      -> Maybe UsageLimitFeatureType
      -> Maybe [Tag]
      -> UsageLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe UsageLimitPeriod)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Period")
      Either
  String
  (Maybe Text
   -> Maybe UsageLimitBreachAction
   -> Maybe UsageLimitFeatureType
   -> Maybe [Tag]
   -> UsageLimit)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe UsageLimitBreachAction
      -> Maybe UsageLimitFeatureType -> Maybe [Tag] -> UsageLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ClusterIdentifier")
      Either
  String
  (Maybe UsageLimitBreachAction
   -> Maybe UsageLimitFeatureType -> Maybe [Tag] -> UsageLimit)
-> Either String (Maybe UsageLimitBreachAction)
-> Either
     String (Maybe UsageLimitFeatureType -> Maybe [Tag] -> UsageLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe UsageLimitBreachAction)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"BreachAction")
      Either
  String (Maybe UsageLimitFeatureType -> Maybe [Tag] -> UsageLimit)
-> Either String (Maybe UsageLimitFeatureType)
-> Either String (Maybe [Tag] -> UsageLimit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe UsageLimitFeatureType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FeatureType")
      Either String (Maybe [Tag] -> UsageLimit)
-> Either String (Maybe [Tag]) -> Either String UsageLimit
forall (f :: * -> *) a b. Applicative f => 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
"Tags" 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 [Tag]))
-> Either String (Maybe [Tag])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Tag])
-> [Node] -> Either String (Maybe [Tag])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Tag")
                  )

instance Prelude.Hashable UsageLimit

instance Prelude.NFData UsageLimit