{-# 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.Redshift.Types.NodeConfigurationOption
-- 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.Redshift.Types.NodeConfigurationOption where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.Mode

-- | A list of node configurations.
--
-- /See:/ 'newNodeConfigurationOption' smart constructor.
data NodeConfigurationOption = NodeConfigurationOption'
  { -- | The category of the node configuration recommendation.
    NodeConfigurationOption -> Maybe Mode
mode :: Prelude.Maybe Mode,
    -- | The number of nodes.
    NodeConfigurationOption -> Maybe Int
numberOfNodes :: Prelude.Maybe Prelude.Int,
    -- | The node type, such as, \"ds2.8xlarge\".
    NodeConfigurationOption -> Maybe Text
nodeType :: Prelude.Maybe Prelude.Text,
    -- | The estimated disk utilizaton percentage.
    NodeConfigurationOption -> Maybe Double
estimatedDiskUtilizationPercent :: Prelude.Maybe Prelude.Double
  }
  deriving (NodeConfigurationOption -> NodeConfigurationOption -> Bool
(NodeConfigurationOption -> NodeConfigurationOption -> Bool)
-> (NodeConfigurationOption -> NodeConfigurationOption -> Bool)
-> Eq NodeConfigurationOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeConfigurationOption -> NodeConfigurationOption -> Bool
$c/= :: NodeConfigurationOption -> NodeConfigurationOption -> Bool
== :: NodeConfigurationOption -> NodeConfigurationOption -> Bool
$c== :: NodeConfigurationOption -> NodeConfigurationOption -> Bool
Prelude.Eq, ReadPrec [NodeConfigurationOption]
ReadPrec NodeConfigurationOption
Int -> ReadS NodeConfigurationOption
ReadS [NodeConfigurationOption]
(Int -> ReadS NodeConfigurationOption)
-> ReadS [NodeConfigurationOption]
-> ReadPrec NodeConfigurationOption
-> ReadPrec [NodeConfigurationOption]
-> Read NodeConfigurationOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeConfigurationOption]
$creadListPrec :: ReadPrec [NodeConfigurationOption]
readPrec :: ReadPrec NodeConfigurationOption
$creadPrec :: ReadPrec NodeConfigurationOption
readList :: ReadS [NodeConfigurationOption]
$creadList :: ReadS [NodeConfigurationOption]
readsPrec :: Int -> ReadS NodeConfigurationOption
$creadsPrec :: Int -> ReadS NodeConfigurationOption
Prelude.Read, Int -> NodeConfigurationOption -> ShowS
[NodeConfigurationOption] -> ShowS
NodeConfigurationOption -> String
(Int -> NodeConfigurationOption -> ShowS)
-> (NodeConfigurationOption -> String)
-> ([NodeConfigurationOption] -> ShowS)
-> Show NodeConfigurationOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeConfigurationOption] -> ShowS
$cshowList :: [NodeConfigurationOption] -> ShowS
show :: NodeConfigurationOption -> String
$cshow :: NodeConfigurationOption -> String
showsPrec :: Int -> NodeConfigurationOption -> ShowS
$cshowsPrec :: Int -> NodeConfigurationOption -> ShowS
Prelude.Show, (forall x.
 NodeConfigurationOption -> Rep NodeConfigurationOption x)
-> (forall x.
    Rep NodeConfigurationOption x -> NodeConfigurationOption)
-> Generic NodeConfigurationOption
forall x. Rep NodeConfigurationOption x -> NodeConfigurationOption
forall x. NodeConfigurationOption -> Rep NodeConfigurationOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeConfigurationOption x -> NodeConfigurationOption
$cfrom :: forall x. NodeConfigurationOption -> Rep NodeConfigurationOption x
Prelude.Generic)

-- |
-- Create a value of 'NodeConfigurationOption' 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:
--
-- 'mode', 'nodeConfigurationOption_mode' - The category of the node configuration recommendation.
--
-- 'numberOfNodes', 'nodeConfigurationOption_numberOfNodes' - The number of nodes.
--
-- 'nodeType', 'nodeConfigurationOption_nodeType' - The node type, such as, \"ds2.8xlarge\".
--
-- 'estimatedDiskUtilizationPercent', 'nodeConfigurationOption_estimatedDiskUtilizationPercent' - The estimated disk utilizaton percentage.
newNodeConfigurationOption ::
  NodeConfigurationOption
newNodeConfigurationOption :: NodeConfigurationOption
newNodeConfigurationOption =
  NodeConfigurationOption' :: Maybe Mode
-> Maybe Int
-> Maybe Text
-> Maybe Double
-> NodeConfigurationOption
NodeConfigurationOption'
    { $sel:mode:NodeConfigurationOption' :: Maybe Mode
mode = Maybe Mode
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfNodes:NodeConfigurationOption' :: Maybe Int
numberOfNodes = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeType:NodeConfigurationOption' :: Maybe Text
nodeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedDiskUtilizationPercent:NodeConfigurationOption' :: Maybe Double
estimatedDiskUtilizationPercent = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The category of the node configuration recommendation.
nodeConfigurationOption_mode :: Lens.Lens' NodeConfigurationOption (Prelude.Maybe Mode)
nodeConfigurationOption_mode :: (Maybe Mode -> f (Maybe Mode))
-> NodeConfigurationOption -> f NodeConfigurationOption
nodeConfigurationOption_mode = (NodeConfigurationOption -> Maybe Mode)
-> (NodeConfigurationOption
    -> Maybe Mode -> NodeConfigurationOption)
-> Lens
     NodeConfigurationOption
     NodeConfigurationOption
     (Maybe Mode)
     (Maybe Mode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeConfigurationOption' {Maybe Mode
mode :: Maybe Mode
$sel:mode:NodeConfigurationOption' :: NodeConfigurationOption -> Maybe Mode
mode} -> Maybe Mode
mode) (\s :: NodeConfigurationOption
s@NodeConfigurationOption' {} Maybe Mode
a -> NodeConfigurationOption
s {$sel:mode:NodeConfigurationOption' :: Maybe Mode
mode = Maybe Mode
a} :: NodeConfigurationOption)

