{-# 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-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.ResizeInfo 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 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
(ResizeInfo -> ResizeInfo -> Bool)
-> (ResizeInfo -> ResizeInfo -> Bool) -> Eq ResizeInfo
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]
(Int -> ReadS ResizeInfo)
-> ReadS [ResizeInfo]
-> ReadPrec ResizeInfo
-> ReadPrec [ResizeInfo]
-> Read 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
(Int -> ResizeInfo -> ShowS)
-> (ResizeInfo -> String)
-> ([ResizeInfo] -> ShowS)
-> Show ResizeInfo
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. ResizeInfo -> Rep ResizeInfo x)
-> (forall x. Rep ResizeInfo x -> ResizeInfo) -> Generic ResizeInfo
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' :: Maybe Bool -> Maybe Text -> ResizeInfo
ResizeInfo'
    { $sel:allowCancelResize:ResizeInfo' :: Maybe Bool
allowCancelResize = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:resizeType:ResizeInfo' :: Maybe Text
resizeType = Maybe Text
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 :: (Maybe Bool -> f (Maybe Bool)) -> ResizeInfo -> f ResizeInfo
resizeInfo_allowCancelResize = (ResizeInfo -> Maybe Bool)
-> (ResizeInfo -> Maybe Bool -> ResizeInfo)
-> Lens ResizeInfo ResizeInfo (Maybe Bool) (Maybe Bool)
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 :: (Maybe Text -> f (Maybe Text)) -> ResizeInfo -> f ResizeInfo
resizeInfo_resizeType = (ResizeInfo -> Maybe Text)
-> (ResizeInfo -> Maybe Text -> ResizeInfo)
-> Lens ResizeInfo ResizeInfo (Maybe Text) (Maybe Text)
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 Core.FromXML ResizeInfo where
  parseXML :: [Node] -> Either String ResizeInfo
parseXML [Node]
x =
    Maybe Bool -> Maybe Text -> ResizeInfo
ResizeInfo'
      (Maybe Bool -> Maybe Text -> ResizeInfo)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> ResizeInfo)
forall (f :: * -> *) a b. Functor 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
"AllowCancelResize")
      Either String (Maybe Text -> ResizeInfo)
-> Either String (Maybe Text) -> Either String ResizeInfo
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
"ResizeType")

instance Prelude.Hashable ResizeInfo

instance Prelude.NFData ResizeInfo