{-# 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.MemoryDb.Types.ServiceUpdate
-- 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.MemoryDb.Types.ServiceUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MemoryDb.Types.ServiceUpdateStatus
import Amazonka.MemoryDb.Types.ServiceUpdateType
import qualified Amazonka.Prelude as Prelude

-- | An update that you can apply to your MemoryDB clusters.
--
-- /See:/ 'newServiceUpdate' smart constructor.
data ServiceUpdate = ServiceUpdate'
  { -- | The date at which the service update will be automatically applied
    ServiceUpdate -> Maybe POSIX
autoUpdateStartDate :: Prelude.Maybe Data.POSIX,
    -- | The name of the cluster to which the service update applies
    ServiceUpdate -> Maybe Text
clusterName :: Prelude.Maybe Prelude.Text,
    -- | Provides details of the service update
    ServiceUpdate -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of nodes updated by the service update
    ServiceUpdate -> Maybe Text
nodesUpdated :: Prelude.Maybe Prelude.Text,
    -- | The date when the service update is initially available
    ServiceUpdate -> Maybe POSIX
releaseDate :: Prelude.Maybe Data.POSIX,
    -- | The unique ID of the service update
    ServiceUpdate -> Maybe Text
serviceUpdateName :: Prelude.Maybe Prelude.Text,
    -- | The status of the service update
    ServiceUpdate -> Maybe ServiceUpdateStatus
status :: Prelude.Maybe ServiceUpdateStatus,
    -- | Reflects the nature of the service update
    ServiceUpdate -> Maybe ServiceUpdateType
type' :: Prelude.Maybe ServiceUpdateType
  }
  deriving (ServiceUpdate -> ServiceUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceUpdate -> ServiceUpdate -> Bool
$c/= :: ServiceUpdate -> ServiceUpdate -> Bool
== :: ServiceUpdate -> ServiceUpdate -> Bool
$c== :: ServiceUpdate -> ServiceUpdate -> Bool
Prelude.Eq, ReadPrec [ServiceUpdate]
ReadPrec ServiceUpdate
Int -> ReadS ServiceUpdate
ReadS [ServiceUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceUpdate]
$creadListPrec :: ReadPrec [ServiceUpdate]
readPrec :: ReadPrec ServiceUpdate
$creadPrec :: ReadPrec ServiceUpdate
readList :: ReadS [ServiceUpdate]
$creadList :: ReadS [ServiceUpdate]
readsPrec :: Int -> ReadS ServiceUpdate
$creadsPrec :: Int -> ReadS ServiceUpdate
Prelude.Read, Int -> ServiceUpdate -> ShowS
[ServiceUpdate] -> ShowS
ServiceUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceUpdate] -> ShowS
$cshowList :: [ServiceUpdate] -> ShowS
show :: ServiceUpdate -> String
$cshow :: ServiceUpdate -> String
showsPrec :: Int -> ServiceUpdate -> ShowS
$cshowsPrec :: Int -> ServiceUpdate -> ShowS
Prelude.Show, forall x. Rep ServiceUpdate x -> ServiceUpdate
forall x. ServiceUpdate -> Rep ServiceUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceUpdate x -> ServiceUpdate
$cfrom :: forall x. ServiceUpdate -> Rep ServiceUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ServiceUpdate' 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:
--
-- 'autoUpdateStartDate', 'serviceUpdate_autoUpdateStartDate' - The date at which the service update will be automatically applied
--
-- 'clusterName', 'serviceUpdate_clusterName' - The name of the cluster to which the service update applies
--
-- 'description', 'serviceUpdate_description' - Provides details of the service update
--
-- 'nodesUpdated', 'serviceUpdate_nodesUpdated' - A list of nodes updated by the service update
--
-- 'releaseDate', 'serviceUpdate_releaseDate' - The date when the service update is initially available
--
-- 'serviceUpdateName', 'serviceUpdate_serviceUpdateName' - The unique ID of the service update
--
-- 'status', 'serviceUpdate_status' - The status of the service update
--
-- 'type'', 'serviceUpdate_type' - Reflects the nature of the service update
newServiceUpdate ::
  ServiceUpdate
newServiceUpdate :: ServiceUpdate
newServiceUpdate =
  ServiceUpdate'
    { $sel:autoUpdateStartDate:ServiceUpdate' :: Maybe POSIX
autoUpdateStartDate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:clusterName:ServiceUpdate' :: Maybe Text
clusterName = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ServiceUpdate' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:nodesUpdated:ServiceUpdate' :: Maybe Text
nodesUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:releaseDate:ServiceUpdate' :: Maybe POSIX
releaseDate = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceUpdateName:ServiceUpdate' :: Maybe Text
serviceUpdateName = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ServiceUpdate' :: Maybe ServiceUpdateStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ServiceUpdate' :: Maybe ServiceUpdateType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The date at which the service update will be automatically applied
serviceUpdate_autoUpdateStartDate :: Lens.Lens' ServiceUpdate (Prelude.Maybe Prelude.UTCTime)
serviceUpdate_autoUpdateStartDate :: Lens' ServiceUpdate (Maybe UTCTime)
serviceUpdate_autoUpdateStartDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe POSIX
autoUpdateStartDate :: Maybe POSIX
$sel:autoUpdateStartDate:ServiceUpdate' :: ServiceUpdate -> Maybe POSIX
autoUpdateStartDate} -> Maybe POSIX
autoUpdateStartDate) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe POSIX
a -> ServiceUpdate
s {$sel:autoUpdateStartDate:ServiceUpdate' :: Maybe POSIX
autoUpdateStartDate = Maybe POSIX
a} :: ServiceUpdate) 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 name of the cluster to which the service update applies
serviceUpdate_clusterName :: Lens.Lens' ServiceUpdate (Prelude.Maybe Prelude.Text)
serviceUpdate_clusterName :: Lens' ServiceUpdate (Maybe Text)
serviceUpdate_clusterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe Text
clusterName :: Maybe Text
$sel:clusterName:ServiceUpdate' :: ServiceUpdate -> Maybe Text
clusterName} -> Maybe Text
clusterName) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe Text
a -> ServiceUpdate
s {$sel:clusterName:ServiceUpdate' :: Maybe Text
clusterName = Maybe Text
a} :: ServiceUpdate)

