{-# 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.OrderableClusterOption
-- 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.OrderableClusterOption 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.AvailabilityZone

-- | Describes an orderable cluster option.
--
-- /See:/ 'newOrderableClusterOption' smart constructor.
data OrderableClusterOption = OrderableClusterOption'
  { -- | A list of availability zones for the orderable cluster.
    OrderableClusterOption -> Maybe [AvailabilityZone]
availabilityZones :: Prelude.Maybe [AvailabilityZone],
    -- | The cluster type, for example @multi-node@.
    OrderableClusterOption -> Maybe Text
clusterType :: Prelude.Maybe Prelude.Text,
    -- | The version of the orderable cluster.
    OrderableClusterOption -> Maybe Text
clusterVersion :: Prelude.Maybe Prelude.Text,
    -- | The node type for the orderable cluster.
    OrderableClusterOption -> Maybe Text
nodeType :: Prelude.Maybe Prelude.Text
  }
  deriving (OrderableClusterOption -> OrderableClusterOption -> Bool
(OrderableClusterOption -> OrderableClusterOption -> Bool)
-> (OrderableClusterOption -> OrderableClusterOption -> Bool)
-> Eq OrderableClusterOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrderableClusterOption -> OrderableClusterOption -> Bool
$c/= :: OrderableClusterOption -> OrderableClusterOption -> Bool
== :: OrderableClusterOption -> OrderableClusterOption -> Bool
$c== :: OrderableClusterOption -> OrderableClusterOption -> Bool
Prelude.Eq, ReadPrec [OrderableClusterOption]
ReadPrec OrderableClusterOption
Int -> ReadS OrderableClusterOption
ReadS [OrderableClusterOption]
(Int -> ReadS OrderableClusterOption)
-> ReadS [OrderableClusterOption]
-> ReadPrec OrderableClusterOption
-> ReadPrec [OrderableClusterOption]
-> Read OrderableClusterOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrderableClusterOption]
$creadListPrec :: ReadPrec [OrderableClusterOption]
readPrec :: ReadPrec OrderableClusterOption
$creadPrec :: ReadPrec OrderableClusterOption
readList :: ReadS [OrderableClusterOption]
$creadList :: ReadS [OrderableClusterOption]
readsPrec :: Int -> ReadS OrderableClusterOption
$creadsPrec :: Int -> ReadS OrderableClusterOption
Prelude.Read, Int -> OrderableClusterOption -> ShowS
[OrderableClusterOption] -> ShowS
OrderableClusterOption -> String
(Int -> OrderableClusterOption -> ShowS)
-> (OrderableClusterOption -> String)
-> ([OrderableClusterOption] -> ShowS)
-> Show OrderableClusterOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderableClusterOption] -> ShowS
$cshowList :: [OrderableClusterOption] -> ShowS
show :: OrderableClusterOption -> String
$cshow :: OrderableClusterOption -> String
showsPrec :: Int -> OrderableClusterOption -> ShowS
$cshowsPrec :: Int -> OrderableClusterOption -> ShowS
Prelude.Show, (forall x. OrderableClusterOption -> Rep OrderableClusterOption x)
-> (forall x.
    Rep OrderableClusterOption x -> OrderableClusterOption)
-> Generic OrderableClusterOption
forall x. Rep OrderableClusterOption x -> OrderableClusterOption
forall x. OrderableClusterOption -> Rep OrderableClusterOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrderableClusterOption x -> OrderableClusterOption
$cfrom :: forall x. OrderableClusterOption -> Rep OrderableClusterOption x
Prelude.Generic)

-- |
-- Create a value of 'OrderableClusterOption' 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:
--
-- 'availabilityZones', 'orderableClusterOption_availabilityZones' - A list of availability zones for the orderable cluster.
--
-- 'clusterType', 'orderableClusterOption_clusterType' - The cluster type, for example @multi-node@.
--
-- 'clusterVersion', 'orderableClusterOption_clusterVersion' - The version of the orderable cluster.
--
-- 'nodeType', 'orderableClusterOption_nodeType' - The node type for the orderable cluster.
newOrderableClusterOption ::
  OrderableClusterOption
newOrderableClusterOption :: OrderableClusterOption
newOrderableClusterOption =
  OrderableClusterOption' :: Maybe [AvailabilityZone]
