{-# 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.ElasticSearch.Types.UpgradeStepItem
-- 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.ElasticSearch.Types.UpgradeStepItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.UpgradeStatus
import Amazonka.ElasticSearch.Types.UpgradeStep
import qualified Amazonka.Prelude as Prelude

-- | Represents a single step of the Upgrade or Upgrade Eligibility Check
-- workflow.
--
-- /See:/ 'newUpgradeStepItem' smart constructor.
data UpgradeStepItem = UpgradeStepItem'
  { -- | A list of strings containing detailed information about the errors
    -- encountered in a particular step.
    UpgradeStepItem -> Maybe [Text]
issues :: Prelude.Maybe [Prelude.Text],
    -- | The Floating point value representing progress percentage of a
    -- particular step.
    UpgradeStepItem -> Maybe Double
progressPercent :: Prelude.Maybe Prelude.Double,
    -- | Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check
    -- does through:
    --
    -- -   PreUpgradeCheck
    -- -   Snapshot
    -- -   Upgrade
    UpgradeStepItem -> Maybe UpgradeStep
upgradeStep :: Prelude.Maybe UpgradeStep,
    -- | The status of a particular step during an upgrade. The status can take
    -- one of the following values:
    --
    -- -   In Progress
    -- -   Succeeded
    -- -   Succeeded with Issues
    -- -   Failed
    UpgradeStepItem -> Maybe UpgradeStatus
upgradeStepStatus :: Prelude.Maybe UpgradeStatus
  }
  deriving (UpgradeStepItem -> UpgradeStepItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpgradeStepItem -> UpgradeStepItem -> Bool
$c/= :: UpgradeStepItem -> UpgradeStepItem -> Bool
== :: UpgradeStepItem -> UpgradeStepItem -> Bool
$c== :: UpgradeStepItem -> UpgradeStepItem -> Bool
Prelude.Eq, ReadPrec [UpgradeStepItem]
ReadPrec UpgradeStepItem
Int -> ReadS UpgradeStepItem
ReadS [UpgradeStepItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpgradeStepItem]
$creadListPrec :: ReadPrec [UpgradeStepItem]
readPrec :: ReadPrec UpgradeStepItem
$creadPrec :: ReadPrec UpgradeStepItem
readList :: ReadS [UpgradeStepItem]
$creadList :: ReadS [UpgradeStepItem]
readsPrec :: Int -> ReadS UpgradeStepItem
$creadsPrec :: Int -> ReadS UpgradeStepItem
Prelude.Read, Int -> UpgradeStepItem -> ShowS
[UpgradeStepItem] -> ShowS
UpgradeStepItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradeStepItem] -> ShowS
$cshowList :: [UpgradeStepItem] -> ShowS
show :: UpgradeStepItem -> String
$cshow :: UpgradeStepItem -> String
showsPrec :: Int -> UpgradeStepItem -> ShowS
$cshowsPrec :: Int -> UpgradeStepItem -> ShowS
Prelude.Show, forall x. Rep UpgradeStepItem x -> UpgradeStepItem
forall x. UpgradeStepItem -> Rep UpgradeStepItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpgradeStepItem x -> UpgradeStepItem
$cfrom :: forall x. UpgradeStepItem -> Rep UpgradeStepItem x
Prelude.Generic)

-- |
-- Create a value of 'UpgradeStepItem' 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:
--
-- 'issues', 'upgradeStepItem_issues' - A list of strings containing detailed information about the errors
-- encountered in a particular step.
--
-- 'progressPercent', 'upgradeStepItem_progressPercent' - The Floating point value representing progress percentage of a
-- particular step.
--
-- 'upgradeStep', 'upgradeStepItem_upgradeStep' - Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check
-- does through:
--
-- -   PreUpgradeCheck
-- -   Snapshot
-- -   Upgrade
--
-- 'upgradeStepStatus', 'upgradeStepItem_upgradeStepStatus' - The status of a particular step during an upgrade. The status can take
-- one of the following values:
--
-- -   In Progress
-- -   Succeeded
-- -   Succeeded with Issues
-- -   Failed
newUpgradeStepItem ::
  UpgradeStepItem
newUpgradeStepItem :: UpgradeStepItem
newUpgradeStepItem =
  UpgradeStepItem'
    { $sel:issues:UpgradeStepItem' :: Maybe [Text]
issues = forall a. Maybe a
Prelude.Nothing,
      $sel:progressPercent:UpgradeStepItem' :: Maybe Double
progressPercent = forall a. Maybe a
Prelude.Nothing,
      $sel:upgradeStep:UpgradeStepItem' :: Maybe UpgradeStep
upgradeStep = forall a. Maybe a
Prelude.Nothing,
      $sel:upgradeStepStatus:UpgradeStepItem' :: Maybe UpgradeStatus
upgradeStepStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of strings containing detailed information about the errors
-- encountered in a particular step.
upgradeStepItem_issues :: Lens.Lens' UpgradeStepItem (Prelude.Maybe [Prelude.Text])
upgradeStepItem_issues :: Lens' UpgradeStepItem (Maybe [Text])
upgradeStepItem_issues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeStepItem' {Maybe [Text]
issues :: Maybe [Text]
$sel:issues:UpgradeStepItem' :: UpgradeStepItem -> Maybe [Text]
issues} -> Maybe [Text]
issues) (\s :: UpgradeStepItem
s@UpgradeStepItem' {} Maybe [Text]
a -> UpgradeStepItem
s {$sel:issues:UpgradeStepItem' :: Maybe [Text]
issues = Maybe [Text]
a} :: UpgradeStepItem) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Floating point value representing progress percentage of a
-- particular step.
upgradeStepItem_progressPercent :: Lens.Lens' UpgradeStepItem (Prelude.Maybe Prelude.Double)
upgradeStepItem_progressPercent :: Lens' UpgradeStepItem (Maybe Double)
upgradeStepItem_progressPercent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeStepItem' {Maybe Double
progressPercent :: Maybe Double
$sel:progressPercent:UpgradeStepItem' :: UpgradeStepItem -> Maybe Double
progressPercent} -> Maybe Double
progressPercent) (\s :: UpgradeStepItem
s@UpgradeStepItem' {} Maybe Double
a -> UpgradeStepItem
s {$sel:progressPercent:UpgradeStepItem' :: Maybe Double
progressPercent = Maybe Double
a} :: UpgradeStepItem)

