{-# 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.Snowball.Types.ClusterListEntry
-- 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.Snowball.Types.ClusterListEntry 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
import Amazonka.Snowball.Types.ClusterState

-- | Contains a cluster\'s state, a cluster\'s ID, and other important
-- information.
--
-- /See:/ 'newClusterListEntry' smart constructor.
data ClusterListEntry = ClusterListEntry'
  { -- | The 39-character ID for the cluster that you want to list, for example
    -- @CID123e4567-e89b-12d3-a456-426655440000@.
    ClusterListEntry -> Maybe Text
clusterId :: Prelude.Maybe Prelude.Text,
    -- | The current state of this cluster. For information about the state of a
    -- specific node, see JobListEntry$JobState.
    ClusterListEntry -> Maybe ClusterState
clusterState :: Prelude.Maybe ClusterState,
    -- | The creation date for this cluster.
    ClusterListEntry -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | Defines an optional description of the cluster, for example
    -- @Environmental Data Cluster-01@.
    ClusterListEntry -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterListEntry -> ClusterListEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterListEntry -> ClusterListEntry -> Bool
$c/= :: ClusterListEntry -> ClusterListEntry -> Bool
== :: ClusterListEntry -> ClusterListEntry -> Bool
$c== :: ClusterListEntry -> ClusterListEntry -> Bool
Prelude.Eq, ReadPrec [ClusterListEntry]
ReadPrec ClusterListEntry
Int -> ReadS ClusterListEntry
ReadS [ClusterListEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterListEntry]
$creadListPrec :: ReadPrec [ClusterListEntry]
readPrec :: ReadPrec ClusterListEntry
$creadPrec :: ReadPrec ClusterListEntry
readList :: ReadS [ClusterListEntry]
$creadList :: ReadS [ClusterListEntry]
readsPrec :: Int -> ReadS ClusterListEntry
$creadsPrec :: Int -> ReadS ClusterListEntry
Prelude.Read, Int -> ClusterListEntry -> ShowS
[ClusterListEntry] -> ShowS
ClusterListEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterListEntry] -> ShowS
$cshowList :: [ClusterListEntry] -> ShowS
show :: ClusterListEntry -> String
$cshow :: ClusterListEntry -> String
showsPrec :: Int -> ClusterListEntry -> ShowS
$cshowsPrec :: Int -> ClusterListEntry -> ShowS
Prelude.Show, forall x. Rep ClusterListEntry x -> ClusterListEntry
forall x. ClusterListEntry -> Rep ClusterListEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterListEntry x -> ClusterListEntry
$cfrom :: forall x. ClusterListEntry -> Rep ClusterListEntry x
Prelude.Generic)

-- |
-- Create a value of 'ClusterListEntry' 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:
--
-- 'clusterId', 'clusterListEntry_clusterId' - The 39-character ID for the cluster that you want to list, for example
-- @CID123e4567-e89b-12d3-a456-426655440000@.
--
-- 'clusterState', 'clusterListEntry_clusterState' - The current state of this cluster. For information about the state of a
-- specific node, see JobListEntry$JobState.
--
-- 'creationDate', 'clusterListEntry_creationDate' - The creation date for this cluster.
--
-- 'description', 'clusterListEntry_description' - Defines an optional description of the cluster, for example
-- @Environmental Data Cluster-01@.
newClusterListEntry ::
  ClusterListEntry
newClusterListEntry :: ClusterListEntry
newClusterListEntry =
  ClusterListEntry'
    { $sel:clusterId:ClusterListEntry' :: Maybe Text
clusterId = forall a. Maybe a
Prelude.Nothing,
      $sel:clusterState:ClusterListEntry' :: Maybe ClusterState
clusterState = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:ClusterListEntry' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ClusterListEntry' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing
    }

-- | The 39-character ID for the cluster that you want to list, for example
-- @CID123e4567-e89b-12d3-a456-426655440000@.
clusterListEntry_clusterId :: Lens.Lens' ClusterListEntry (Prelude.Maybe Prelude.Text)
clusterListEntry_clusterId :: Lens' ClusterListEntry (Maybe Text)
clusterListEntry_clusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterListEntry' {Maybe Text
clusterId :: Maybe Text
$sel:clusterId:ClusterListEntry' :: ClusterListEntry -> Maybe Text
clusterId} -> Maybe Text
clusterId) (\s :: ClusterListEntry
s@ClusterListEntry' {} Maybe Text
a -> ClusterListEntry
s {$sel:clusterId:ClusterListEntry' :: Maybe Text
clusterId = Maybe Text
a} :: ClusterListEntry)

