{-# 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.Personalize.Types.SolutionVersionSummary
-- 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.Personalize.Types.SolutionVersionSummary where

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

-- | Provides a summary of the properties of a solution version. For a
-- complete listing, call the DescribeSolutionVersion API.
--
-- /See:/ 'newSolutionVersionSummary' smart constructor.
data SolutionVersionSummary = SolutionVersionSummary'
  { -- | If a solution version fails, the reason behind the failure.
    SolutionVersionSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The status of the solution version.
    --
    -- A solution version can be in one of the following states:
    --
    -- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
    SolutionVersionSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the solution version was last
    -- updated.
    SolutionVersionSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The date and time (in Unix time) that this version of a solution was
    -- created.
    SolutionVersionSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the solution version.
    SolutionVersionSummary -> Maybe Text
solutionVersionArn :: Prelude.Maybe Prelude.Text
  }
  deriving (SolutionVersionSummary -> SolutionVersionSummary -> Bool
(SolutionVersionSummary -> SolutionVersionSummary -> Bool)
-> (SolutionVersionSummary -> SolutionVersionSummary -> Bool)
-> Eq SolutionVersionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SolutionVersionSummary -> SolutionVersionSummary -> Bool
$c/= :: SolutionVersionSummary -> SolutionVersionSummary -> Bool
== :: SolutionVersionSummary -> SolutionVersionSummary -> Bool
$c== :: SolutionVersionSummary -> SolutionVersionSummary -> Bool
Prelude.Eq, ReadPrec [SolutionVersionSummary]
ReadPrec SolutionVersionSummary
Int -> ReadS SolutionVersionSummary
ReadS [SolutionVersionSummary]
(Int -> ReadS SolutionVersionSummary)
-> ReadS [SolutionVersionSummary]
-> ReadPrec SolutionVersionSummary
-> ReadPrec [SolutionVersionSummary]
-> Read SolutionVersionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SolutionVersionSummary]
$creadListPrec :: ReadPrec [SolutionVersionSummary]
readPrec :: ReadPrec SolutionVersionSummary
$creadPrec :: ReadPrec SolutionVersionSummary
readList :: ReadS [SolutionVersionSummary]
$creadList :: ReadS [SolutionVersionSummary]
readsPrec :: Int -> ReadS SolutionVersionSummary
$creadsPrec :: Int -> ReadS SolutionVersionSummary
Prelude.Read, Int -> SolutionVersionSummary -> ShowS
[SolutionVersionSummary] -> ShowS
SolutionVersionSummary -> String
(Int -> SolutionVersionSummary -> ShowS)
-> (SolutionVersionSummary -> String)
-> ([SolutionVersionSummary] -> ShowS)
-> Show SolutionVersionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SolutionVersionSummary] -> ShowS
$cshowList :: [SolutionVersionSummary] -> ShowS
show :: SolutionVersionSummary -> String
$cshow :: SolutionVersionSummary -> String
showsPrec :: Int -> SolutionVersionSummary -> ShowS
$cshowsPrec :: Int -> SolutionVersionSummary -> ShowS
Prelude.Show, (forall x. SolutionVersionSummary -> Rep SolutionVersionSummary x)
-> (forall x.
    Rep SolutionVersionSummary x -> SolutionVersionSummary)
-> Generic SolutionVersionSummary
forall x. Rep SolutionVersionSummary x -> SolutionVersionSummary
forall x. SolutionVersionSummary -> Rep SolutionVersionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SolutionVersionSummary x -> SolutionVersionSummary
$cfrom :: forall x. SolutionVersionSummary -> Rep SolutionVersionSummary x
Prelude.Generic)

-- |
-- Create a value of 'SolutionVersionSummary' 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:
--
-- 'failureReason', 'solutionVersionSummary_failureReason' - If a solution version fails, the reason behind the failure.
--
-- 'status', 'solutionVersionSummary_status' - The status of the solution version.
--
-- A solution version can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- 'lastUpdatedDateTime', 'solutionVersionSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the solution version was last
-- updated.
--
-- 'creationDateTime', 'solutionVersionSummary_creationDateTime' - The date and time (in Unix time) that this version of a solution was
-- created.
--
-- 'solutionVersionArn', 'solutionVersionSummary_solutionVersionArn' - The Amazon Resource Name (ARN) of the solution version.
newSolutionVersionSummary ::
  SolutionVersionSummary
newSolutionVersionSummary :: SolutionVersionSummary
newSolutionVersionSummary =
  SolutionVersionSummary' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> SolutionVersionSummary
SolutionVersionSummary'
    { $sel:failureReason:SolutionVersionSummary' :: Maybe Text
failureReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:SolutionVersionSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:SolutionVersionSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:SolutionVersionSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:solutionVersionArn:SolutionVersionSummary' :: Maybe Text
solutionVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If a solution version fails, the reason behind the failure.
solutionVersionSummary_failureReason :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.Text)
solutionVersionSummary_failureReason :: (Maybe Text -> f (Maybe Text))
-> SolutionVersionSummary -> f SolutionVersionSummary
solutionVersionSummary_failureReason = (SolutionVersionSummary -> Maybe Text)
-> (SolutionVersionSummary -> Maybe Text -> SolutionVersionSummary)
-> Lens
     SolutionVersionSummary
     SolutionVersionSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionVersionSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: SolutionVersionSummary
