{-# 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.ResizeInfo
-- 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.Redshift.Types.ResizeInfo 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.Redshift.Internal

-- | Describes a resize operation.
--
-- /See:/ 'newResizeInfo' smart constructor.
data ResizeInfo = ResizeInfo'
  { -- | A boolean value indicating if the resize operation can be cancelled.
    ResizeInfo -> Maybe Bool
allowCancelResize :: Prelude.Maybe Prelude.Bool,
    -- | Returns the value @ClassicResize@.
    ResizeInfo -> Maybe Text
resizeType :: Prelude.Maybe Prelude.Text
  }
  deriving (ResizeInfo -> ResizeInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResizeInfo -> ResizeInfo -> Bool
$c/= :: ResizeInfo -> ResizeInfo -> Bool
== :: ResizeInfo -> ResizeInfo -> Bool
$c== :: ResizeInfo -> ResizeInfo -> Bool
Prelude.Eq, ReadPrec [ResizeInfo]
ReadPrec ResizeInfo
Int -> ReadS ResizeInfo
ReadS [ResizeInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResizeInfo]
$creadListPrec :: ReadPrec [ResizeInfo]
readPrec :: ReadPrec ResizeInfo
$creadPrec :: ReadPrec ResizeInfo
readList :: ReadS [ResizeInfo]
$creadList :: ReadS [ResizeInfo]
readsPrec :: Int -> ReadS ResizeInfo
$creadsPrec :: Int -> ReadS ResizeInfo
Prelude.Read, Int -> ResizeInfo -> ShowS
[ResizeInfo] -> ShowS
ResizeInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResizeInfo] -> ShowS
$cshowList :: [ResizeInfo] -> ShowS
show :: ResizeInfo -> String
$cshow :: ResizeInfo -> String
showsPrec :: Int -> ResizeInfo -> ShowS
$cshowsPrec :: Int -> ResizeInfo -> ShowS
Prelude.Show, forall x. Rep ResizeInfo x -> ResizeInfo
forall x. ResizeInfo -> Rep ResizeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResizeInfo x -> ResizeInfo
$cfrom :: forall x. ResizeInfo -> Rep ResizeInfo x
Prelude.Generic)

-- |
-- Create a value of 'ResizeInfo' 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:
--
-- 'allowCancelResize', 'resizeInfo_allowCancelResize' - A boolean value indicating if the resize operation can be cancelled.
--
-- 'resizeType', 'resizeInfo_resizeType' - Returns the value @ClassicResize@.
newResizeInfo ::
  ResizeInfo
newResizeInfo :: ResizeInfo
newResizeInfo =
  ResizeInfo'
    { $sel:allowCancelResize:ResizeInfo' :: Maybe Bool
allowCancelResize = forall a. Maybe a
Prelude.Nothing,
      $sel:resizeType:ResizeInfo' :: Maybe Text
resizeType = forall a. Maybe a
Prelude.Nothing
    }

-- | A boolean value indicating if the resize operation can be cancelled.
resizeInfo_allowCancelResize :: Lens.Lens' ResizeInfo (Prelude.Maybe Prelude.Bool)
resizeInfo_allowCancelResize :: Lens' ResizeInfo (Maybe Bool)
resizeInfo_allowCancelResize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeInfo' {Maybe Bool
allowCancelResize :: Maybe Bool
$sel:allowCancelResize:ResizeInfo' :: ResizeInfo -> Maybe Bool
allowCancelResize} -> Maybe Bool
allowCancelResize) (\s :: ResizeInfo
s@ResizeInfo' {} Maybe Bool
a -> ResizeInfo
s {$sel:allowCancelResize:ResizeInfo' :: Maybe Bool
allowCancelResize = Maybe Bool
a} :: ResizeInfo)

-- | Returns the value @ClassicResize@.
resizeInfo_resizeType :: Lens.Lens' ResizeInfo (Prelude.Maybe Prelude.Text)
resizeInfo_resizeType :: Lens' ResizeInfo (Maybe Text)
resizeInfo_resizeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResizeInfo' {Maybe Text
resizeType :: Maybe Text
$sel:resizeType:ResizeInfo' :: ResizeInfo -> Maybe Text
resizeType} -> Maybe Text
resizeType) (\s :: ResizeInfo
s@ResizeInfo' {} Maybe Text
a -> ResizeInfo
s {$sel:resizeType:ResizeInfo' :: Maybe Text
resizeType = Maybe Text
a} :: ResizeInfo)

instance Data.FromXML ResizeInfo where
  parseXML :: [Node] -> Either String ResizeInfo
parseXML [Node]
x =
    Maybe Bool -> Maybe Text -> ResizeInfo
ResizeInfo'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"AllowCancelResize")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ResizeType")

instance Prelude.Hashable ResizeInfo where
  hashWithSalt :: Int -> ResizeInfo -> Int
hashWithSalt Int
_salt ResizeInfo' {Maybe Bool
Maybe Text
resizeType :: Maybe Text
allowCancelResize :: Maybe Bool
$sel:resizeType:ResizeInfo' :: ResizeInfo -> Maybe Text
$sel:allowCancelResize:ResizeInfo' :: ResizeInfo -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowCancelResize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resizeType

instance Prelude.NFData ResizeInfo where
  rnf :: ResizeInfo -> ()
rnf ResizeInfo' {Maybe Bool
Maybe Text
resizeType :: Maybe Text
allowCancelResize :: Maybe Bool
$sel:resizeType:ResizeInfo' :: ResizeInfo -> Maybe Text
$sel:allowCancelResize:ResizeInfo' :: ResizeInfo -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowCancelResize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resizeType