{-# 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.UsagePlan
-- 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.UsagePlan where

import Amazonka.APIGateway.Types.ApiStage
import Amazonka.APIGateway.Types.QuotaSettings
import Amazonka.APIGateway.Types.ThrottleSettings
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a usage plan than can specify who can assess associated API
-- stages with specified request limits and quotas.
--
-- In a usage plan, you associate an API by specifying the API\'s Id and a
-- stage name of the specified API. You add plan customers by adding API
-- keys to the plan.
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html Create and Use Usage Plans>
--
-- /See:/ 'newUsagePlan' smart constructor.
data UsagePlan = UsagePlan'
  { -- | The associated API stages of a usage plan.
    UsagePlan -> Maybe [ApiStage]
apiStages :: Prelude.Maybe [ApiStage],
    -- | The name of a usage plan.
    UsagePlan -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of a UsagePlan resource.
    UsagePlan -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The request throttle limits of a usage plan.
    UsagePlan -> Maybe ThrottleSettings
throttle :: Prelude.Maybe ThrottleSettings,
    -- | The maximum number of permitted requests per a given unit time interval.
    UsagePlan -> Maybe QuotaSettings
quota :: Prelude.Maybe QuotaSettings,
    -- | The description of a usage plan.
    UsagePlan -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The AWS Markeplace product identifier to associate with the usage plan
    -- as a SaaS product on AWS Marketplace.
    UsagePlan -> Maybe Text
productCode :: Prelude.Maybe Prelude.Text,
    -- | The collection of tags. Each tag element is associated with a given
    -- resource.
    UsagePlan -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (UsagePlan -> UsagePlan -> Bool
(UsagePlan -> UsagePlan -> Bool)
-> (UsagePlan -> UsagePlan -> Bool) -> Eq UsagePlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsagePlan -> UsagePlan -> Bool
$c/= :: UsagePlan -> UsagePlan -> Bool
== :: UsagePlan -> UsagePlan -> Bool
$c== :: UsagePlan -> UsagePlan -> Bool
Prelude.Eq, ReadPrec [UsagePlan]
ReadPrec UsagePlan
Int -> ReadS UsagePlan
ReadS [UsagePlan]
(Int -> ReadS UsagePlan)
-> ReadS [UsagePlan]
-> ReadPrec UsagePlan
-> ReadPrec [UsagePlan]
-> Read UsagePlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsagePlan]
$creadListPrec :: ReadPrec [UsagePlan]
readPrec :: ReadPrec UsagePlan
$creadPrec :: ReadPrec UsagePlan
readList :: ReadS [UsagePlan]
$creadList :: ReadS [UsagePlan]
readsPrec :: Int -> ReadS UsagePlan
$creadsPrec :: Int -> ReadS UsagePlan
Prelude.Read, Int -> UsagePlan -> ShowS
[UsagePlan] -> ShowS
UsagePlan -> String
(Int -> UsagePlan -> ShowS)
-> (UsagePlan -> String)
-> ([UsagePlan] -> ShowS)
-> Show UsagePlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsagePlan] -> ShowS
$cshowList :: [UsagePlan] -> ShowS
show :: UsagePlan -> String
$cshow :: UsagePlan -> String
showsPrec :: Int -> UsagePlan -> ShowS
$cshowsPrec :: Int -> UsagePlan -> ShowS
Prelude.Show, (forall x. UsagePlan -> Rep UsagePlan x)
-> (forall x. Rep UsagePlan x -> UsagePlan) -> Generic UsagePlan
forall x. Rep UsagePlan x -> UsagePlan
forall x. UsagePlan -> Rep UsagePlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsagePlan x -> UsagePlan
$cfrom :: forall x. UsagePlan -> Rep UsagePlan x
Prelude.Generic)