s@SolutionVersionSummary' {} Maybe Text
a -> SolutionVersionSummary
s {$sel:failureReason:SolutionVersionSummary' :: Maybe Text
failureReason = Maybe Text
a} :: SolutionVersionSummary)

-- | The status of the solution version.
--
-- A solution version can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
solutionVersionSummary_status :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.Text)
solutionVersionSummary_status :: (Maybe Text -> f (Maybe Text))
-> SolutionVersionSummary -> f SolutionVersionSummary
solutionVersionSummary_status = (SolutionVersionSummary -> Maybe Text)
-> (SolutionVersionSummary -> Maybe Text -> SolutionVersionSummary)
-> Lens
     SolutionVersionSummary
     SolutionVersionSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionVersionSummary' {Maybe Text
status :: Maybe Text
$sel:status:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: SolutionVersionSummary
s@SolutionVersionSummary' {} Maybe Text
a -> SolutionVersionSummary
s {$sel:status:SolutionVersionSummary' :: Maybe Text
status = Maybe Text
a} :: SolutionVersionSummary)

-- | The date and time (in Unix time) that the solution version was last
-- updated.
solutionVersionSummary_lastUpdatedDateTime :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.UTCTime)
solutionVersionSummary_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SolutionVersionSummary -> f SolutionVersionSummary
solutionVersionSummary_lastUpdatedDateTime = (SolutionVersionSummary -> Maybe POSIX)
-> (SolutionVersionSummary
    -> Maybe POSIX -> SolutionVersionSummary)
-> Lens
     SolutionVersionSummary
     SolutionVersionSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionVersionSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: SolutionVersionSummary
s@SolutionVersionSummary' {} Maybe POSIX
a -> SolutionVersionSummary
s {$sel:lastUpdatedDateTime:SolutionVersionSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: SolutionVersionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> SolutionVersionSummary -> f SolutionVersionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SolutionVersionSummary
-> f SolutionVersionSummary
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 date and time (in Unix time) that this version of a solution was
-- created.
solutionVersionSummary_creationDateTime :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.UTCTime)
solutionVersionSummary_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SolutionVersionSummary -> f SolutionVersionSummary
solutionVersionSummary_creationDateTime = (SolutionVersionSummary -> Maybe POSIX)
-> (SolutionVersionSummary
    -> Maybe POSIX -> SolutionVersionSummary)
-> Lens
     SolutionVersionSummary
     SolutionVersionSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionVersionSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: SolutionVersionSummary
s@SolutionVersionSummary' {} Maybe POSIX
a -> SolutionVersionSummary
s {$sel:creationDateTime:SolutionVersionSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: SolutionVersionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> SolutionVersionSummary -> f SolutionVersionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SolutionVersionSummary
-> f SolutionVersionSummary
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 Amazon Resource Name (ARN) of the solution version.
solutionVersionSummary_solutionVersionArn :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.Text)
solutionVersionSummary_solutionVersionArn :: (Maybe Text -> f (Maybe Text))
-> SolutionVersionSummary -> f SolutionVersionSummary
solutionVersionSummary_solutionVersionArn = (SolutionVersionSummary -> Maybe Text)
-> (SolutionVersionSummary -> Maybe Text -> SolutionVersionSummary)
-> Lens
     SolutionVersionSummary
     SolutionVersionSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionVersionSummary' {Maybe Text
solutionVersionArn :: Maybe Text
$sel:solutionVersionArn:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
solutionVersionArn} -> Maybe Text
solutionVersionArn) (\s :: SolutionVersionSummary
s@SolutionVersionSummary' {} Maybe Text
a -> SolutionVersionSummary
s {$sel:solutionVersionArn:SolutionVersionSummary' :: Maybe Text
solutionVersionArn = Maybe Text
a} :: SolutionVersionSummary)

instance Core.FromJSON SolutionVersionSummary where
  parseJSON :: Value -> Parser SolutionVersionSummary
parseJSON =
    String
-> (Object -> Parser SolutionVersionSummary)
-> Value
-> Parser SolutionVersionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SolutionVersionSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> SolutionVersionSummary
SolutionVersionSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> SolutionVersionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> SolutionVersionSummary)
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
"failureReason")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> SolutionVersionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX -> Maybe Text -> SolutionVersionSummary)
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
"status")
            Parser
  (Maybe POSIX
   -> Maybe POSIX -> Maybe Text -> SolutionVersionSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> Maybe Text -> SolutionVersionSummary)
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
"lastUpdatedDateTime")
            Parser (Maybe POSIX -> Maybe Text -> SolutionVersionSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> SolutionVersionSummary)
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
"creationDateTime")
            Parser (Maybe Text -> SolutionVersionSummary)
-> Parser (Maybe Text) -> Parser SolutionVersionSummary
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
"solutionVersionArn")
      )

instance Prelude.Hashable SolutionVersionSummary

instance Prelude.NFData SolutionVersionSummary