{-# 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.ResizeClusterMessage
-- 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.ResizeClusterMessage where

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

-- | Describes a resize cluster operation. For example, a scheduled action to
-- run the @ResizeCluster@ API operation.
--
-- /See:/ 'newResizeClusterMessage' smart constructor.
data ResizeClusterMessage = ResizeClusterMessage'
  { -- | The new number of nodes for the cluster. If not specified, the
    -- cluster\'s current number of nodes is used.
    ResizeClusterMessage -> Maybe Int
numberOfNodes :: Prelude.Maybe Prelude.Int,
    -- | A boolean value indicating whether the resize operation is using the
    -- classic resize process. If you don\'t provide this parameter or set the
    -- value to @false@, the resize type is elastic.
    ResizeClusterMessage -> Maybe Bool
classic :: Prelude.Maybe Prelude.Bool,
    -- | The new cluster type for the specified cluster.
    ResizeClusterMessage -> Maybe Text
clusterType :: Prelude.Maybe Prelude.Text,
    -- | The new node type for the nodes you are adding. If not specified, the
    -- cluster\'s current node type is used.
    ResizeClusterMessage -> Maybe Text
nodeType :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the cluster to resize.
    ResizeClusterMessage -> Text
clusterIdentifier :: Prelude.Text
  }
  deriving (ResizeClusterMessage -> ResizeClusterMessage -> Bool
(ResizeClusterMessage -> ResizeClusterMessage -> Bool)
-> (ResizeClusterMessage -> ResizeClusterMessage -> Bool)
-> Eq ResizeClusterMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResizeClusterMessage -> ResizeClusterMessage -> Bool
$c/= :: ResizeClusterMessage -> ResizeClusterMessage -> Bool
== :: ResizeClusterMessage -> ResizeClusterMessage -> Bool
$c== :: ResizeClusterMessage -> ResizeClusterMessage -> Bool
Prelude.Eq, ReadPrec [ResizeClusterMessage]
ReadPrec ResizeClusterMessage
Int -> ReadS ResizeClusterMessage
ReadS [ResizeClusterMessage]
(Int -> ReadS ResizeClusterMessage)
-> ReadS [ResizeClusterMessage]
-> ReadPrec ResizeClusterMessage
-> ReadPrec [ResizeClusterMessage]
-> Read ResizeClusterMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResizeClusterMessage]
$creadListPrec :: ReadPrec [ResizeClusterMessage]
readPrec :: ReadPrec ResizeClusterMessage
$creadPrec :: ReadPrec ResizeClusterMessage
readList :: ReadS [ResizeClusterMessage]
$creadList :: ReadS [ResizeClusterMessage]
readsPrec :: Int -> ReadS ResizeClusterMessage
$creadsPrec :: Int -> ReadS ResizeClusterMessage
Prelude.Read, Int -> ResizeClusterMessage -> ShowS
[ResizeClusterMessage] -> ShowS
ResizeClusterMessage -> String
(Int -> ResizeClusterMessage -> ShowS)
-> (ResizeClusterMessage -> String)
-> ([ResizeClusterMessage] -> ShowS)
-> Show ResizeClusterMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResizeClusterMessage] -> ShowS
$cshowList :: [ResizeClusterMessage] -> ShowS
show :: ResizeClusterMessage -> String
$cshow :: ResizeClusterMessage -> String
showsPrec :: Int -> ResizeClusterMessage -> ShowS
$cshowsPrec :: Int -> ResizeClusterMessage -> ShowS
Prelude.Show, (forall x. ResizeClusterMessage -> Rep ResizeClusterMessage x)
-> (forall x. Rep ResizeClusterMessage x -> ResizeClusterMessage)
-> Generic ResizeClusterMessage
forall x. Rep ResizeClusterMessage x -> ResizeClusterMessage
forall x. ResizeClusterMessage -> Rep ResizeClusterMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResizeClusterMessage x -> ResizeClusterMessage
$cfrom :: forall x. ResizeClusterMessage -> Rep ResizeClusterMessage x
Prelude.Generic)