-- | The number of nodes.
nodeConfigurationOption_numberOfNodes :: Lens.Lens' NodeConfigurationOption (Prelude.Maybe Prelude.Int)
nodeConfigurationOption_numberOfNodes :: (Maybe Int -> f (Maybe Int))
-> NodeConfigurationOption -> f NodeConfigurationOption
nodeConfigurationOption_numberOfNodes = (NodeConfigurationOption -> Maybe Int)
-> (NodeConfigurationOption
    -> Maybe Int -> NodeConfigurationOption)
-> Lens
     NodeConfigurationOption
     NodeConfigurationOption
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeConfigurationOption' {Maybe Int
numberOfNodes :: Maybe Int
$sel:numberOfNodes:NodeConfigurationOption' :: NodeConfigurationOption -> Maybe Int
numberOfNodes} -> Maybe Int
numberOfNodes) (\s :: NodeConfigurationOption
s@NodeConfigurationOption' {} Maybe Int
a -> NodeConfigurationOption
s {$sel:numberOfNodes:NodeConfigurationOption' :: Maybe Int
numberOfNodes = Maybe Int
a} :: NodeConfigurationOption)

-- | The node type, such as, \"ds2.8xlarge\".
nodeConfigurationOption_nodeType :: Lens.Lens' NodeConfigurationOption (Prelude.Maybe Prelude.Text)
nodeConfigurationOption_nodeType :: (Maybe Text -> f (Maybe Text))
-> NodeConfigurationOption -> f NodeConfigurationOption
nodeConfigurationOption_nodeType = (NodeConfigurationOption -> Maybe Text)
-> (NodeConfigurationOption
    -> Maybe Text -> NodeConfigurationOption)
-> Lens
     NodeConfigurationOption
     NodeConfigurationOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeConfigurationOption' {Maybe Text
nodeType :: Maybe Text
$sel:nodeType:NodeConfigurationOption' :: NodeConfigurationOption -> Maybe Text
nodeType} -> Maybe Text
nodeType) (\s :: NodeConfigurationOption
s@NodeConfigurationOption' {} Maybe Text
a -> NodeConfigurationOption
s {$sel:nodeType:NodeConfigurationOption' :: Maybe Text
nodeType = Maybe Text
a} :: NodeConfigurationOption)

-- | The estimated disk utilizaton percentage.
nodeConfigurationOption_estimatedDiskUtilizationPercent :: Lens.Lens' NodeConfigurationOption (Prelude.Maybe Prelude.Double)
nodeConfigurationOption_estimatedDiskUtilizationPercent :: (Maybe Double -> f (Maybe Double))
-> NodeConfigurationOption -> f NodeConfigurationOption
nodeConfigurationOption_estimatedDiskUtilizationPercent = (NodeConfigurationOption -> Maybe Double)
-> (NodeConfigurationOption
    -> Maybe Double -> NodeConfigurationOption)
-> Lens
     NodeConfigurationOption
     NodeConfigurationOption
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeConfigurationOption' {Maybe Double
estimatedDiskUtilizationPercent :: Maybe Double
$sel:estimatedDiskUtilizationPercent:NodeConfigurationOption' :: NodeConfigurationOption -> Maybe Double
estimatedDiskUtilizationPercent} -> Maybe Double
estimatedDiskUtilizationPercent) (\s :: NodeConfigurationOption
s@NodeConfigurationOption' {} Maybe Double
a -> NodeConfigurationOption
s {$sel:estimatedDiskUtilizationPercent:NodeConfigurationOption' :: Maybe Double
estimatedDiskUtilizationPercent = Maybe Double
a} :: NodeConfigurationOption)

instance Core.FromXML NodeConfigurationOption where
  parseXML :: [Node] -> Either String NodeConfigurationOption
parseXML [Node]
x =
    Maybe Mode
-> Maybe Int
-> Maybe Text
-> Maybe Double
-> NodeConfigurationOption
NodeConfigurationOption'
      (Maybe Mode
 -> Maybe Int
 -> Maybe Text
 -> Maybe Double
 -> NodeConfigurationOption)
-> Either String (Maybe Mode)
-> Either
     String
     (Maybe Int
      -> Maybe Text -> Maybe Double -> NodeConfigurationOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Mode)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Mode")
      Either
  String
  (Maybe Int
   -> Maybe Text -> Maybe Double -> NodeConfigurationOption)
-> Either String (Maybe Int)
-> Either
     String (Maybe Text -> Maybe Double -> NodeConfigurationOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NumberOfNodes")
      Either
  String (Maybe Text -> Maybe Double -> NodeConfigurationOption)
-> Either String (Maybe Text)
-> Either String (Maybe Double -> NodeConfigurationOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NodeType")
      Either String (Maybe Double -> NodeConfigurationOption)
-> Either String (Maybe Double)
-> Either String NodeConfigurationOption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EstimatedDiskUtilizationPercent")

instance Prelude.Hashable NodeConfigurationOption

instance Prelude.NFData NodeConfigurationOption