-- |
-- Create a value of 'UsagePlan' 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:
--
-- 'apiStages', 'usagePlan_apiStages' - The associated API stages of a usage plan.
--
-- 'name', 'usagePlan_name' - The name of a usage plan.
--
-- 'id', 'usagePlan_id' - The identifier of a UsagePlan resource.
--
-- 'throttle', 'usagePlan_throttle' - The request throttle limits of a usage plan.
--
-- 'quota', 'usagePlan_quota' - The maximum number of permitted requests per a given unit time interval.
--
-- 'description', 'usagePlan_description' - The description of a usage plan.
--
-- 'productCode', 'usagePlan_productCode' - The AWS Markeplace product identifier to associate with the usage plan
-- as a SaaS product on AWS Marketplace.
--
-- 'tags', 'usagePlan_tags' - The collection of tags. Each tag element is associated with a given
-- resource.
newUsagePlan ::
  UsagePlan
newUsagePlan :: UsagePlan
newUsagePlan =
  UsagePlan' :: Maybe [ApiStage]
-> Maybe Text
-> Maybe Text
-> Maybe ThrottleSettings
-> Maybe QuotaSettings
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> UsagePlan
UsagePlan'
    { $sel:apiStages:UsagePlan' :: Maybe [ApiStage]
apiStages = Maybe [ApiStage]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UsagePlan' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UsagePlan' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:throttle:UsagePlan' :: Maybe ThrottleSettings
throttle = Maybe ThrottleSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:quota:UsagePlan' :: Maybe QuotaSettings
quota = Maybe QuotaSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UsagePlan' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:productCode:UsagePlan' :: Maybe Text
productCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:UsagePlan' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The associated API stages of a usage plan.
usagePlan_apiStages :: Lens.Lens' UsagePlan (Prelude.Maybe [ApiStage])
usagePlan_apiStages :: (Maybe [ApiStage] -> f (Maybe [ApiStage]))
-> UsagePlan -> f UsagePlan
usagePlan_apiStages = (UsagePlan -> Maybe [ApiStage])
-> (UsagePlan -> Maybe [ApiStage] -> UsagePlan)
-> Lens UsagePlan UsagePlan (Maybe [ApiStage]) (Maybe [ApiStage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe [ApiStage]
apiStages :: Maybe [ApiStage]
$sel:apiStages:UsagePlan' :: UsagePlan -> Maybe [ApiStage]
apiStages} -> Maybe [ApiStage]
apiStages) (\s :: UsagePlan
s@UsagePlan' {} Maybe [ApiStage]
a -> UsagePlan
s {$sel:apiStages:UsagePlan' :: Maybe [ApiStage]
apiStages = Maybe [ApiStage]
a} :: UsagePlan) ((Maybe [ApiStage] -> f (Maybe [ApiStage]))
 -> UsagePlan -> f UsagePlan)
-> ((Maybe [ApiStage] -> f (Maybe [ApiStage]))
    -> Maybe [ApiStage] -> f (Maybe [ApiStage]))
-> (Maybe [ApiStage] -> f (Maybe [ApiStage]))
-> UsagePlan
-> f UsagePlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ApiStage] [ApiStage] [ApiStage] [ApiStage]
-> Iso
     (Maybe [ApiStage])
     (Maybe [ApiStage])
     (Maybe [ApiStage])
     (Maybe [ApiStage])
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 [ApiStage] [ApiStage] [ApiStage] [ApiStage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of a usage plan.
usagePlan_name :: Lens.Lens' UsagePlan (Prelude.Maybe Prelude.Text)
usagePlan_name :: (Maybe Text -> f (Maybe Text)) -> UsagePlan -> f UsagePlan
usagePlan_name = (UsagePlan -> Maybe Text)
-> (UsagePlan -> Maybe Text -> UsagePlan)
-> Lens UsagePlan UsagePlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe Text
name :: Maybe Text
$sel:name:UsagePlan' :: UsagePlan -> Maybe Text
name} -> Maybe Text
name) (\s :: UsagePlan
s@UsagePlan' {} Maybe Text
a -> UsagePlan
s {$sel:name:UsagePlan' :: Maybe Text
name = Maybe Text
a} :: UsagePlan)