-- |
-- Create a value of 'ResizeClusterMessage' 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:
--
-- 'numberOfNodes', 'resizeClusterMessage_numberOfNodes' - The new number of nodes for the cluster. If not specified, the
-- cluster\'s current number of nodes is used.
--
-- 'classic', 'resizeClusterMessage_classic' - A boolean value indicating whether the resize operation is using the
-- classic resize process. If you don\'t provide this parameter or set the
-- value to @false@, the resize type is elastic.
--
-- 'clusterType', 'resizeClusterMessage_clusterType' - The new cluster type for the specified cluster.
--
-- 'nodeType', 'resizeClusterMessage_nodeType' - The new node type for the nodes you are adding. If not specified, the
-- cluster\'s current node type is used.
--
-- 'clusterIdentifier', 'resizeClusterMessage_clusterIdentifier' - The unique identifier for the cluster to resize.
newResizeClusterMessage ::
  -- | 'clusterIdentifier'
  Prelude.Text ->
  ResizeClusterMessage
newResizeClusterMessage :: Text -> ResizeClusterMessage
newResizeClusterMessage Text
pClusterIdentifier_ =
  ResizeClusterMessage' :: Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> ResizeClusterMessage
ResizeClusterMessage'
    { $sel:numberOfNodes:ResizeClusterMessage' :: Maybe Int
numberOfNodes =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:classic:ResizeClusterMessage' :: Maybe Bool
classic = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterType:ResizeClusterMessage' :: Maybe Text
clusterType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeType:ResizeClusterMessage' :: Maybe Text
nodeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterIdentifier:ResizeClusterMessage' :: Text
clusterIdentifier = Text
pClusterIdentifier_
    }

-- | The new number of nodes for the cluster. If not specified, the
-- cluster\'s current number of nodes is used.
resizeClusterMessage_numberOfNodes :: Lens.Lens' ResizeClusterMessage (Prelude.Maybe Prelude.Int)
resizeClusterMessage_numberOfNodes :: (Maybe Int -> f (Maybe Int))
-> ResizeClusterMessage -> f ResizeClusterMessage
resizeClusterMessage_numberOfNodes = (ResizeClusterMessage -> Maybe Int)
-> (ResizeClusterMessage -> Maybe Int -> ResizeClusterMessage)
-> Lens
     ResizeClusterMessage ResizeClusterMessage (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeClusterMessage' {Maybe Int
numberOfNodes :: Maybe Int
$sel:numberOfNodes:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Int
numberOfNodes} -> Maybe Int
numberOfNodes) (\s :: ResizeClusterMessage
s@ResizeClusterMessage' {} Maybe Int
a -> ResizeClusterMessage
s {$sel:numberOfNodes:ResizeClusterMessage' :: Maybe Int
numberOfNodes = Maybe Int
a} :: ResizeClusterMessage)

-- | A boolean value indicating whether the resize operation is using the
-- classic resize process. If you don\'t provide this parameter or set the
-- value to @false@, the resize type is elastic.
resizeClusterMessage_classic :: Lens.Lens' ResizeClusterMessage (Prelude.Maybe Prelude.Bool)
resizeClusterMessage_classic :: (Maybe Bool -> f (Maybe Bool))
-> ResizeClusterMessage -> f ResizeClusterMessage
resizeClusterMessage_classic = (ResizeClusterMessage -> Maybe Bool)
-> (ResizeClusterMessage -> Maybe Bool -> ResizeClusterMessage)
-> Lens
     ResizeClusterMessage ResizeClusterMessage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeClusterMessage' {Maybe Bool
classic :: Maybe Bool
$sel:classic:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Bool
classic} -> Maybe Bool
classic) (\s :: ResizeClusterMessage
s@ResizeClusterMessage' {} Maybe Bool
a -> ResizeClusterMessage
s {$sel:classic:ResizeClusterMessage' :: Maybe Bool
classic = Maybe Bool
a} :: ResizeClusterMessage)

-- | The new cluster type for the specified cluster.
resizeClusterMessage_clusterType :: Lens.Lens' ResizeClusterMessage (Prelude.Maybe Prelude.Text)
resizeClusterMessage_clusterType :: (Maybe Text -> f (Maybe Text))
-> ResizeClusterMessage -> f ResizeClusterMessage
resizeClusterMessage_clusterType = (ResizeClusterMessage -> Maybe Text)
-> (ResizeClusterMessage -> Maybe Text -> ResizeClusterMessage)
-> Lens
     ResizeClusterMessage ResizeClusterMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeClusterMessage' {Maybe Text