-> Maybe Text -> Maybe Text -> Maybe Text -> OrderableClusterOption
OrderableClusterOption'
    { $sel:availabilityZones:OrderableClusterOption' :: Maybe [AvailabilityZone]
availabilityZones =
        Maybe [AvailabilityZone]
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterType:OrderableClusterOption' :: Maybe Text
clusterType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterVersion:OrderableClusterOption' :: Maybe Text
clusterVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeType:OrderableClusterOption' :: Maybe Text
nodeType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of availability zones for the orderable cluster.
orderableClusterOption_availabilityZones :: Lens.Lens' OrderableClusterOption (Prelude.Maybe [AvailabilityZone])
orderableClusterOption_availabilityZones :: (Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> OrderableClusterOption -> f OrderableClusterOption
orderableClusterOption_availabilityZones = (OrderableClusterOption -> Maybe [AvailabilityZone])
-> (OrderableClusterOption
    -> Maybe [AvailabilityZone] -> OrderableClusterOption)
-> Lens
     OrderableClusterOption
     OrderableClusterOption
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderableClusterOption' {Maybe [AvailabilityZone]
availabilityZones :: Maybe [AvailabilityZone]
$sel:availabilityZones:OrderableClusterOption' :: OrderableClusterOption -> Maybe [AvailabilityZone]
availabilityZones} -> Maybe [AvailabilityZone]
availabilityZones) (\s :: OrderableClusterOption
s@OrderableClusterOption' {} Maybe [AvailabilityZone]
a -> OrderableClusterOption
s {$sel:availabilityZones:OrderableClusterOption' :: Maybe [AvailabilityZone]
availabilityZones = Maybe [AvailabilityZone]
a} :: OrderableClusterOption) ((Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
 -> OrderableClusterOption -> f OrderableClusterOption)
-> ((Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
    -> Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> (Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> OrderableClusterOption
-> f OrderableClusterOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
-> Iso
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The cluster type, for example @multi-node@.
orderableClusterOption_clusterType :: Lens.Lens' OrderableClusterOption (Prelude.Maybe Prelude.Text)
orderableClusterOption_clusterType :: (Maybe Text -> f (Maybe Text))
-> OrderableClusterOption -> f OrderableClusterOption
orderableClusterOption_clusterType = (OrderableClusterOption -> Maybe Text)
-> (OrderableClusterOption -> Maybe Text -> OrderableClusterOption)
-> Lens
     OrderableClusterOption
     OrderableClusterOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderableClusterOption' {Maybe Text
clusterType :: Maybe Text
$sel:clusterType:OrderableClusterOption' :: OrderableClusterOption -> Maybe Text
clusterType} -> Maybe Text
clusterType) (\s :: OrderableClusterOption
s@OrderableClusterOption' {} Maybe Text
a -> OrderableClusterOption
s {$sel:clusterType:OrderableClusterOption' :: Maybe Text
clusterType = Maybe Text
a} :: OrderableClusterOption)

-- | The version of the orderable cluster.
orderableClusterOption_clusterVersion :: Lens.Lens' OrderableClusterOption (Prelude.Maybe Prelude.Text)
orderableClusterOption_clusterVersion :: (Maybe Text -> f (Maybe Text))
-> OrderableClusterOption -> f OrderableClusterOption
orderableClusterOption_clusterVersion = (OrderableClusterOption -> Maybe Text)
-> (OrderableClusterOption -> Maybe Text -> OrderableClusterOption)
-> Lens
     OrderableClusterOption
     OrderableClusterOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderableClusterOption' {Maybe Text
clusterVersion :: Maybe Text
$sel:clusterVersion:OrderableClusterOption' :: OrderableClusterOption -> Maybe Text
clusterVersion} -> Maybe Text
clusterVersion) (\s :: OrderableClusterOption
s@OrderableClusterOption' {} Maybe Text
a -> OrderableClusterOption
s {$sel:clusterVersion:OrderableClusterOption' :: Maybe Text
clusterVersion = Maybe Text
a} :: OrderableClusterOption)

-- | The node type for the orderable cluster.
orderableClusterOption_nodeType :: Lens.Lens' OrderableClusterOption (Prelude.Maybe Prelude.Text)
orderableClusterOption_nodeType :: (Maybe Text -> f (Maybe Text))
-> OrderableClusterOption -> f OrderableClusterOption
orderableClusterOption_nodeType = (OrderableClusterOption -> Maybe Text)
-> (OrderableClusterOption -> Maybe Text -> OrderableClusterOption)
-> Lens
     OrderableClusterOption
     OrderableClusterOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrderableClusterOption' {Maybe Text
nodeType :: Maybe Text
$sel:nodeType:OrderableClusterOption' :: OrderableClusterOption -> Maybe Text
nodeType} -> Maybe Text
nodeType) (\s :: OrderableClusterOption
s@OrderableClusterOption' {} Maybe Text
a -> OrderableClusterOption
s {$sel:nodeType:OrderableClusterOption' :: Maybe Text
nodeType = Maybe Text
a} :: OrderableClusterOption)

instance Core.FromXML OrderableClusterOption where
  parseXML :: [Node] -> Either String OrderableClusterOption
parseXML [Node]
x =
    Maybe [AvailabilityZone]
-> Maybe Text -> Maybe Text -> Maybe Text -> OrderableClusterOption
OrderableClusterOption'
      (Maybe [AvailabilityZone]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> OrderableClusterOption)
-> Either String (Maybe [AvailabilityZone])
-> Either
     String
     (Maybe Text -> Maybe Text -> Maybe Text -> OrderableClusterOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AvailabilityZones"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [AvailabilityZone]))
-> Either String (Maybe [AvailabilityZone])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AvailabilityZone])
-> [Node] -> Either String (Maybe [AvailabilityZone])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AvailabilityZone]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"AvailabilityZone")
                  )
      Either
  String
  (Maybe Text -> Maybe Text -> Maybe Text -> OrderableClusterOption)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> OrderableClusterOption)
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 -> Maybe Text -> OrderableClusterOption)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> OrderableClusterOption)
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
"ClusterVersion")
      Either String (Maybe Text -> OrderableClusterOption)
-> Either String (Maybe Text)
-> Either String OrderableClusterOption
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")

instance Prelude.Hashable OrderableClusterOption

instance Prelude.NFData OrderableClusterOption