-- | Provides details of the service update
serviceUpdate_description :: Lens.Lens' ServiceUpdate (Prelude.Maybe Prelude.Text)
serviceUpdate_description :: Lens' ServiceUpdate (Maybe Text)
serviceUpdate_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe Text
description :: Maybe Text
$sel:description:ServiceUpdate' :: ServiceUpdate -> Maybe Text
description} -> Maybe Text
description) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe Text
a -> ServiceUpdate
s {$sel:description:ServiceUpdate' :: Maybe Text
description = Maybe Text
a} :: ServiceUpdate)

-- | A list of nodes updated by the service update
serviceUpdate_nodesUpdated :: Lens.Lens' ServiceUpdate (Prelude.Maybe Prelude.Text)
serviceUpdate_nodesUpdated :: Lens' ServiceUpdate (Maybe Text)
serviceUpdate_nodesUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe Text
nodesUpdated :: Maybe Text
$sel:nodesUpdated:ServiceUpdate' :: ServiceUpdate -> Maybe Text
nodesUpdated} -> Maybe Text
nodesUpdated) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe Text
a -> ServiceUpdate
s {$sel:nodesUpdated:ServiceUpdate' :: Maybe Text
nodesUpdated = Maybe Text
a} :: ServiceUpdate)

-- | The date when the service update is initially available
serviceUpdate_releaseDate :: Lens.Lens' ServiceUpdate (Prelude.Maybe Prelude.UTCTime)
serviceUpdate_releaseDate :: Lens' ServiceUpdate (Maybe UTCTime)
serviceUpdate_releaseDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe POSIX
releaseDate :: Maybe POSIX
$sel:releaseDate:ServiceUpdate' :: ServiceUpdate -> Maybe POSIX
releaseDate} -> Maybe POSIX
releaseDate) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe POSIX
a -> ServiceUpdate
s {$sel:releaseDate:ServiceUpdate' :: Maybe POSIX
releaseDate = Maybe POSIX
a} :: ServiceUpdate) 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 unique ID of the service update
serviceUpdate_serviceUpdateName :: Lens.Lens' ServiceUpdate (Prelude.Maybe Prelude.Text)
serviceUpdate_serviceUpdateName :: Lens' ServiceUpdate (Maybe Text)
serviceUpdate_serviceUpdateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe Text
serviceUpdateName :: Maybe Text
$sel:serviceUpdateName:ServiceUpdate' :: ServiceUpdate -> Maybe Text
serviceUpdateName} -> Maybe Text
serviceUpdateName) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe Text
a -> ServiceUpdate
s {$sel:serviceUpdateName:ServiceUpdate' :: Maybe Text
serviceUpdateName = Maybe Text
a} :: ServiceUpdate)