clusterType :: Maybe Text
$sel:clusterType:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Text
clusterType} -> Maybe Text
clusterType) (\s :: ResizeClusterMessage
s@ResizeClusterMessage' {} Maybe Text
a -> ResizeClusterMessage
s {$sel:clusterType:ResizeClusterMessage' :: Maybe Text
clusterType = Maybe Text
a} :: ResizeClusterMessage)

-- | The new node type for the nodes you are adding. If not specified, the
-- cluster\'s current node type is used.
resizeClusterMessage_nodeType :: Lens.Lens' ResizeClusterMessage (Prelude.Maybe Prelude.Text)
resizeClusterMessage_nodeType :: (Maybe Text -> f (Maybe Text))
-> ResizeClusterMessage -> f ResizeClusterMessage
resizeClusterMessage_nodeType = (ResizeClusterMessage -> Maybe Text)
-> (ResizeClusterMessage -> Maybe Text -> ResizeClusterMessage)
-> Lens
     ResizeClusterMessage ResizeClusterMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeClusterMessage' {Maybe Text
nodeType :: Maybe Text
$sel:nodeType:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Text
nodeType} -> Maybe Text
nodeType) (\s :: ResizeClusterMessage
s@ResizeClusterMessage' {} Maybe Text
a -> ResizeClusterMessage
s {$sel:nodeType:ResizeClusterMessage' :: Maybe Text
nodeType = Maybe Text
a} :: ResizeClusterMessage)

-- | The unique identifier for the cluster to resize.
resizeClusterMessage_clusterIdentifier :: Lens.Lens' ResizeClusterMessage Prelude.Text
resizeClusterMessage_clusterIdentifier :: (Text -> f Text) -> ResizeClusterMessage -> f ResizeClusterMessage
resizeClusterMessage_clusterIdentifier = (ResizeClusterMessage -> Text)
-> (ResizeClusterMessage -> Text -> ResizeClusterMessage)
-> Lens ResizeClusterMessage ResizeClusterMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeClusterMessage' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:ResizeClusterMessage' :: ResizeClusterMessage -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: ResizeClusterMessage
s@ResizeClusterMessage' {} Text
a -> ResizeClusterMessage
s {$sel:clusterIdentifier:ResizeClusterMessage' :: Text
clusterIdentifier = Text
a} :: ResizeClusterMessage)

instance Core.FromXML ResizeClusterMessage where
  parseXML :: [Node] -> Either String ResizeClusterMessage
parseXML [Node]
x =
    Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> ResizeClusterMessage
ResizeClusterMessage'
      (Maybe Int
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> ResizeClusterMessage)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Bool
      -> Maybe Text -> Maybe Text -> Text -> ResizeClusterMessage)
forall (f :: * -> *) a b. Functor 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 Bool
   -> Maybe Text -> Maybe Text -> Text -> ResizeClusterMessage)
-> Either String (Maybe Bool)
-> Either
     String (Maybe Text -> Maybe Text -> Text -> ResizeClusterMessage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Classic")
      Either
  String (Maybe Text -> Maybe Text -> Text -> ResizeClusterMessage)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Text -> ResizeClusterMessage)
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
"ClusterType")
      Either String (Maybe Text -> Text -> ResizeClusterMessage)
-> Either String (Maybe Text)
-> Either String (Text -> ResizeClusterMessage)
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 (Text -> ResizeClusterMessage)
-> Either String Text -> Either String ResizeClusterMessage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ClusterIdentifier")

instance Prelude.Hashable ResizeClusterMessage

instance Prelude.NFData ResizeClusterMessage

instance Core.ToQuery ResizeClusterMessage where
  toQuery :: ResizeClusterMessage -> QueryString
toQuery ResizeClusterMessage' {Maybe Bool
Maybe Int
Maybe Text
Text
clusterIdentifier :: Text
nodeType :: Maybe Text
clusterType :: Maybe Text
classic :: Maybe Bool
numberOfNodes :: Maybe Int
$sel:clusterIdentifier:ResizeClusterMessage' :: ResizeClusterMessage -> Text
$sel:nodeType:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Text
$sel:clusterType:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Text
$sel:classic:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Bool
$sel:numberOfNodes:ResizeClusterMessage' :: ResizeClusterMessage -> Maybe Int
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"NumberOfNodes" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
numberOfNodes,
        ByteString
"Classic" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
classic,
        ByteString
"ClusterType" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clusterType,
        ByteString
"NodeType" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nodeType,
        ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier
      ]