-- | The current state of this cluster. For information about the state of a
-- specific node, see JobListEntry$JobState.
clusterListEntry_clusterState :: Lens.Lens' ClusterListEntry (Prelude.Maybe ClusterState)
clusterListEntry_clusterState :: Lens' ClusterListEntry (Maybe ClusterState)
clusterListEntry_clusterState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterListEntry' {Maybe ClusterState
clusterState :: Maybe ClusterState
$sel:clusterState:ClusterListEntry' :: ClusterListEntry -> Maybe ClusterState
clusterState} -> Maybe ClusterState
clusterState) (\s :: ClusterListEntry
s@ClusterListEntry' {} Maybe ClusterState
a -> ClusterListEntry
s {$sel:clusterState:ClusterListEntry' :: Maybe ClusterState
clusterState = Maybe ClusterState
a} :: ClusterListEntry)

-- | The creation date for this cluster.
clusterListEntry_creationDate :: Lens.Lens' ClusterListEntry (Prelude.Maybe Prelude.UTCTime)
clusterListEntry_creationDate :: Lens' ClusterListEntry (Maybe UTCTime)
clusterListEntry_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterListEntry' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:ClusterListEntry' :: ClusterListEntry -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: ClusterListEntry
s@ClusterListEntry' {} Maybe POSIX
a -> ClusterListEntry
s {$sel:creationDate:ClusterListEntry' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: ClusterListEntry) 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

-- | Defines an optional description of the cluster, for example
-- @Environmental Data Cluster-01@.
clusterListEntry_description :: Lens.Lens' ClusterListEntry (Prelude.Maybe Prelude.Text)
clusterListEntry_description :: Lens' ClusterListEntry (Maybe Text)
clusterListEntry_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterListEntry' {Maybe Text
description :: Maybe Text
$sel:description:ClusterListEntry' :: ClusterListEntry -> Maybe Text
description} -> Maybe Text
description) (\s :: ClusterListEntry
s@ClusterListEntry' {} Maybe Text
a -> ClusterListEntry
s {$sel:description:ClusterListEntry' :: Maybe Text
description = Maybe Text
a} :: ClusterListEntry)

instance Data.FromJSON ClusterListEntry where
  parseJSON :: Value -> Parser ClusterListEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClusterListEntry"
      ( \Object
x ->
          Maybe Text
-> Maybe ClusterState
-> Maybe POSIX
-> Maybe Text
-> ClusterListEntry
ClusterListEntry'
            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
"ClusterId")
            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
"ClusterState")
            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
"CreationDate")
            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")
      )

instance Prelude.Hashable ClusterListEntry where
  hashWithSalt :: Int -> ClusterListEntry -> Int
hashWithSalt Int
_salt ClusterListEntry' {Maybe Text
Maybe POSIX
Maybe ClusterState
description :: Maybe Text
creationDate :: Maybe POSIX
clusterState :: Maybe ClusterState
clusterId :: Maybe Text
$sel:description:ClusterListEntry' :: ClusterListEntry -> Maybe Text
$sel:creationDate:ClusterListEntry' :: ClusterListEntry -> Maybe POSIX
$sel:clusterState:ClusterListEntry' :: ClusterListEntry -> Maybe ClusterState
$sel:clusterId:ClusterListEntry' :: ClusterListEntry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clusterId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ClusterState
clusterState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description

instance Prelude.NFData ClusterListEntry where
  rnf :: ClusterListEntry -> ()
rnf ClusterListEntry' {Maybe Text
Maybe POSIX
Maybe ClusterState
description :: Maybe Text
creationDate :: Maybe POSIX
clusterState :: Maybe ClusterState
clusterId :: Maybe Text
$sel:description:ClusterListEntry' :: ClusterListEntry -> Maybe Text
$sel:creationDate:ClusterListEntry' :: ClusterListEntry -> Maybe POSIX
$sel:clusterState:ClusterListEntry' :: ClusterListEntry -> Maybe ClusterState
$sel:clusterId:ClusterListEntry' :: ClusterListEntry -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clusterId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ClusterState
clusterState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description