-- | The status of the service update
serviceUpdate_status :: Lens.Lens' ServiceUpdate (Prelude.Maybe ServiceUpdateStatus)
serviceUpdate_status :: Lens' ServiceUpdate (Maybe ServiceUpdateStatus)
serviceUpdate_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe ServiceUpdateStatus
status :: Maybe ServiceUpdateStatus
$sel:status:ServiceUpdate' :: ServiceUpdate -> Maybe ServiceUpdateStatus
status} -> Maybe ServiceUpdateStatus
status) (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe ServiceUpdateStatus
a -> ServiceUpdate
s {$sel:status:ServiceUpdate' :: Maybe ServiceUpdateStatus
status = Maybe ServiceUpdateStatus
a} :: ServiceUpdate)

-- | Reflects the nature of the service update
serviceUpdate_type :: Lens.Lens' ServiceUpdate (Prelude.Maybe ServiceUpdateType)
serviceUpdate_type :: Lens' ServiceUpdate (Maybe ServiceUpdateType)
serviceUpdate_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceUpdate' {Maybe ServiceUpdateType
type' :: Maybe ServiceUpdateType
$sel:type':ServiceUpdate' :: ServiceUpdate -> Maybe ServiceUpdateType
type'} -> Maybe ServiceUpdateType
type') (\s :: ServiceUpdate
s@ServiceUpdate' {} Maybe ServiceUpdateType
a -> ServiceUpdate
s {$sel:type':ServiceUpdate' :: Maybe ServiceUpdateType
type' = Maybe ServiceUpdateType
a} :: ServiceUpdate)

instance Data.FromJSON ServiceUpdate where
  parseJSON :: Value -> Parser ServiceUpdate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServiceUpdate"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe ServiceUpdateStatus
-> Maybe ServiceUpdateType
-> ServiceUpdate
ServiceUpdate'
            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
"AutoUpdateStartDate")
            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
"ClusterName")
            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
"Description")
            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
"NodesUpdated")
            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
"ReleaseDate")
            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
"ServiceUpdateName")
            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")
            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
"Type")
      )

instance Prelude.Hashable ServiceUpdate where
  hashWithSalt :: Int -> ServiceUpdate -> Int
hashWithSalt Int
_salt ServiceUpdate' {Maybe Text
Maybe POSIX
Maybe ServiceUpdateStatus
Maybe ServiceUpdateType
type' :: Maybe ServiceUpdateType
status :: Maybe ServiceUpdateStatus
serviceUpdateName :: Maybe Text
releaseDate :: Maybe POSIX
nodesUpdated :: Maybe Text
description :: Maybe Text
clusterName :: Maybe Text
autoUpdateStartDate :: Maybe POSIX
$sel:type':ServiceUpdate' :: ServiceUpdate -> Maybe ServiceUpdateType
$sel:status:ServiceUpdate' :: ServiceUpdate -> Maybe ServiceUpdateStatus
$sel:serviceUpdateName:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:releaseDate:ServiceUpdate' :: ServiceUpdate -> Maybe POSIX
$sel:nodesUpdated:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:description:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:clusterName:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:autoUpdateStartDate:ServiceUpdate' :: ServiceUpdate -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
autoUpdateStartDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clusterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodesUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
releaseDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceUpdateName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServiceUpdateStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServiceUpdateType
type'

instance Prelude.NFData ServiceUpdate where
  rnf :: ServiceUpdate -> ()
rnf ServiceUpdate' {Maybe Text
Maybe POSIX
Maybe ServiceUpdateStatus
Maybe ServiceUpdateType
type' :: Maybe ServiceUpdateType
status :: Maybe ServiceUpdateStatus
serviceUpdateName :: Maybe Text
releaseDate :: Maybe POSIX
nodesUpdated :: Maybe Text
description :: Maybe Text
clusterName :: Maybe Text
autoUpdateStartDate :: Maybe POSIX
$sel:type':ServiceUpdate' :: ServiceUpdate -> Maybe ServiceUpdateType
$sel:status:ServiceUpdate' :: ServiceUpdate -> Maybe ServiceUpdateStatus
$sel:serviceUpdateName:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:releaseDate:ServiceUpdate' :: ServiceUpdate -> Maybe POSIX
$sel:nodesUpdated:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:description:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:clusterName:ServiceUpdate' :: ServiceUpdate -> Maybe Text
$sel:autoUpdateStartDate:ServiceUpdate' :: ServiceUpdate -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
autoUpdateStartDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clusterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodesUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
releaseDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceUpdateName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceUpdateStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceUpdateType
type'