{-# 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.LicenseManager.Types.ConsumptionConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types.BorrowConfiguration
import Amazonka.LicenseManager.Types.ProvisionalConfiguration
import Amazonka.LicenseManager.Types.RenewType
import qualified Amazonka.Prelude as Prelude
data ConsumptionConfiguration = ConsumptionConfiguration'
{
ConsumptionConfiguration -> Maybe BorrowConfiguration
borrowConfiguration :: Prelude.Maybe BorrowConfiguration,
ConsumptionConfiguration -> Maybe ProvisionalConfiguration
provisionalConfiguration :: Prelude.Maybe ProvisionalConfiguration,
ConsumptionConfiguration -> Maybe RenewType
renewType :: Prelude.Maybe RenewType
}
deriving (ConsumptionConfiguration -> ConsumptionConfiguration -> Bool
(ConsumptionConfiguration -> ConsumptionConfiguration -> Bool)
-> (ConsumptionConfiguration -> ConsumptionConfiguration -> Bool)
-> Eq ConsumptionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConsumptionConfiguration -> ConsumptionConfiguration -> Bool
$c/= :: ConsumptionConfiguration -> ConsumptionConfiguration -> Bool
== :: ConsumptionConfiguration -> ConsumptionConfiguration -> Bool
$c== :: ConsumptionConfiguration -> ConsumptionConfiguration -> Bool
Prelude.Eq, ReadPrec [ConsumptionConfiguration]
ReadPrec ConsumptionConfiguration
Int -> ReadS ConsumptionConfiguration
ReadS [ConsumptionConfiguration]
(Int -> ReadS ConsumptionConfiguration)
-> ReadS [ConsumptionConfiguration]
-> ReadPrec ConsumptionConfiguration
-> ReadPrec [ConsumptionConfiguration]
-> Read ConsumptionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConsumptionConfiguration]
$creadListPrec :: ReadPrec [ConsumptionConfiguration]
readPrec :: ReadPrec ConsumptionConfiguration
$creadPrec :: ReadPrec ConsumptionConfiguration
readList :: ReadS [ConsumptionConfiguration]
$creadList :: ReadS [ConsumptionConfiguration]
readsPrec :: Int -> ReadS ConsumptionConfiguration
$creadsPrec :: Int -> ReadS ConsumptionConfiguration
Prelude.Read, Int -> ConsumptionConfiguration -> ShowS
[ConsumptionConfiguration] -> ShowS
ConsumptionConfiguration -> String
(Int -> ConsumptionConfiguration -> ShowS)
-> (ConsumptionConfiguration -> String)
-> ([ConsumptionConfiguration] -> ShowS)
-> Show ConsumptionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConsumptionConfiguration] -> ShowS
$cshowList :: [ConsumptionConfiguration] -> ShowS
show :: ConsumptionConfiguration -> String
$cshow :: ConsumptionConfiguration -> String
showsPrec :: Int -> ConsumptionConfiguration -> ShowS
$cshowsPrec :: Int -> ConsumptionConfiguration -> ShowS
Prelude.Show, (forall x.
ConsumptionConfiguration -> Rep ConsumptionConfiguration x)
-> (forall x.
Rep ConsumptionConfiguration x -> ConsumptionConfiguration)
-> Generic ConsumptionConfiguration
forall x.
Rep ConsumptionConfiguration x -> ConsumptionConfiguration
forall x.
ConsumptionConfiguration -> Rep ConsumptionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConsumptionConfiguration x -> ConsumptionConfiguration
$cfrom :: forall x.
ConsumptionConfiguration -> Rep ConsumptionConfiguration x
Prelude.Generic)
newConsumptionConfiguration ::
ConsumptionConfiguration
newConsumptionConfiguration :: ConsumptionConfiguration
newConsumptionConfiguration =
ConsumptionConfiguration' :: Maybe BorrowConfiguration
-> Maybe ProvisionalConfiguration
-> Maybe RenewType
-> ConsumptionConfiguration
ConsumptionConfiguration'
{ $sel:borrowConfiguration:ConsumptionConfiguration' :: Maybe BorrowConfiguration
borrowConfiguration =
Maybe BorrowConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:provisionalConfiguration:ConsumptionConfiguration' :: Maybe ProvisionalConfiguration
provisionalConfiguration = Maybe ProvisionalConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:renewType:ConsumptionConfiguration' :: Maybe RenewType
renewType = Maybe RenewType
forall a. Maybe a
Prelude.Nothing
}
consumptionConfiguration_borrowConfiguration :: Lens.Lens' ConsumptionConfiguration (Prelude.Maybe BorrowConfiguration)
consumptionConfiguration_borrowConfiguration :: (Maybe BorrowConfiguration -> f (Maybe BorrowConfiguration))
-> ConsumptionConfiguration -> f ConsumptionConfiguration
consumptionConfiguration_borrowConfiguration = (ConsumptionConfiguration -> Maybe BorrowConfiguration)
-> (ConsumptionConfiguration
-> Maybe BorrowConfiguration -> ConsumptionConfiguration)
-> Lens
ConsumptionConfiguration
ConsumptionConfiguration
(Maybe BorrowConfiguration)
(Maybe BorrowConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumptionConfiguration' {Maybe BorrowConfiguration
borrowConfiguration :: Maybe BorrowConfiguration
$sel:borrowConfiguration:ConsumptionConfiguration' :: ConsumptionConfiguration -> Maybe BorrowConfiguration
borrowConfiguration} -> Maybe BorrowConfiguration
borrowConfiguration) (\s :: ConsumptionConfiguration
s@ConsumptionConfiguration' {} Maybe BorrowConfiguration
a -> ConsumptionConfiguration
s {$sel:borrowConfiguration:ConsumptionConfiguration' :: Maybe BorrowConfiguration
borrowConfiguration = Maybe BorrowConfiguration
a} :: ConsumptionConfiguration)
consumptionConfiguration_provisionalConfiguration :: Lens.Lens' ConsumptionConfiguration (Prelude.Maybe ProvisionalConfiguration)
consumptionConfiguration_provisionalConfiguration :: (Maybe ProvisionalConfiguration
-> f (Maybe ProvisionalConfiguration))
-> ConsumptionConfiguration -> f ConsumptionConfiguration
consumptionConfiguration_provisionalConfiguration = (ConsumptionConfiguration -> Maybe ProvisionalConfiguration)
-> (ConsumptionConfiguration
-> Maybe ProvisionalConfiguration -> ConsumptionConfiguration)
-> Lens
ConsumptionConfiguration
ConsumptionConfiguration
(Maybe ProvisionalConfiguration)
(Maybe ProvisionalConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumptionConfiguration' {Maybe ProvisionalConfiguration
provisionalConfiguration :: Maybe ProvisionalConfiguration
$sel:provisionalConfiguration:ConsumptionConfiguration' :: ConsumptionConfiguration -> Maybe ProvisionalConfiguration
provisionalConfiguration} -> Maybe ProvisionalConfiguration
provisionalConfiguration) (\s :: ConsumptionConfiguration
s@ConsumptionConfiguration' {} Maybe ProvisionalConfiguration
a -> ConsumptionConfiguration
s {$sel:provisionalConfiguration:ConsumptionConfiguration' :: Maybe ProvisionalConfiguration
provisionalConfiguration = Maybe ProvisionalConfiguration
a} :: ConsumptionConfiguration)
consumptionConfiguration_renewType :: Lens.Lens' ConsumptionConfiguration (Prelude.Maybe RenewType)
consumptionConfiguration_renewType :: (Maybe RenewType -> f (Maybe RenewType))
-> ConsumptionConfiguration -> f ConsumptionConfiguration
consumptionConfiguration_renewType = (ConsumptionConfiguration -> Maybe RenewType)
-> (ConsumptionConfiguration
-> Maybe RenewType -> ConsumptionConfiguration)
-> Lens
ConsumptionConfiguration
ConsumptionConfiguration
(Maybe RenewType)
(Maybe RenewType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumptionConfiguration' {Maybe RenewType
renewType :: Maybe RenewType
$sel:renewType:ConsumptionConfiguration' :: ConsumptionConfiguration -> Maybe RenewType
renewType} -> Maybe RenewType
renewType) (\s :: ConsumptionConfiguration
s@ConsumptionConfiguration' {} Maybe RenewType
a -> ConsumptionConfiguration
s {$sel:renewType:ConsumptionConfiguration' :: Maybe RenewType
renewType = Maybe RenewType
a} :: ConsumptionConfiguration)
instance Core.FromJSON ConsumptionConfiguration where
parseJSON :: Value -> Parser ConsumptionConfiguration
parseJSON =
String
-> (Object -> Parser ConsumptionConfiguration)
-> Value
-> Parser ConsumptionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConsumptionConfiguration"
( \Object
x ->
Maybe BorrowConfiguration
-> Maybe ProvisionalConfiguration
-> Maybe RenewType
-> ConsumptionConfiguration
ConsumptionConfiguration'
(Maybe BorrowConfiguration
-> Maybe ProvisionalConfiguration
-> Maybe RenewType
-> ConsumptionConfiguration)
-> Parser (Maybe BorrowConfiguration)
-> Parser
(Maybe ProvisionalConfiguration
-> Maybe RenewType -> ConsumptionConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BorrowConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BorrowConfiguration")
Parser
(Maybe ProvisionalConfiguration
-> Maybe RenewType -> ConsumptionConfiguration)
-> Parser (Maybe ProvisionalConfiguration)
-> Parser (Maybe RenewType -> ConsumptionConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProvisionalConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisionalConfiguration")
Parser (Maybe RenewType -> ConsumptionConfiguration)
-> Parser (Maybe RenewType) -> Parser ConsumptionConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RenewType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RenewType")
)
instance Prelude.Hashable ConsumptionConfiguration
instance Prelude.NFData ConsumptionConfiguration
instance Core.ToJSON ConsumptionConfiguration where
toJSON :: ConsumptionConfiguration -> Value
toJSON ConsumptionConfiguration' {Maybe BorrowConfiguration
Maybe ProvisionalConfiguration
Maybe RenewType
renewType :: Maybe RenewType
provisionalConfiguration :: Maybe ProvisionalConfiguration
borrowConfiguration :: Maybe BorrowConfiguration
$sel:renewType:ConsumptionConfiguration' :: ConsumptionConfiguration -> Maybe RenewType
$sel:provisionalConfiguration:ConsumptionConfiguration' :: ConsumptionConfiguration -> Maybe ProvisionalConfiguration
$sel:borrowConfiguration:ConsumptionConfiguration' :: ConsumptionConfiguration -> Maybe BorrowConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"BorrowConfiguration" Text -> BorrowConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(BorrowConfiguration -> Pair)
-> Maybe BorrowConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BorrowConfiguration
borrowConfiguration,
(Text
"ProvisionalConfiguration" Text -> ProvisionalConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ProvisionalConfiguration -> Pair)
-> Maybe ProvisionalConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisionalConfiguration
provisionalConfiguration,
(Text
"RenewType" Text -> RenewType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RenewType -> Pair) -> Maybe RenewType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RenewType
renewType
]
)