{-# 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.AppStream.Types.UsageReportSubscription where
import Amazonka.AppStream.Types.LastReportGenerationExecutionError
import Amazonka.AppStream.Types.UsageReportSchedule
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UsageReportSubscription = UsageReportSubscription'
{
UsageReportSubscription -> Maybe POSIX
lastGeneratedReportDate :: Prelude.Maybe Core.POSIX,
UsageReportSubscription -> Maybe UsageReportSchedule
schedule :: Prelude.Maybe UsageReportSchedule,
UsageReportSubscription
-> Maybe [LastReportGenerationExecutionError]
subscriptionErrors :: Prelude.Maybe [LastReportGenerationExecutionError],
UsageReportSubscription -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text
}
deriving (UsageReportSubscription -> UsageReportSubscription -> Bool
(UsageReportSubscription -> UsageReportSubscription -> Bool)
-> (UsageReportSubscription -> UsageReportSubscription -> Bool)
-> Eq UsageReportSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageReportSubscription -> UsageReportSubscription -> Bool
$c/= :: UsageReportSubscription -> UsageReportSubscription -> Bool
== :: UsageReportSubscription -> UsageReportSubscription -> Bool
$c== :: UsageReportSubscription -> UsageReportSubscription -> Bool
Prelude.Eq, ReadPrec [UsageReportSubscription]
ReadPrec UsageReportSubscription
Int -> ReadS UsageReportSubscription
ReadS [UsageReportSubscription]
(Int -> ReadS UsageReportSubscription)
-> ReadS [UsageReportSubscription]
-> ReadPrec UsageReportSubscription
-> ReadPrec [UsageReportSubscription]
-> Read UsageReportSubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageReportSubscription]
$creadListPrec :: ReadPrec [UsageReportSubscription]
readPrec :: ReadPrec UsageReportSubscription
$creadPrec :: ReadPrec UsageReportSubscription
readList :: ReadS [UsageReportSubscription]
$creadList :: ReadS [UsageReportSubscription]
readsPrec :: Int -> ReadS UsageReportSubscription
$creadsPrec :: Int -> ReadS UsageReportSubscription
Prelude.Read, Int -> UsageReportSubscription -> ShowS
[UsageReportSubscription] -> ShowS
UsageReportSubscription -> String
(Int -> UsageReportSubscription -> ShowS)
-> (UsageReportSubscription -> String)
-> ([UsageReportSubscription] -> ShowS)
-> Show UsageReportSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageReportSubscription] -> ShowS
$cshowList :: [UsageReportSubscription] -> ShowS
show :: UsageReportSubscription -> String
$cshow :: UsageReportSubscription -> String
showsPrec :: Int -> UsageReportSubscription -> ShowS
$cshowsPrec :: Int -> UsageReportSubscription -> ShowS
Prelude.Show, (forall x.
UsageReportSubscription -> Rep UsageReportSubscription x)
-> (forall x.
Rep UsageReportSubscription x -> UsageReportSubscription)
-> Generic UsageReportSubscription
forall x. Rep UsageReportSubscription x -> UsageReportSubscription
forall x. UsageReportSubscription -> Rep UsageReportSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageReportSubscription x -> UsageReportSubscription
$cfrom :: forall x. UsageReportSubscription -> Rep UsageReportSubscription x
Prelude.Generic)
newUsageReportSubscription ::
UsageReportSubscription
newUsageReportSubscription :: UsageReportSubscription
newUsageReportSubscription =
UsageReportSubscription' :: Maybe POSIX
-> Maybe UsageReportSchedule
-> Maybe [LastReportGenerationExecutionError]
-> Maybe Text
-> UsageReportSubscription
UsageReportSubscription'
{ $sel:lastGeneratedReportDate:UsageReportSubscription' :: Maybe POSIX
lastGeneratedReportDate =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:schedule:UsageReportSubscription' :: Maybe UsageReportSchedule
schedule = Maybe UsageReportSchedule
forall a. Maybe a
Prelude.Nothing,
$sel:subscriptionErrors:UsageReportSubscription' :: Maybe [LastReportGenerationExecutionError]
subscriptionErrors = Maybe [LastReportGenerationExecutionError]
forall a. Maybe a
Prelude.Nothing,
$sel:s3BucketName:UsageReportSubscription' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
usageReportSubscription_lastGeneratedReportDate :: Lens.Lens' UsageReportSubscription (Prelude.Maybe Prelude.UTCTime)
usageReportSubscription_lastGeneratedReportDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> UsageReportSubscription -> f UsageReportSubscription
usageReportSubscription_lastGeneratedReportDate = (UsageReportSubscription -> Maybe POSIX)
-> (UsageReportSubscription
-> Maybe POSIX -> UsageReportSubscription)
-> Lens
UsageReportSubscription
UsageReportSubscription
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageReportSubscription' {Maybe POSIX
lastGeneratedReportDate :: Maybe POSIX
$sel:lastGeneratedReportDate:UsageReportSubscription' :: UsageReportSubscription -> Maybe POSIX
lastGeneratedReportDate} -> Maybe POSIX
lastGeneratedReportDate) (\s :: UsageReportSubscription
s@UsageReportSubscription' {} Maybe POSIX
a -> UsageReportSubscription
s {$sel:lastGeneratedReportDate:UsageReportSubscription' :: Maybe POSIX
lastGeneratedReportDate = Maybe POSIX
a} :: UsageReportSubscription) ((Maybe POSIX -> f (Maybe POSIX))
-> UsageReportSubscription -> f UsageReportSubscription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UsageReportSubscription
-> f UsageReportSubscription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
usageReportSubscription_schedule :: Lens.Lens' UsageReportSubscription (Prelude.Maybe UsageReportSchedule)
usageReportSubscription_schedule :: (Maybe UsageReportSchedule -> f (Maybe UsageReportSchedule))
-> UsageReportSubscription -> f UsageReportSubscription
usageReportSubscription_schedule = (UsageReportSubscription -> Maybe UsageReportSchedule)
-> (UsageReportSubscription
-> Maybe UsageReportSchedule -> UsageReportSubscription)
-> Lens
UsageReportSubscription
UsageReportSubscription
(Maybe UsageReportSchedule)
(Maybe UsageReportSchedule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageReportSubscription' {Maybe UsageReportSchedule
schedule :: Maybe UsageReportSchedule
$sel:schedule:UsageReportSubscription' :: UsageReportSubscription -> Maybe UsageReportSchedule
schedule} -> Maybe UsageReportSchedule
schedule) (\s :: UsageReportSubscription
s@UsageReportSubscription' {} Maybe UsageReportSchedule
a -> UsageReportSubscription
s {$sel:schedule:UsageReportSubscription' :: Maybe UsageReportSchedule
schedule = Maybe UsageReportSchedule
a} :: UsageReportSubscription)
usageReportSubscription_subscriptionErrors :: Lens.Lens' UsageReportSubscription (Prelude.Maybe [LastReportGenerationExecutionError])
usageReportSubscription_subscriptionErrors :: (Maybe [LastReportGenerationExecutionError]
-> f (Maybe [LastReportGenerationExecutionError]))
-> UsageReportSubscription -> f UsageReportSubscription
usageReportSubscription_subscriptionErrors = (UsageReportSubscription
-> Maybe [LastReportGenerationExecutionError])
-> (UsageReportSubscription
-> Maybe [LastReportGenerationExecutionError]
-> UsageReportSubscription)
-> Lens
UsageReportSubscription
UsageReportSubscription
(Maybe [LastReportGenerationExecutionError])
(Maybe [LastReportGenerationExecutionError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageReportSubscription' {Maybe [LastReportGenerationExecutionError]
subscriptionErrors :: Maybe [LastReportGenerationExecutionError]
$sel:subscriptionErrors:UsageReportSubscription' :: UsageReportSubscription
-> Maybe [LastReportGenerationExecutionError]
subscriptionErrors} -> Maybe [LastReportGenerationExecutionError]
subscriptionErrors) (\s :: UsageReportSubscription
s@UsageReportSubscription' {} Maybe [LastReportGenerationExecutionError]
a -> UsageReportSubscription
s {$sel:subscriptionErrors:UsageReportSubscription' :: Maybe [LastReportGenerationExecutionError]
subscriptionErrors = Maybe [LastReportGenerationExecutionError]
a} :: UsageReportSubscription) ((Maybe [LastReportGenerationExecutionError]
-> f (Maybe [LastReportGenerationExecutionError]))
-> UsageReportSubscription -> f UsageReportSubscription)
-> ((Maybe [LastReportGenerationExecutionError]
-> f (Maybe [LastReportGenerationExecutionError]))
-> Maybe [LastReportGenerationExecutionError]
-> f (Maybe [LastReportGenerationExecutionError]))
-> (Maybe [LastReportGenerationExecutionError]
-> f (Maybe [LastReportGenerationExecutionError]))
-> UsageReportSubscription
-> f UsageReportSubscription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[LastReportGenerationExecutionError]
[LastReportGenerationExecutionError]
[LastReportGenerationExecutionError]
[LastReportGenerationExecutionError]
-> Iso
(Maybe [LastReportGenerationExecutionError])
(Maybe [LastReportGenerationExecutionError])
(Maybe [LastReportGenerationExecutionError])
(Maybe [LastReportGenerationExecutionError])
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
[LastReportGenerationExecutionError]
[LastReportGenerationExecutionError]
[LastReportGenerationExecutionError]
[LastReportGenerationExecutionError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
usageReportSubscription_s3BucketName :: Lens.Lens' UsageReportSubscription (Prelude.Maybe Prelude.Text)
usageReportSubscription_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> UsageReportSubscription -> f UsageReportSubscription
usageReportSubscription_s3BucketName = (UsageReportSubscription -> Maybe Text)
-> (UsageReportSubscription
-> Maybe Text -> UsageReportSubscription)
-> Lens
UsageReportSubscription
UsageReportSubscription
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageReportSubscription' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:UsageReportSubscription' :: UsageReportSubscription -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: UsageReportSubscription
s@UsageReportSubscription' {} Maybe Text
a -> UsageReportSubscription
s {$sel:s3BucketName:UsageReportSubscription' :: Maybe Text
s3BucketName = Maybe Text
a} :: UsageReportSubscription)
instance Core.FromJSON UsageReportSubscription where
parseJSON :: Value -> Parser UsageReportSubscription
parseJSON =
String
-> (Object -> Parser UsageReportSubscription)
-> Value
-> Parser UsageReportSubscription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"UsageReportSubscription"
( \Object
x ->
Maybe POSIX
-> Maybe UsageReportSchedule
-> Maybe [LastReportGenerationExecutionError]
-> Maybe Text
-> UsageReportSubscription
UsageReportSubscription'
(Maybe POSIX
-> Maybe UsageReportSchedule
-> Maybe [LastReportGenerationExecutionError]
-> Maybe Text
-> UsageReportSubscription)
-> Parser (Maybe POSIX)
-> Parser
(Maybe UsageReportSchedule
-> Maybe [LastReportGenerationExecutionError]
-> Maybe Text
-> UsageReportSubscription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastGeneratedReportDate")
Parser
(Maybe UsageReportSchedule
-> Maybe [LastReportGenerationExecutionError]
-> Maybe Text
-> UsageReportSubscription)
-> Parser (Maybe UsageReportSchedule)
-> Parser
(Maybe [LastReportGenerationExecutionError]
-> Maybe Text -> UsageReportSubscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UsageReportSchedule)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Schedule")
Parser
(Maybe [LastReportGenerationExecutionError]
-> Maybe Text -> UsageReportSubscription)
-> Parser (Maybe [LastReportGenerationExecutionError])
-> Parser (Maybe Text -> UsageReportSubscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe [LastReportGenerationExecutionError]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubscriptionErrors"
Parser (Maybe (Maybe [LastReportGenerationExecutionError]))
-> Maybe [LastReportGenerationExecutionError]
-> Parser (Maybe [LastReportGenerationExecutionError])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LastReportGenerationExecutionError]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Text -> UsageReportSubscription)
-> Parser (Maybe Text) -> Parser UsageReportSubscription
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
"S3BucketName")
)
instance Prelude.Hashable UsageReportSubscription
instance Prelude.NFData UsageReportSubscription