{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Personalize.Types.SolutionVersionSummary where

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

-- | Provides a summary of the properties of a solution version. For a
-- complete listing, call the
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeSolutionVersion.html DescribeSolutionVersion>
-- API.
--
-- /See:/ 'newSolutionVersionSummary' smart constructor.
data SolutionVersionSummary = SolutionVersionSummary'
  { -- | The date and time (in Unix time) that this version of a solution was
    -- created.
    SolutionVersionSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Data.POSIX,
    -- | If a solution version fails, the reason behind the failure.
    SolutionVersionSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the solution version was last
    -- updated.
    SolutionVersionSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Name (ARN) of the solution version.
    SolutionVersionSummary -> Maybe Text
solutionVersionArn :: 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
  }
  deriving (SolutionVersionSummary -> SolutionVersionSummary -> Bool
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]
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
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. 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:
--
-- 'creationDateTime', 'solutionVersionSummary_creationDateTime' - The date and time (in Unix time) that this version of a solution was
-- created.
--
-- 'failureReason', 'solutionVersionSummary_failureReason' - If a solution version fails, the reason behind the failure.
--
-- 'lastUpdatedDateTime', 'solutionVersionSummary_lastUpdatedDateTime' - The date and time (in Unix time) that the solution version was last
-- updated.
--
-- 'solutionVersionArn', 'solutionVersionSummary_solutionVersionArn' - The Amazon Resource Name (ARN) of the solution version.
--
-- '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
newSolutionVersionSummary ::
  SolutionVersionSummary
newSolutionVersionSummary :: SolutionVersionSummary
newSolutionVersionSummary =
  SolutionVersionSummary'
    { $sel:creationDateTime:SolutionVersionSummary' :: Maybe POSIX
creationDateTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:SolutionVersionSummary' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:SolutionVersionSummary' :: Maybe POSIX
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:solutionVersionArn:SolutionVersionSummary' :: Maybe Text
solutionVersionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:SolutionVersionSummary' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' SolutionVersionSummary (Maybe UTCTime)
solutionVersionSummary_creationDateTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | If a solution version fails, the reason behind the failure.
solutionVersionSummary_failureReason :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.Text)
solutionVersionSummary_failureReason :: Lens' SolutionVersionSummary (Maybe Text)
solutionVersionSummary_failureReason = 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 date and time (in Unix time) that the solution version was last
-- updated.
solutionVersionSummary_lastUpdatedDateTime :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.UTCTime)
solutionVersionSummary_lastUpdatedDateTime :: Lens' SolutionVersionSummary (Maybe UTCTime)
solutionVersionSummary_lastUpdatedDateTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Amazon Resource Name (ARN) of the solution version.
solutionVersionSummary_solutionVersionArn :: Lens.Lens' SolutionVersionSummary (Prelude.Maybe Prelude.Text)
solutionVersionSummary_solutionVersionArn :: Lens' SolutionVersionSummary (Maybe Text)
solutionVersionSummary_solutionVersionArn = 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)

-- | 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 :: Lens' SolutionVersionSummary (Maybe Text)
solutionVersionSummary_status = 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)

instance Data.FromJSON SolutionVersionSummary where
  parseJSON :: Value -> Parser SolutionVersionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SolutionVersionSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> SolutionVersionSummary
SolutionVersionSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"creationDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"failureReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastUpdatedDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"solutionVersionArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
      )

instance Prelude.Hashable SolutionVersionSummary where
  hashWithSalt :: Int -> SolutionVersionSummary -> Int
hashWithSalt Int
_salt SolutionVersionSummary' {Maybe Text
Maybe POSIX
status :: Maybe Text
solutionVersionArn :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
failureReason :: Maybe Text
creationDateTime :: Maybe POSIX
$sel:status:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
$sel:solutionVersionArn:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
$sel:lastUpdatedDateTime:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe POSIX
$sel:failureReason:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
$sel:creationDateTime:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
solutionVersionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData SolutionVersionSummary where
  rnf :: SolutionVersionSummary -> ()
rnf SolutionVersionSummary' {Maybe Text
Maybe POSIX
status :: Maybe Text
solutionVersionArn :: Maybe Text
lastUpdatedDateTime :: Maybe POSIX
failureReason :: Maybe Text
creationDateTime :: Maybe POSIX
$sel:status:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
$sel:solutionVersionArn:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
$sel:lastUpdatedDateTime:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe POSIX
$sel:failureReason:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe Text
$sel:creationDateTime:SolutionVersionSummary' :: SolutionVersionSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
solutionVersionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status