{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EMR.Types.ClusterSummary where

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

-- | The summary description of the cluster.
--
-- /See:/ 'newClusterSummary' smart constructor.
data ClusterSummary = ClusterSummary'
  { -- | The details about the current status of the cluster.
    ClusterSummary -> Maybe ClusterStatus
status :: Prelude.Maybe ClusterStatus,
    -- | The Amazon Resource Name of the cluster.
    ClusterSummary -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Outpost where the cluster is
    -- launched.
    ClusterSummary -> Maybe Text
outpostArn :: 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 name of the cluster.
    ClusterSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the cluster.
    ClusterSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterSummary -> ClusterSummary -> Bool
(ClusterSummary -> ClusterSummary -> Bool)
-> (ClusterSummary -> ClusterSummary -> Bool) -> Eq ClusterSummary
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]
(Int -> ReadS ClusterSummary)
-> ReadS [ClusterSummary]
-> ReadPrec ClusterSummary
-> ReadPrec [ClusterSummary]
-> Read 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
(Int -> ClusterSummary -> ShowS)
-> (ClusterSummary -> String)
-> ([ClusterSummary] -> ShowS)
-> Show ClusterSummary
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. ClusterSummary -> Rep ClusterSummary x)
-> (forall x. Rep ClusterSummary x -> ClusterSummary)
-> Generic ClusterSummary
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:
--
-- 'status', 'clusterSummary_status' - The details about the current status of the cluster.
--
-- 'clusterArn', 'clusterSummary_clusterArn' - The Amazon Resource Name of the cluster.
--
-- 'outpostArn', 'clusterSummary_outpostArn' - The Amazon Resource Name (ARN) of the Outpost where the cluster is
-- launched.
--
-- '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.
--
-- 'name', 'clusterSummary_name' - The name of the cluster.
--
-- 'id', 'clusterSummary_id' - The unique identifier for the cluster.
newClusterSummary ::
  ClusterSummary
newClusterSummary :: ClusterSummary
newClusterSummary =
  ClusterSummary' :: Maybe ClusterStatus
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> ClusterSummary
ClusterSummary'
    { $sel:status:ClusterSummary' :: Maybe ClusterStatus
status = Maybe ClusterStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterArn:ClusterSummary' :: Maybe Text
clusterArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outpostArn:ClusterSummary' :: Maybe Text
outpostArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:normalizedInstanceHours:ClusterSummary' :: Maybe Int
normalizedInstanceHours = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ClusterSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ClusterSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The details about the current status of the cluster.
clusterSummary_status :: Lens.Lens' ClusterSummary (Prelude.Maybe ClusterStatus)
clusterSummary_status :: (Maybe ClusterStatus -> f (Maybe ClusterStatus))
-> ClusterSummary -> f ClusterSummary
clusterSummary_status = (ClusterSummary -> Maybe ClusterStatus)
-> (ClusterSummary -> Maybe ClusterStatus -> ClusterSummary)
-> Lens
     ClusterSummary
     ClusterSummary
     (Maybe ClusterStatus)
     (Maybe ClusterStatus)
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)

-- | The Amazon Resource Name of the cluster.
clusterSummary_clusterArn :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_clusterArn :: (Maybe Text -> f (Maybe Text))
-> ClusterSummary -> f ClusterSummary
clusterSummary_clusterArn = (ClusterSummary -> Maybe Text)
-> (ClusterSummary -> Maybe Text -> ClusterSummary)
-> Lens ClusterSummary ClusterSummary (Maybe Text) (Maybe Text)
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 Amazon Resource Name (ARN) of the Outpost where the cluster is
-- launched.
clusterSummary_outpostArn :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_outpostArn :: (Maybe Text -> f (Maybe Text))
-> ClusterSummary -> f ClusterSummary
clusterSummary_outpostArn = (ClusterSummary -> Maybe Text)
-> (ClusterSummary -> Maybe Text -> ClusterSummary)
-> Lens ClusterSummary ClusterSummary (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Int -> f (Maybe Int)) -> ClusterSummary -> f ClusterSummary
clusterSummary_normalizedInstanceHours = (ClusterSummary -> Maybe Int)
-> (ClusterSummary -> Maybe Int -> ClusterSummary)
-> Lens ClusterSummary ClusterSummary (Maybe Int) (Maybe Int)
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 name of the cluster.
clusterSummary_name :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_name :: (Maybe Text -> f (Maybe Text))
-> ClusterSummary -> f ClusterSummary
clusterSummary_name = (ClusterSummary -> Maybe Text)
-> (ClusterSummary -> Maybe Text -> ClusterSummary)
-> Lens ClusterSummary ClusterSummary (Maybe Text) (Maybe Text)
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)

-- | The unique identifier for the cluster.
clusterSummary_id :: Lens.Lens' ClusterSummary (Prelude.Maybe Prelude.Text)
clusterSummary_id :: (Maybe Text -> f (Maybe Text))
-> ClusterSummary -> f ClusterSummary
clusterSummary_id = (ClusterSummary -> Maybe Text)
-> (ClusterSummary -> Maybe Text -> ClusterSummary)
-> Lens ClusterSummary ClusterSummary (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON ClusterSummary where
  parseJSON :: Value -> Parser ClusterSummary
parseJSON =
    String
-> (Object -> Parser ClusterSummary)
-> Value
-> Parser ClusterSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClusterSummary"
      ( \Object
x ->
          Maybe ClusterStatus
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> ClusterSummary
ClusterSummary'
            (Maybe ClusterStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> ClusterSummary)
-> Parser (Maybe ClusterStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> ClusterSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ClusterStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> ClusterSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int -> Maybe Text -> Maybe Text -> ClusterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ClusterArn")
            Parser
  (Maybe Text
   -> Maybe Int -> Maybe Text -> Maybe Text -> ClusterSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> Maybe Text -> ClusterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutpostArn")
            Parser (Maybe Int -> Maybe Text -> Maybe Text -> ClusterSummary)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Text -> ClusterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NormalizedInstanceHours")
            Parser (Maybe Text -> Maybe Text -> ClusterSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ClusterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> ClusterSummary)
-> Parser (Maybe Text) -> Parser ClusterSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
      )

instance Prelude.Hashable ClusterSummary

instance Prelude.NFData ClusterSummary