{-# 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.SMS.Types.LaunchDetails
-- 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.SMS.Types.LaunchDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about the latest launch of an application.
--
-- /See:/ 'newLaunchDetails' smart constructor.
data LaunchDetails = LaunchDetails'
  { -- | The ID of the latest stack launched for this application.
    LaunchDetails -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text,
    -- | The latest time that this application was launched successfully.
    LaunchDetails -> Maybe POSIX
latestLaunchTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the latest stack launched for this application.
    LaunchDetails -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text
  }
  deriving (LaunchDetails -> LaunchDetails -> Bool
(LaunchDetails -> LaunchDetails -> Bool)
-> (LaunchDetails -> LaunchDetails -> Bool) -> Eq LaunchDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchDetails -> LaunchDetails -> Bool
$c/= :: LaunchDetails -> LaunchDetails -> Bool
== :: LaunchDetails -> LaunchDetails -> Bool
$c== :: LaunchDetails -> LaunchDetails -> Bool
Prelude.Eq, ReadPrec [LaunchDetails]
ReadPrec LaunchDetails
Int -> ReadS LaunchDetails
ReadS [LaunchDetails]
(Int -> ReadS LaunchDetails)
-> ReadS [LaunchDetails]
-> ReadPrec LaunchDetails
-> ReadPrec [LaunchDetails]
-> Read LaunchDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchDetails]
$creadListPrec :: ReadPrec [LaunchDetails]
readPrec :: ReadPrec LaunchDetails
$creadPrec :: ReadPrec LaunchDetails
readList :: ReadS [LaunchDetails]
$creadList :: ReadS [LaunchDetails]
readsPrec :: Int -> ReadS LaunchDetails
$creadsPrec :: Int -> ReadS LaunchDetails
Prelude.Read, Int -> LaunchDetails -> ShowS
[LaunchDetails] -> ShowS
LaunchDetails -> String
(Int -> LaunchDetails -> ShowS)
-> (LaunchDetails -> String)
-> ([LaunchDetails] -> ShowS)
-> Show LaunchDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchDetails] -> ShowS
$cshowList :: [LaunchDetails] -> ShowS
show :: LaunchDetails -> String
$cshow :: LaunchDetails -> String
showsPrec :: Int -> LaunchDetails -> ShowS
$cshowsPrec :: Int -> LaunchDetails -> ShowS
Prelude.Show, (forall x. LaunchDetails -> Rep LaunchDetails x)
-> (forall x. Rep LaunchDetails x -> LaunchDetails)
-> Generic LaunchDetails
forall x. Rep LaunchDetails x -> LaunchDetails
forall x. LaunchDetails -> Rep LaunchDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LaunchDetails x -> LaunchDetails
$cfrom :: forall x. LaunchDetails -> Rep LaunchDetails x
Prelude.Generic)

-- |
-- Create a value of 'LaunchDetails' 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:
--
-- 'stackId', 'launchDetails_stackId' - The ID of the latest stack launched for this application.
--
-- 'latestLaunchTime', 'launchDetails_latestLaunchTime' - The latest time that this application was launched successfully.
--
-- 'stackName', 'launchDetails_stackName' - The name of the latest stack launched for this application.
newLaunchDetails ::
  LaunchDetails
newLaunchDetails :: LaunchDetails
newLaunchDetails =
  LaunchDetails' :: Maybe Text -> Maybe POSIX -> Maybe Text -> LaunchDetails
LaunchDetails'
    { $sel:stackId:LaunchDetails' :: Maybe Text
stackId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestLaunchTime:LaunchDetails' :: Maybe POSIX
latestLaunchTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:stackName:LaunchDetails' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the latest stack launched for this application.
launchDetails_stackId :: Lens.Lens' LaunchDetails (Prelude.Maybe Prelude.Text)
launchDetails_stackId :: (Maybe Text -> f (Maybe Text)) -> LaunchDetails -> f LaunchDetails
launchDetails_stackId = (LaunchDetails -> Maybe Text)
-> (LaunchDetails -> Maybe Text -> LaunchDetails)
-> Lens LaunchDetails LaunchDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchDetails' {Maybe Text
stackId :: Maybe Text
$sel:stackId:LaunchDetails' :: LaunchDetails -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: LaunchDetails
s@LaunchDetails' {} Maybe Text
a -> LaunchDetails
s {$sel:stackId:LaunchDetails' :: Maybe Text
stackId = Maybe Text
a} :: LaunchDetails)

-- | The latest time that this application was launched successfully.
launchDetails_latestLaunchTime :: Lens.Lens' LaunchDetails (Prelude.Maybe Prelude.UTCTime)
launchDetails_latestLaunchTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LaunchDetails -> f LaunchDetails
launchDetails_latestLaunchTime = (LaunchDetails -> Maybe POSIX)
-> (LaunchDetails -> Maybe POSIX -> LaunchDetails)
-> Lens LaunchDetails LaunchDetails (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchDetails' {Maybe POSIX
latestLaunchTime :: Maybe POSIX
$sel:latestLaunchTime:LaunchDetails' :: LaunchDetails -> Maybe POSIX
latestLaunchTime} -> Maybe POSIX
latestLaunchTime) (\s :: LaunchDetails
s@LaunchDetails' {} Maybe POSIX
a -> LaunchDetails
s {$sel:latestLaunchTime:LaunchDetails' :: Maybe POSIX
latestLaunchTime = Maybe POSIX
a} :: LaunchDetails) ((Maybe POSIX -> f (Maybe POSIX))
 -> LaunchDetails -> f LaunchDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LaunchDetails
-> f LaunchDetails
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

-- | The name of the latest stack launched for this application.
launchDetails_stackName :: Lens.Lens' LaunchDetails (Prelude.Maybe Prelude.Text)
launchDetails_stackName :: (Maybe Text -> f (Maybe Text)) -> LaunchDetails -> f LaunchDetails
launchDetails_stackName = (LaunchDetails -> Maybe Text)
-> (LaunchDetails -> Maybe Text -> LaunchDetails)
-> Lens LaunchDetails LaunchDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchDetails' {Maybe Text
stackName :: Maybe Text
$sel:stackName:LaunchDetails' :: LaunchDetails -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: LaunchDetails
s@LaunchDetails' {} Maybe Text
a -> LaunchDetails
s {$sel:stackName:LaunchDetails' :: Maybe Text
stackName = Maybe Text
a} :: LaunchDetails)

instance Core.FromJSON LaunchDetails where
  parseJSON :: Value -> Parser LaunchDetails
parseJSON =
    String
-> (Object -> Parser LaunchDetails)
-> Value
-> Parser LaunchDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LaunchDetails"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe Text -> LaunchDetails
LaunchDetails'
            (Maybe Text -> Maybe POSIX -> Maybe Text -> LaunchDetails)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> LaunchDetails)
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
"stackId")
            Parser (Maybe POSIX -> Maybe Text -> LaunchDetails)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> LaunchDetails)
forall (f :: * -> *) a b. Applicative f => 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
"latestLaunchTime")
            Parser (Maybe Text -> LaunchDetails)
-> Parser (Maybe Text) -> Parser LaunchDetails
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
"stackName")
      )

instance Prelude.Hashable LaunchDetails

instance Prelude.NFData LaunchDetails