-- | Represents one of 3 steps that an Upgrade or Upgrade Eligibility Check
-- does through:
--
-- -   PreUpgradeCheck
-- -   Snapshot
-- -   Upgrade
upgradeStepItem_upgradeStep :: Lens.Lens' UpgradeStepItem (Prelude.Maybe UpgradeStep)
upgradeStepItem_upgradeStep :: Lens' UpgradeStepItem (Maybe UpgradeStep)
upgradeStepItem_upgradeStep = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeStepItem' {Maybe UpgradeStep
upgradeStep :: Maybe UpgradeStep
$sel:upgradeStep:UpgradeStepItem' :: UpgradeStepItem -> Maybe UpgradeStep
upgradeStep} -> Maybe UpgradeStep
upgradeStep) (\s :: UpgradeStepItem
s@UpgradeStepItem' {} Maybe UpgradeStep
a -> UpgradeStepItem
s {$sel:upgradeStep:UpgradeStepItem' :: Maybe UpgradeStep
upgradeStep = Maybe UpgradeStep
a} :: UpgradeStepItem)

-- | The status of a particular step during an upgrade. The status can take
-- one of the following values:
--
-- -   In Progress
-- -   Succeeded
-- -   Succeeded with Issues
-- -   Failed
upgradeStepItem_upgradeStepStatus :: Lens.Lens' UpgradeStepItem (Prelude.Maybe UpgradeStatus)
upgradeStepItem_upgradeStepStatus :: Lens' UpgradeStepItem (Maybe UpgradeStatus)
upgradeStepItem_upgradeStepStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeStepItem' {Maybe UpgradeStatus
upgradeStepStatus :: Maybe UpgradeStatus
$sel:upgradeStepStatus:UpgradeStepItem' :: UpgradeStepItem -> Maybe UpgradeStatus
upgradeStepStatus} -> Maybe UpgradeStatus
upgradeStepStatus) (\s :: UpgradeStepItem
s@UpgradeStepItem' {} Maybe UpgradeStatus
a -> UpgradeStepItem
s {$sel:upgradeStepStatus:UpgradeStepItem' :: Maybe UpgradeStatus
upgradeStepStatus = Maybe UpgradeStatus
a} :: UpgradeStepItem)

instance Data.FromJSON UpgradeStepItem where
  parseJSON :: Value -> Parser UpgradeStepItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpgradeStepItem"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Double
-> Maybe UpgradeStep
-> Maybe UpgradeStatus
-> UpgradeStepItem
UpgradeStepItem'
            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
"Issues" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"ProgressPercent")
            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
"UpgradeStep")
            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
"UpgradeStepStatus")
      )

instance Prelude.Hashable UpgradeStepItem where
  hashWithSalt :: Int -> UpgradeStepItem -> Int
hashWithSalt Int
_salt UpgradeStepItem' {Maybe Double
Maybe [Text]
Maybe UpgradeStatus
Maybe UpgradeStep
upgradeStepStatus :: Maybe UpgradeStatus
upgradeStep :: Maybe UpgradeStep
progressPercent :: Maybe Double
issues :: Maybe [Text]
$sel:upgradeStepStatus:UpgradeStepItem' :: UpgradeStepItem -> Maybe UpgradeStatus
$sel:upgradeStep:UpgradeStepItem' :: UpgradeStepItem -> Maybe UpgradeStep
$sel:progressPercent:UpgradeStepItem' :: UpgradeStepItem -> Maybe Double
$sel:issues:UpgradeStepItem' :: UpgradeStepItem -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
issues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
progressPercent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpgradeStep
upgradeStep
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpgradeStatus
upgradeStepStatus

instance Prelude.NFData UpgradeStepItem where
  rnf :: UpgradeStepItem -> ()
rnf UpgradeStepItem' {Maybe Double
Maybe [Text]
Maybe UpgradeStatus
Maybe UpgradeStep
upgradeStepStatus :: Maybe UpgradeStatus
upgradeStep :: Maybe UpgradeStep
progressPercent :: Maybe Double
issues :: Maybe [Text]
$sel:upgradeStepStatus:UpgradeStepItem' :: UpgradeStepItem -> Maybe UpgradeStatus
$sel:upgradeStep:UpgradeStepItem' :: UpgradeStepItem -> Maybe UpgradeStep
$sel:progressPercent:UpgradeStepItem' :: UpgradeStepItem -> Maybe Double
$sel:issues:UpgradeStepItem' :: UpgradeStepItem -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
issues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
progressPercent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpgradeStep
upgradeStep
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpgradeStatus
upgradeStepStatus