-- | The identifier of a UsagePlan resource.
usagePlan_id :: Lens.Lens' UsagePlan (Prelude.Maybe Prelude.Text)
usagePlan_id :: (Maybe Text -> f (Maybe Text)) -> UsagePlan -> f UsagePlan
usagePlan_id = (UsagePlan -> Maybe Text)
-> (UsagePlan -> Maybe Text -> UsagePlan)
-> Lens UsagePlan UsagePlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe Text
id :: Maybe Text
$sel:id:UsagePlan' :: UsagePlan -> Maybe Text
id} -> Maybe Text
id) (\s :: UsagePlan
s@UsagePlan' {} Maybe Text
a -> UsagePlan
s {$sel:id:UsagePlan' :: Maybe Text
id = Maybe Text
a} :: UsagePlan)

-- | The request throttle limits of a usage plan.
usagePlan_throttle :: Lens.Lens' UsagePlan (Prelude.Maybe ThrottleSettings)
usagePlan_throttle :: (Maybe ThrottleSettings -> f (Maybe ThrottleSettings))
-> UsagePlan -> f UsagePlan
usagePlan_throttle = (UsagePlan -> Maybe ThrottleSettings)
-> (UsagePlan -> Maybe ThrottleSettings -> UsagePlan)
-> Lens
     UsagePlan
     UsagePlan
     (Maybe ThrottleSettings)
     (Maybe ThrottleSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe ThrottleSettings
throttle :: Maybe ThrottleSettings
$sel:throttle:UsagePlan' :: UsagePlan -> Maybe ThrottleSettings
throttle} -> Maybe ThrottleSettings
throttle) (\s :: UsagePlan
s@UsagePlan' {} Maybe ThrottleSettings
a -> UsagePlan
s {$sel:throttle:UsagePlan' :: Maybe ThrottleSettings
throttle = Maybe ThrottleSettings
a} :: UsagePlan)

-- | The maximum number of permitted requests per a given unit time interval.
usagePlan_quota :: Lens.Lens' UsagePlan (Prelude.Maybe QuotaSettings)
usagePlan_quota :: (Maybe QuotaSettings -> f (Maybe QuotaSettings))
-> UsagePlan -> f UsagePlan
usagePlan_quota = (UsagePlan -> Maybe QuotaSettings)
-> (UsagePlan -> Maybe QuotaSettings -> UsagePlan)
-> Lens
     UsagePlan UsagePlan (Maybe QuotaSettings) (Maybe QuotaSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe QuotaSettings
quota :: Maybe QuotaSettings
$sel:quota:UsagePlan' :: UsagePlan -> Maybe QuotaSettings
quota} -> Maybe QuotaSettings
quota) (\s :: UsagePlan
s@UsagePlan' {} Maybe QuotaSettings
a -> UsagePlan
s {$sel:quota:UsagePlan' :: Maybe QuotaSettings
quota = Maybe QuotaSettings
a} :: UsagePlan)

-- | The description of a usage plan.
usagePlan_description :: Lens.Lens' UsagePlan (Prelude.Maybe Prelude.Text)
usagePlan_description :: (Maybe Text -> f (Maybe Text)) -> UsagePlan -> f UsagePlan
usagePlan_description = (UsagePlan -> Maybe Text)
-> (UsagePlan -> Maybe Text -> UsagePlan)
-> Lens UsagePlan UsagePlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe Text
description :: Maybe Text
$sel:description:UsagePlan' :: UsagePlan -> Maybe Text
description} -> Maybe Text
description) (\s :: UsagePlan
s@UsagePlan' {} Maybe Text
a -> UsagePlan
s {$sel:description:UsagePlan' :: Maybe Text
description = Maybe Text
a} :: UsagePlan)

