{-# 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.Usage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Usage = Usage'
{
Usage -> Maybe Text
usagePlanId :: Prelude.Maybe Prelude.Text,
Usage -> Maybe Text
endDate :: Prelude.Maybe Prelude.Text,
Usage -> Maybe (HashMap Text [[Integer]])
items :: Prelude.Maybe (Prelude.HashMap Prelude.Text [[Prelude.Integer]]),
Usage -> Maybe Text
startDate :: Prelude.Maybe Prelude.Text,
Usage -> Maybe Text
position :: Prelude.Maybe Prelude.Text
}
deriving (Usage -> Usage -> Bool
(Usage -> Usage -> Bool) -> (Usage -> Usage -> Bool) -> Eq Usage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Usage -> Usage -> Bool
$c/= :: Usage -> Usage -> Bool
== :: Usage -> Usage -> Bool
$c== :: Usage -> Usage -> Bool
Prelude.Eq, ReadPrec [Usage]
ReadPrec Usage
Int -> ReadS Usage
ReadS [Usage]
(Int -> ReadS Usage)
-> ReadS [Usage]
-> ReadPrec Usage
-> ReadPrec [Usage]
-> Read Usage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Usage]
$creadListPrec :: ReadPrec [Usage]
readPrec :: ReadPrec Usage
$creadPrec :: ReadPrec Usage
readList :: ReadS [Usage]
$creadList :: ReadS [Usage]
readsPrec :: Int -> ReadS Usage
$creadsPrec :: Int -> ReadS Usage
Prelude.Read, Int -> Usage -> ShowS
[Usage] -> ShowS
Usage -> String
(Int -> Usage -> ShowS)
-> (Usage -> String) -> ([Usage] -> ShowS) -> Show Usage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Usage] -> ShowS
$cshowList :: [Usage] -> ShowS
show :: Usage -> String
$cshow :: Usage -> String
showsPrec :: Int -> Usage -> ShowS
$cshowsPrec :: Int -> Usage -> ShowS
Prelude.Show, (forall x. Usage -> Rep Usage x)
-> (forall x. Rep Usage x -> Usage) -> Generic Usage
forall x. Rep Usage x -> Usage
forall x. Usage -> Rep Usage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Usage x -> Usage
$cfrom :: forall x. Usage -> Rep Usage x
Prelude.Generic)
newUsage ::
Usage
newUsage :: Usage
newUsage =
Usage' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text [[Integer]])
-> Maybe Text
-> Maybe Text
-> Usage
Usage'
{ $sel:usagePlanId:Usage' :: Maybe Text
usagePlanId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:endDate:Usage' :: Maybe Text
endDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:items:Usage' :: Maybe (HashMap Text [[Integer]])
items = Maybe (HashMap Text [[Integer]])
forall a. Maybe a
Prelude.Nothing,
$sel:startDate:Usage' :: Maybe Text
startDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:position:Usage' :: Maybe Text
position = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
usage_usagePlanId :: Lens.Lens' Usage (Prelude.Maybe Prelude.Text)
usage_usagePlanId :: (Maybe Text -> f (Maybe Text)) -> Usage -> f Usage
usage_usagePlanId = (Usage -> Maybe Text)
-> (Usage -> Maybe Text -> Usage)
-> Lens Usage Usage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Text
usagePlanId :: Maybe Text
$sel:usagePlanId:Usage' :: Usage -> Maybe Text
usagePlanId} -> Maybe Text
usagePlanId) (\s :: Usage
s@Usage' {} Maybe Text
a -> Usage
s {$sel:usagePlanId:Usage' :: Maybe Text
usagePlanId = Maybe Text
a} :: Usage)
usage_endDate :: Lens.Lens' Usage (Prelude.Maybe Prelude.Text)
usage_endDate :: (Maybe Text -> f (Maybe Text)) -> Usage -> f Usage
usage_endDate = (Usage -> Maybe Text)
-> (Usage -> Maybe Text -> Usage)
-> Lens Usage Usage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Text
endDate :: Maybe Text
$sel:endDate:Usage' :: Usage -> Maybe Text
endDate} -> Maybe Text
endDate) (\s :: Usage
s@Usage' {} Maybe Text
a -> Usage
s {$sel:endDate:Usage' :: Maybe Text
endDate = Maybe Text
a} :: Usage)
usage_items :: Lens.Lens' Usage (Prelude.Maybe (Prelude.HashMap Prelude.Text [[Prelude.Integer]]))
usage_items :: (Maybe (HashMap Text [[Integer]])
-> f (Maybe (HashMap Text [[Integer]])))
-> Usage -> f Usage
usage_items = (Usage -> Maybe (HashMap Text [[Integer]]))
-> (Usage -> Maybe (HashMap Text [[Integer]]) -> Usage)
-> Lens
Usage
Usage
(Maybe (HashMap Text [[Integer]]))
(Maybe (HashMap Text [[Integer]]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe (HashMap Text [[Integer]])
items :: Maybe (HashMap Text [[Integer]])
$sel:items:Usage' :: Usage -> Maybe (HashMap Text [[Integer]])
items} -> Maybe (HashMap Text [[Integer]])
items) (\s :: Usage
s@Usage' {} Maybe (HashMap Text [[Integer]])
a -> Usage
s {$sel:items:Usage' :: Maybe (HashMap Text [[Integer]])
items = Maybe (HashMap Text [[Integer]])
a} :: Usage) ((Maybe (HashMap Text [[Integer]])
-> f (Maybe (HashMap Text [[Integer]])))
-> Usage -> f Usage)
-> ((Maybe (HashMap Text [[Integer]])
-> f (Maybe (HashMap Text [[Integer]])))
-> Maybe (HashMap Text [[Integer]])
-> f (Maybe (HashMap Text [[Integer]])))
-> (Maybe (HashMap Text [[Integer]])
-> f (Maybe (HashMap Text [[Integer]])))
-> Usage
-> f Usage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text [[Integer]])
(HashMap Text [[Integer]])
(HashMap Text [[Integer]])
(HashMap Text [[Integer]])
-> Iso
(Maybe (HashMap Text [[Integer]]))
(Maybe (HashMap Text [[Integer]]))
(Maybe (HashMap Text [[Integer]]))
(Maybe (HashMap Text [[Integer]]))
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 [[Integer]])
(HashMap Text [[Integer]])
(HashMap Text [[Integer]])
(HashMap Text [[Integer]])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
usage_startDate :: Lens.Lens' Usage (Prelude.Maybe Prelude.Text)
usage_startDate :: (Maybe Text -> f (Maybe Text)) -> Usage -> f Usage
usage_startDate = (Usage -> Maybe Text)
-> (Usage -> Maybe Text -> Usage)
-> Lens Usage Usage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Text
startDate :: Maybe Text
$sel:startDate:Usage' :: Usage -> Maybe Text
startDate} -> Maybe Text
startDate) (\s :: Usage
s@Usage' {} Maybe Text
a -> Usage
s {$sel:startDate:Usage' :: Maybe Text
startDate = Maybe Text
a} :: Usage)
usage_position :: Lens.Lens' Usage (Prelude.Maybe Prelude.Text)
usage_position :: (Maybe Text -> f (Maybe Text)) -> Usage -> f Usage
usage_position = (Usage -> Maybe Text)
-> (Usage -> Maybe Text -> Usage)
-> Lens Usage Usage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Text
position :: Maybe Text
$sel:position:Usage' :: Usage -> Maybe Text
position} -> Maybe Text
position) (\s :: Usage
s@Usage' {} Maybe Text
a -> Usage
s {$sel:position:Usage' :: Maybe Text
position = Maybe Text
a} :: Usage)
instance Core.FromJSON Usage where
parseJSON :: Value -> Parser Usage
parseJSON =
String -> (Object -> Parser Usage) -> Value -> Parser Usage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Usage"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe (HashMap Text [[Integer]])
-> Maybe Text
-> Maybe Text
-> Usage
Usage'
(Maybe Text
-> Maybe Text
-> Maybe (HashMap Text [[Integer]])
-> Maybe Text
-> Maybe Text
-> Usage)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe (HashMap Text [[Integer]])
-> Maybe Text
-> Maybe Text
-> Usage)
forall (f :: * -> *) a b. Functor 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
"usagePlanId")
Parser
(Maybe Text
-> Maybe (HashMap Text [[Integer]])
-> Maybe Text
-> Maybe Text
-> Usage)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text [[Integer]])
-> Maybe Text -> Maybe Text -> Usage)
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
"endDate")
Parser
(Maybe (HashMap Text [[Integer]])
-> Maybe Text -> Maybe Text -> Usage)
-> Parser (Maybe (HashMap Text [[Integer]]))
-> Parser (Maybe Text -> Maybe Text -> Usage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text [[Integer]])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"values" Parser (Maybe (Maybe (HashMap Text [[Integer]])))
-> Maybe (HashMap Text [[Integer]])
-> Parser (Maybe (HashMap Text [[Integer]]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text [[Integer]])
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe Text -> Usage)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Usage)
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
"startDate")
Parser (Maybe Text -> Usage) -> Parser (Maybe Text) -> Parser Usage
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
"position")
)
instance Prelude.Hashable Usage
instance Prelude.NFData Usage