{-# 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 #-}
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
data UsagePlan = UsagePlan'
{
UsagePlan -> Maybe [ApiStage]
apiStages :: Prelude.Maybe [ApiStage],
UsagePlan -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UsagePlan -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
UsagePlan -> Maybe ThrottleSettings
throttle :: Prelude.Maybe ThrottleSettings,
UsagePlan -> Maybe QuotaSettings
quota :: Prelude.Maybe QuotaSettings,
UsagePlan -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UsagePlan -> Maybe Text
productCode :: Prelude.Maybe Prelude.Text,
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)
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
}
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
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)
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)
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)
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)
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)
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)
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