-- | The AWS Markeplace product identifier to associate with the usage plan
-- as a SaaS product on AWS Marketplace.
usagePlan_productCode :: Lens.Lens' UsagePlan (Prelude.Maybe Prelude.Text)
usagePlan_productCode :: (Maybe Text -> f (Maybe Text)) -> UsagePlan -> f UsagePlan
usagePlan_productCode = (UsagePlan -> Maybe Text)
-> (UsagePlan -> Maybe Text -> UsagePlan)
-> Lens UsagePlan UsagePlan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsagePlan' {Maybe Text
productCode :: Maybe Text
$sel:productCode:UsagePlan' :: UsagePlan -> Maybe Text
productCode} -> Maybe Text
productCode) (\s :: UsagePlan
s@UsagePlan' {} Maybe Text
a -> UsagePlan
s {$sel:productCode:UsagePlan' :: Maybe Text
productCode = Maybe Text
a} :: UsagePlan)

-- | The collection of tags. Each tag element is associated with a given
-- resource.
usagePlan_tags :: Lens.Lens' UsagePlan (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
usagePlan_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UsagePlan -> f UsagePlan
usagePlan_tags = (UsagePlan -> Maybe (HashMap Text Text))
-> (UsagePlan -> Maybe (HashMap Text Text) -> UsagePlan)
-> Lens
     UsagePlan
     UsagePlan
     (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 (\UsagePlan' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:UsagePlan' :: UsagePlan -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: UsagePlan
s@UsagePlan' {} Maybe (HashMap Text Text)
a -> UsagePlan
s {$sel:tags:UsagePlan' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: UsagePlan) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> UsagePlan -> f UsagePlan)
-> ((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)))
-> UsagePlan
-> f UsagePlan
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

instance Core.FromJSON UsagePlan where
  parseJSON :: Value -> Parser UsagePlan
parseJSON =
    String -> (Object -> Parser UsagePlan) -> Value -> Parser UsagePlan
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UsagePlan"
      ( \Object
x ->
          Maybe [ApiStage]
-> Maybe Text
-> Maybe Text
-> Maybe ThrottleSettings
-> Maybe QuotaSettings
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> UsagePlan
UsagePlan'
            (Maybe [ApiStage]
 -> Maybe Text
 -> Maybe Text
 -> Maybe ThrottleSettings
 -> Maybe QuotaSettings
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> UsagePlan)
-> Parser (Maybe [ApiStage])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ThrottleSettings
      -> Maybe QuotaSettings
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> UsagePlan)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ApiStage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"apiStages" Parser (Maybe (Maybe [ApiStage]))
-> Maybe [ApiStage] -> Parser (Maybe [ApiStage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ApiStage]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ThrottleSettings
   -> Maybe QuotaSettings
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> UsagePlan)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ThrottleSettings
      -> Maybe QuotaSettings
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> UsagePlan)
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
"name")
            Parser
  (Maybe Text
   -> Maybe ThrottleSettings
   -> Maybe QuotaSettings
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> UsagePlan)
-> Parser (Maybe Text)
-> Parser
     (Maybe ThrottleSettings
      -> Maybe QuotaSettings
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> UsagePlan)
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
"id")
            Parser
  (Maybe ThrottleSettings
   -> Maybe QuotaSettings
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> UsagePlan)
-> Parser (Maybe ThrottleSettings)
-> Parser
     (Maybe QuotaSettings
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> UsagePlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ThrottleSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"throttle")
            Parser
  (Maybe QuotaSettings
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> UsagePlan)
-> Parser (Maybe QuotaSettings)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe (HashMap Text Text) -> UsagePlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe QuotaSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"quota")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe (HashMap Text Text) -> UsagePlan)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe (HashMap Text Text) -> UsagePlan)
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
"description")
            Parser (Maybe Text -> Maybe (HashMap Text Text) -> UsagePlan)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> UsagePlan)
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
"productCode")
            Parser (Maybe (HashMap Text Text) -> UsagePlan)
-> Parser (Maybe (HashMap Text Text)) -> Parser UsagePlan
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable UsagePlan

instance Prelude.NFData UsagePlan