{-# 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.EMR.Types.ClusterSummary
-- 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.EMR.Types.ClusterSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types.ClusterStatus
import qualified Amazonka.Prelude as Prelude

-- | The summary description of the cluster.
--
-- /See:/ 'newClusterSummary' smart constructor.
data ClusterSummary = ClusterSummary'
  { -- | The Amazon Resource Name of the cluster.
    ClusterSummary -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the cluster.
    ClusterSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the cluster.
    ClusterSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An approximation of the cost of the cluster, represented in
    -- m1.small\/hours. This value is incremented one time for every hour an
    -- m1.small instance runs. Larger instances are weighted more, so an EC2
    -- instance that is roughly four times more expensive would result in the
    -- normalized instance hours being incremented by four. This result is only
    -- an approximation and does not reflect the actual billing rate.
    ClusterSummary -> Maybe Int
normalizedInstanceHours :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the Outpost where the cluster is
    -- launched.
    ClusterSummary -> Maybe Text
outpostArn :: Prelude.Maybe Prelude.Text,
    -- | The details about the current status of the cluster.
    ClusterSummary -> Maybe ClusterStatus
status :: Prelude.Maybe ClusterStatus
  }
  deriving (ClusterSummary -> ClusterSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterSummary -> ClusterSummary -> Bool
$c/= :: ClusterSummary -> ClusterSummary -> Bool
== :: ClusterSummary -> ClusterSummary -> Bool
$c== :: ClusterSummary -> ClusterSummary -> Bool
Prelude.Eq, ReadPrec [ClusterSummary]
ReadPrec ClusterSummary
Int -> ReadS ClusterSummary
ReadS [ClusterSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterSummary]
$creadListPrec :: ReadPrec [ClusterSummary]
readPrec :: ReadPrec ClusterSummary
$creadPrec :: ReadPrec ClusterSummary
readList :: ReadS [ClusterSummary]
$creadList :: ReadS [ClusterSummary]
readsPrec :: Int -> ReadS ClusterSummary
$creadsPrec :: Int -> ReadS ClusterSummary
Prelude.Read, Int -> ClusterSummary -> ShowS
[ClusterSummary] -> ShowS
ClusterSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterSummary] -> ShowS
$cshowList :: [ClusterSummary] -> ShowS
show :: ClusterSummary -> String
$cshow :: ClusterSummary -> String
showsPrec :: Int -> ClusterSummary -> ShowS
$cshowsPrec :: Int -> ClusterSummary -> ShowS
Prelude.Show, forall x. Rep ClusterSummary x -> ClusterSummary
forall x. ClusterSummary -> Rep ClusterSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterSummary x -> ClusterSummary
$cfrom :: forall x. ClusterSummary -> Rep ClusterSummary x
Prelude.Generic)

-- |
-- Create a value of 'ClusterSummary' 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:
--
-- 'clusterArn', 'clusterSummary_clusterArn' - The Amazon Resource Name of the cluster.
--
-- 'id', 'clusterSummary_id' - The unique identifier for the cluster.
--
-- 'name', 'clusterSummary_name' - The name of the cluster.
--
-- 'normalizedInstanceHours', 'clusterSummary_normalizedInstanceHours' - An approximation of the cost of the cluster, represented in
-- m1.small\/hours. This value is incremented one time for every hour an
-- m1.small instance runs. Larger instances are weighted more, so an EC2
-- instance that is roughly four times more expensive would result in the
-- normalized instance hours being incremented by four. This result is only
-- an approximation and does not reflect the actual billing rate.
--
-- 'outpostArn', 'clusterSummary_outpostArn' - The Amazon Resource Name (ARN) of the Outpost where the cluster is
-- launched.
--
-- 'status', 'clusterSummary_status' - The details about the current status of the cluster.
newClusterSummary ::
  ClusterSummary
newClusterSummary :: ClusterSummary
newClusterSummary =
  ClusterSummary'
    { $sel:clusterArn:ClusterSummary' :: Maybe Text
clusterArn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ClusterSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ClusterSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:normalizedInstanceHours:ClusterSummary' :: Maybe Int
normalizedInstanceHours = forall a. Maybe a
Prelude.Nothing,
      $sel:outpostArn:ClusterSummary' :: Maybe Text
outpostArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ClusterSummary' :: Maybe ClusterStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name of the cluster.
clusterSummary_clusterArn :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_clusterArn :: Lens' ClusterSummary (Maybe Text)
clusterSummary_clusterArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSummary' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:ClusterSummary' :: ClusterSummary -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: ClusterSummary
s@ClusterSummary' {} Maybe Text
a -> ClusterSummary
s {$sel:clusterArn:ClusterSummary' :: Maybe Text
clusterArn = Maybe Text
a} :: ClusterSummary)

-- | The unique identifier for the cluster.
clusterSummary_id :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_id :: Lens' ClusterSummary (Maybe Text)
clusterSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSummary' {Maybe Text
id :: Maybe Text
$sel:id:ClusterSummary' :: ClusterSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: ClusterSummary
s@ClusterSummary' {} Maybe Text
a -> ClusterSummary
s {$sel:id:ClusterSummary' :: Maybe Text
id = Maybe Text
a} :: ClusterSummary)

-- | The name of the cluster.
clusterSummary_name :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_name :: Lens' ClusterSummary (Maybe Text)
clusterSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSummary' {Maybe Text
name :: Maybe Text
$sel:name:ClusterSummary' :: ClusterSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: ClusterSummary
s@ClusterSummary' {} Maybe Text
a -> ClusterSummary
s {$sel:name:ClusterSummary' :: Maybe Text
name = Maybe Text
a} :: ClusterSummary)

-- | An approximation of the cost of the cluster, represented in
-- m1.small\/hours. This value is incremented one time for every hour an
-- m1.small instance runs. Larger instances are weighted more, so an EC2
-- instance that is roughly four times more expensive would result in the
-- normalized instance hours being incremented by four. This result is only
-- an approximation and does not reflect the actual billing rate.
clusterSummary_normalizedInstanceHours :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Int)
clusterSummary_normalizedInstanceHours :: Lens' ClusterSummary (Maybe Int)
clusterSummary_normalizedInstanceHours = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSummary' {Maybe Int
normalizedInstanceHours :: Maybe Int
$sel:normalizedInstanceHours:ClusterSummary' :: ClusterSummary -> Maybe Int
normalizedInstanceHours} -> Maybe Int
normalizedInstanceHours) (\s :: ClusterSummary
s@ClusterSummary' {} Maybe Int
a -> ClusterSummary
s {$sel:normalizedInstanceHours:ClusterSummary' :: Maybe Int
normalizedInstanceHours = Maybe Int
a} :: ClusterSummary)

-- | The Amazon Resource Name (ARN) of the Outpost where the cluster is
-- launched.
clusterSummary_outpostArn :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_outpostArn :: Lens' ClusterSummary (Maybe Text)
clusterSummary_outpostArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSummary' {Maybe Text
outpostArn :: Maybe Text
$sel:outpostArn:ClusterSummary' :: ClusterSummary -> Maybe Text
outpostArn} -> Maybe Text
outpostArn) (\s :: ClusterSummary
s@ClusterSummary' {} Maybe Text
a -> ClusterSummary
s {$sel:outpostArn:ClusterSummary' :: Maybe Text
outpostArn = Maybe Text
a} :: ClusterSummary)

-- | The details about the current status of the cluster.
clusterSummary_status :: Lens.Lens' ClusterSummary (Prelude.Maybe ClusterStatus)
clusterSummary_status :: Lens' ClusterSummary (Maybe ClusterStatus)
clusterSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSummary' {Maybe ClusterStatus
status :: Maybe ClusterStatus
$sel:status:ClusterSummary' :: ClusterSummary -> Maybe ClusterStatus
status} -> Maybe ClusterStatus
status) (\s :: ClusterSummary
s@ClusterSummary' {} Maybe ClusterStatus
a -> ClusterSummary
s {$sel:status:ClusterSummary' :: Maybe ClusterStatus
status = Maybe ClusterStatus
a} :: ClusterSummary)

instance Data.FromJSON ClusterSummary where
  parseJSON :: Value -> Parser ClusterSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClusterSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe ClusterStatus
-> ClusterSummary
ClusterSummary'
            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
"ClusterArn")
            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
"Id")
            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
"Name")
            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
"NormalizedInstanceHours")
            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
"OutpostArn")
            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 ClusterSummary where
  hashWithSalt :: Int -> ClusterSummary -> Int
hashWithSalt Int
_salt ClusterSummary' {Maybe Int
Maybe Text
Maybe ClusterStatus
status :: Maybe ClusterStatus
outpostArn :: Maybe Text
normalizedInstanceHours :: Maybe Int
name :: Maybe Text
id :: Maybe Text
clusterArn :: Maybe Text
$sel:status:ClusterSummary' :: ClusterSummary -> Maybe ClusterStatus
$sel:outpostArn:ClusterSummary' :: ClusterSummary -> Maybe Text
$sel:normalizedInstanceHours:ClusterSummary' :: ClusterSummary -> Maybe Int
$sel:name:ClusterSummary' :: ClusterSummary -> Maybe Text
$sel:id:ClusterSummary' :: ClusterSummary -> Maybe Text
$sel:clusterArn:ClusterSummary' :: ClusterSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clusterArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
normalizedInstanceHours
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outpostArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ClusterStatus
status

instance Prelude.NFData ClusterSummary where
  rnf :: ClusterSummary -> ()
rnf ClusterSummary' {Maybe Int
Maybe Text
Maybe ClusterStatus
status :: Maybe ClusterStatus
outpostArn :: Maybe Text
normalizedInstanceHours :: Maybe Int
name :: Maybe Text
id :: Maybe Text
clusterArn :: Maybe Text
$sel:status:ClusterSummary' :: ClusterSummary -> Maybe ClusterStatus
$sel:outpostArn:ClusterSummary' :: ClusterSummary -> Maybe Text
$sel:normalizedInstanceHours:ClusterSummary' :: ClusterSummary -> Maybe Int
$sel:name:ClusterSummary' :: ClusterSummary -> Maybe Text
$sel:id:ClusterSummary' :: ClusterSummary -> Maybe Text
$sel:clusterArn:ClusterSummary' :: ClusterSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clusterArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
normalizedInstanceHours
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outpostArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ClusterStatus
status