{-# 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.ReservedNode
-- 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.ReservedNode 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.RecurringCharge
import Amazonka.Redshift.Types.ReservedNodeOfferingType

-- | Describes a reserved node. You can call the
-- DescribeReservedNodeOfferings API to obtain the available reserved node
-- offerings.
--
-- /See:/ 'newReservedNode' smart constructor.
data ReservedNode = ReservedNode'
  { ReservedNode -> Maybe ReservedNodeOfferingType
reservedNodeOfferingType :: Prelude.Maybe ReservedNodeOfferingType,
    -- | The state of the reserved compute node.
    --
    -- Possible Values:
    --
    -- -   pending-payment-This reserved node has recently been purchased, and
    --     the sale has been approved, but payment has not yet been confirmed.
    --
    -- -   active-This reserved node is owned by the caller and is available
    --     for use.
    --
    -- -   payment-failed-Payment failed for the purchase attempt.
    --
    -- -   retired-The reserved node is no longer available.
    --
    -- -   exchanging-The owner is exchanging the reserved node for another
    --     reserved node.
    ReservedNode -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The currency code for the reserved cluster.
    ReservedNode -> Maybe Text
currencyCode :: Prelude.Maybe Prelude.Text,
    -- | The time the reservation started. You purchase a reserved node offering
    -- for a duration. This is the start time of that duration.
    ReservedNode -> Maybe ISO8601
startTime :: Prelude.Maybe Core.ISO8601,
    -- | The number of reserved compute nodes.
    ReservedNode -> Maybe Int
nodeCount :: Prelude.Maybe Prelude.Int,
    -- | The unique identifier for the reservation.
    ReservedNode -> Maybe Text
reservedNodeId :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the reserved node offering.
    ReservedNode -> Maybe Text
reservedNodeOfferingId :: Prelude.Maybe Prelude.Text,
    -- | The recurring charges for the reserved node.
    ReservedNode -> Maybe [RecurringCharge]
recurringCharges :: Prelude.Maybe [RecurringCharge],
    -- | The anticipated utilization of the reserved node, as defined in the
    -- reserved node offering.
    ReservedNode -> Maybe Text
offeringType :: Prelude.Maybe Prelude.Text,
    -- | The hourly rate Amazon Redshift charges you for this reserved node.
    ReservedNode -> Maybe Double
usagePrice :: Prelude.Maybe Prelude.Double,
    -- | The node type of the reserved node.
    ReservedNode -> Maybe Text
nodeType :: Prelude.Maybe Prelude.Text,
    -- | The fixed cost Amazon Redshift charges you for this reserved node.
    ReservedNode -> Maybe Double
fixedPrice :: Prelude.Maybe Prelude.Double,
    -- | The duration of the node reservation in seconds.
    ReservedNode -> Maybe Int
duration :: Prelude.Maybe Prelude.Int
  }
  deriving (ReservedNode -> ReservedNode -> Bool
(ReservedNode -> ReservedNode -> Bool)
-> (ReservedNode -> ReservedNode -> Bool) -> Eq ReservedNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReservedNode -> ReservedNode -> Bool
$c/= :: ReservedNode -> ReservedNode -> Bool
== :: ReservedNode -> ReservedNode -> Bool
$c== :: ReservedNode -> ReservedNode -> Bool
Prelude.Eq, ReadPrec [ReservedNode]
ReadPrec ReservedNode
Int -> ReadS ReservedNode
ReadS [ReservedNode]
(Int -> ReadS ReservedNode)
-> ReadS [ReservedNode]
-> ReadPrec ReservedNode
-> ReadPrec [ReservedNode]
-> Read ReservedNode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReservedNode]
$creadListPrec :: ReadPrec [ReservedNode]
readPrec :: ReadPrec ReservedNode
$creadPrec :: ReadPrec ReservedNode
readList :: ReadS [ReservedNode]
$creadList :: ReadS [ReservedNode]
readsPrec :: Int -> ReadS ReservedNode
$creadsPrec :: Int -> ReadS ReservedNode
Prelude.Read, Int -> ReservedNode -> ShowS
[ReservedNode] -> ShowS
ReservedNode -> String
(Int -> ReservedNode -> ShowS)
-> (ReservedNode -> String)
-> ([ReservedNode] -> ShowS)
-> Show ReservedNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReservedNode] -> ShowS
$cshowList :: [ReservedNode] -> ShowS
show :: ReservedNode -> String
$cshow :: ReservedNode -> String
showsPrec :: Int -> ReservedNode -> ShowS
$cshowsPrec :: Int -> ReservedNode -> ShowS
Prelude.Show, (forall x. ReservedNode -> Rep ReservedNode x)
-> (forall x. Rep ReservedNode x -> ReservedNode)
-> Generic ReservedNode
forall x. Rep ReservedNode x -> ReservedNode
forall x. ReservedNode -> Rep ReservedNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReservedNode x -> ReservedNode
$cfrom :: forall x. ReservedNode -> Rep ReservedNode x
Prelude.Generic)

-- |
-- Create a value of 'ReservedNode' 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:
--
-- 'reservedNodeOfferingType', 'reservedNode_reservedNodeOfferingType' -
--
-- 'state', 'reservedNode_state' - The state of the reserved compute node.
--
-- Possible Values:
--
-- -   pending-payment-This reserved node has recently been purchased, and
--     the sale has been approved, but payment has not yet been confirmed.
--
-- -   active-This reserved node is owned by the caller and is available
--     for use.
--
-- -   payment-failed-Payment failed for the purchase attempt.
--
-- -   retired-The reserved node is no longer available.
--
-- -   exchanging-The owner is exchanging the reserved node for another
--     reserved node.
--
-- 'currencyCode', 'reservedNode_currencyCode' - The currency code for the reserved cluster.
--
-- 'startTime', 'reservedNode_startTime' - The time the reservation started. You purchase a reserved node offering
-- for a duration. This is the start time of that duration.
--
-- 'nodeCount', 'reservedNode_nodeCount' - The number of reserved compute nodes.
--
-- 'reservedNodeId', 'reservedNode_reservedNodeId' - The unique identifier for the reservation.
--
-- 'reservedNodeOfferingId', 'reservedNode_reservedNodeOfferingId' - The identifier for the reserved node offering.
--
-- 'recurringCharges', 'reservedNode_recurringCharges' - The recurring charges for the reserved node.
--
-- 'offeringType', 'reservedNode_offeringType' - The anticipated utilization of the reserved node, as defined in the
-- reserved node offering.
--
-- 'usagePrice', 'reservedNode_usagePrice' - The hourly rate Amazon Redshift charges you for this reserved node.
--
-- 'nodeType', 'reservedNode_nodeType' - The node type of the reserved node.
--
-- 'fixedPrice', 'reservedNode_fixedPrice' - The fixed cost Amazon Redshift charges you for this reserved node.
--
-- 'duration', 'reservedNode_duration' - The duration of the node reservation in seconds.
newReservedNode ::
  ReservedNode
newReservedNode :: ReservedNode
newReservedNode =
  ReservedNode' :: Maybe ReservedNodeOfferingType
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [RecurringCharge]
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> ReservedNode
ReservedNode'
    { $sel:reservedNodeOfferingType:ReservedNode' :: Maybe ReservedNodeOfferingType
reservedNodeOfferingType =
        Maybe ReservedNodeOfferingType
forall a. Maybe a
Prelude.Nothing,
      $sel:state:ReservedNode' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:currencyCode:ReservedNode' :: Maybe Text
currencyCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ReservedNode' :: Maybe ISO8601
startTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeCount:ReservedNode' :: Maybe Int
nodeCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:reservedNodeId:ReservedNode' :: Maybe Text
reservedNodeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reservedNodeOfferingId:ReservedNode' :: Maybe Text
reservedNodeOfferingId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recurringCharges:ReservedNode' :: Maybe [RecurringCharge]
recurringCharges = Maybe [RecurringCharge]
forall a. Maybe a
Prelude.Nothing,
      $sel:offeringType:ReservedNode' :: Maybe Text
offeringType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:usagePrice:ReservedNode' :: Maybe Double
usagePrice = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeType:ReservedNode' :: Maybe Text
nodeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fixedPrice:ReservedNode' :: Maybe Double
fixedPrice = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:duration:ReservedNode' :: Maybe Int
duration = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- |
reservedNode_reservedNodeOfferingType :: Lens.Lens' ReservedNode (Prelude.Maybe ReservedNodeOfferingType)
reservedNode_reservedNodeOfferingType :: (Maybe ReservedNodeOfferingType
 -> f (Maybe ReservedNodeOfferingType))
-> ReservedNode -> f ReservedNode
reservedNode_reservedNodeOfferingType = (ReservedNode -> Maybe ReservedNodeOfferingType)
-> (ReservedNode -> Maybe ReservedNodeOfferingType -> ReservedNode)
-> Lens
     ReservedNode
     ReservedNode
     (Maybe ReservedNodeOfferingType)
     (Maybe ReservedNodeOfferingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe ReservedNodeOfferingType
reservedNodeOfferingType :: Maybe ReservedNodeOfferingType
$sel:reservedNodeOfferingType:ReservedNode' :: ReservedNode -> Maybe ReservedNodeOfferingType
reservedNodeOfferingType} -> Maybe ReservedNodeOfferingType
reservedNodeOfferingType) (\s :: ReservedNode
s@ReservedNode' {} Maybe ReservedNodeOfferingType
a -> ReservedNode
s {$sel:reservedNodeOfferingType:ReservedNode' :: Maybe ReservedNodeOfferingType
reservedNodeOfferingType = Maybe ReservedNodeOfferingType
a} :: ReservedNode)

-- | The state of the reserved compute node.
--
-- Possible Values:
--
-- -   pending-payment-This reserved node has recently been purchased, and
--     the sale has been approved, but payment has not yet been confirmed.
--
-- -   active-This reserved node is owned by the caller and is available
--     for use.
--
-- -   payment-failed-Payment failed for the purchase attempt.
--
-- -   retired-The reserved node is no longer available.
--
-- -   exchanging-The owner is exchanging the reserved node for another
--     reserved node.
reservedNode_state :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Text)
reservedNode_state :: (Maybe Text -> f (Maybe Text)) -> ReservedNode -> f ReservedNode
reservedNode_state = (ReservedNode -> Maybe Text)
-> (ReservedNode -> Maybe Text -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Text
state :: Maybe Text
$sel:state:ReservedNode' :: ReservedNode -> Maybe Text
state} -> Maybe Text
state) (\s :: ReservedNode
s@ReservedNode' {} Maybe Text
a -> ReservedNode
s {$sel:state:ReservedNode' :: Maybe Text
state = Maybe Text
a} :: ReservedNode)

-- | The currency code for the reserved cluster.
reservedNode_currencyCode :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Text)
reservedNode_currencyCode :: (Maybe Text -> f (Maybe Text)) -> ReservedNode -> f ReservedNode
reservedNode_currencyCode = (ReservedNode -> Maybe Text)
-> (ReservedNode -> Maybe Text -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Text
currencyCode :: Maybe Text
$sel:currencyCode:ReservedNode' :: ReservedNode -> Maybe Text
currencyCode} -> Maybe Text
currencyCode) (\s :: ReservedNode
s@ReservedNode' {} Maybe Text
a -> ReservedNode
s {$sel:currencyCode:ReservedNode' :: Maybe Text
currencyCode = Maybe Text
a} :: ReservedNode)

-- | The time the reservation started. You purchase a reserved node offering
-- for a duration. This is the start time of that duration.
reservedNode_startTime :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.UTCTime)
reservedNode_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservedNode -> f ReservedNode
reservedNode_startTime = (ReservedNode -> Maybe ISO8601)
-> (ReservedNode -> Maybe ISO8601 -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe ISO8601
startTime :: Maybe ISO8601
$sel:startTime:ReservedNode' :: ReservedNode -> Maybe ISO8601
startTime} -> Maybe ISO8601
startTime) (\s :: ReservedNode
s@ReservedNode' {} Maybe ISO8601
a -> ReservedNode
s {$sel:startTime:ReservedNode' :: Maybe ISO8601
startTime = Maybe ISO8601
a} :: ReservedNode) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ReservedNode -> f ReservedNode)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservedNode
-> f ReservedNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of reserved compute nodes.
reservedNode_nodeCount :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Int)
reservedNode_nodeCount :: (Maybe Int -> f (Maybe Int)) -> ReservedNode -> f ReservedNode
reservedNode_nodeCount = (ReservedNode -> Maybe Int)
-> (ReservedNode -> Maybe Int -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Int
nodeCount :: Maybe Int
$sel:nodeCount:ReservedNode' :: ReservedNode -> Maybe Int
nodeCount} -> Maybe Int
nodeCount) (\s :: ReservedNode
s@ReservedNode' {} Maybe Int
a -> ReservedNode
s {$sel:nodeCount:ReservedNode' :: Maybe Int
nodeCount = Maybe Int
a} :: ReservedNode)

-- | The unique identifier for the reservation.
reservedNode_reservedNodeId :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Text)
reservedNode_reservedNodeId :: (Maybe Text -> f (Maybe Text)) -> ReservedNode -> f ReservedNode
reservedNode_reservedNodeId = (ReservedNode -> Maybe Text)
-> (ReservedNode -> Maybe Text -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Text
reservedNodeId :: Maybe Text
$sel:reservedNodeId:ReservedNode' :: ReservedNode -> Maybe Text
reservedNodeId} -> Maybe Text
reservedNodeId) (\s :: ReservedNode
s@ReservedNode' {} Maybe Text
a -> ReservedNode
s {$sel:reservedNodeId:ReservedNode' :: Maybe Text
reservedNodeId = Maybe Text
a} :: ReservedNode)

-- | The identifier for the reserved node offering.
reservedNode_reservedNodeOfferingId :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Text)
reservedNode_reservedNodeOfferingId :: (Maybe Text -> f (Maybe Text)) -> ReservedNode -> f ReservedNode
reservedNode_reservedNodeOfferingId = (ReservedNode -> Maybe Text)
-> (ReservedNode -> Maybe Text -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Text
reservedNodeOfferingId :: Maybe Text
$sel:reservedNodeOfferingId:ReservedNode' :: ReservedNode -> Maybe Text
reservedNodeOfferingId} -> Maybe Text
reservedNodeOfferingId) (\s :: ReservedNode
s@ReservedNode' {} Maybe Text
a -> ReservedNode
s {$sel:reservedNodeOfferingId:ReservedNode' :: Maybe Text
reservedNodeOfferingId = Maybe Text
a} :: ReservedNode)

-- | The recurring charges for the reserved node.
reservedNode_recurringCharges :: Lens.Lens' ReservedNode (Prelude.Maybe [RecurringCharge])
reservedNode_recurringCharges :: (Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> ReservedNode -> f ReservedNode
reservedNode_recurringCharges = (ReservedNode -> Maybe [RecurringCharge])
-> (ReservedNode -> Maybe [RecurringCharge] -> ReservedNode)
-> Lens
     ReservedNode
     ReservedNode
     (Maybe [RecurringCharge])
     (Maybe [RecurringCharge])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe [RecurringCharge]
recurringCharges :: Maybe [RecurringCharge]
$sel:recurringCharges:ReservedNode' :: ReservedNode -> Maybe [RecurringCharge]
recurringCharges} -> Maybe [RecurringCharge]
recurringCharges) (\s :: ReservedNode
s@ReservedNode' {} Maybe [RecurringCharge]
a -> ReservedNode
s {$sel:recurringCharges:ReservedNode' :: Maybe [RecurringCharge]
recurringCharges = Maybe [RecurringCharge]
a} :: ReservedNode) ((Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
 -> ReservedNode -> f ReservedNode)
-> ((Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
    -> Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> (Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> ReservedNode
-> f ReservedNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RecurringCharge]
  [RecurringCharge]
  [RecurringCharge]
  [RecurringCharge]
-> Iso
     (Maybe [RecurringCharge])
     (Maybe [RecurringCharge])
     (Maybe [RecurringCharge])
     (Maybe [RecurringCharge])
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
  [RecurringCharge]
  [RecurringCharge]
  [RecurringCharge]
  [RecurringCharge]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The anticipated utilization of the reserved node, as defined in the
-- reserved node offering.
reservedNode_offeringType :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Text)
reservedNode_offeringType :: (Maybe Text -> f (Maybe Text)) -> ReservedNode -> f ReservedNode
reservedNode_offeringType = (ReservedNode -> Maybe Text)
-> (ReservedNode -> Maybe Text -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Text
offeringType :: Maybe Text
$sel:offeringType:ReservedNode' :: ReservedNode -> Maybe Text
offeringType} -> Maybe Text
offeringType) (\s :: ReservedNode
s@ReservedNode' {} Maybe Text
a -> ReservedNode
s {$sel:offeringType:ReservedNode' :: Maybe Text
offeringType = Maybe Text
a} :: ReservedNode)

-- | The hourly rate Amazon Redshift charges you for this reserved node.
reservedNode_usagePrice :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Double)
reservedNode_usagePrice :: (Maybe Double -> f (Maybe Double))
-> ReservedNode -> f ReservedNode
reservedNode_usagePrice = (ReservedNode -> Maybe Double)
-> (ReservedNode -> Maybe Double -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Double
usagePrice :: Maybe Double
$sel:usagePrice:ReservedNode' :: ReservedNode -> Maybe Double
usagePrice} -> Maybe Double
usagePrice) (\s :: ReservedNode
s@ReservedNode' {} Maybe Double
a -> ReservedNode
s {$sel:usagePrice:ReservedNode' :: Maybe Double
usagePrice = Maybe Double
a} :: ReservedNode)

-- | The node type of the reserved node.
reservedNode_nodeType :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Text)
reservedNode_nodeType :: (Maybe Text -> f (Maybe Text)) -> ReservedNode -> f ReservedNode
reservedNode_nodeType = (ReservedNode -> Maybe Text)
-> (ReservedNode -> Maybe Text -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Text
nodeType :: Maybe Text
$sel:nodeType:ReservedNode' :: ReservedNode -> Maybe Text
nodeType} -> Maybe Text
nodeType) (\s :: ReservedNode
s@ReservedNode' {} Maybe Text
a -> ReservedNode
s {$sel:nodeType:ReservedNode' :: Maybe Text
nodeType = Maybe Text
a} :: ReservedNode)

-- | The fixed cost Amazon Redshift charges you for this reserved node.
reservedNode_fixedPrice :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Double)
reservedNode_fixedPrice :: (Maybe Double -> f (Maybe Double))
-> ReservedNode -> f ReservedNode
reservedNode_fixedPrice = (ReservedNode -> Maybe Double)
-> (ReservedNode -> Maybe Double -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Double
fixedPrice :: Maybe Double
$sel:fixedPrice:ReservedNode' :: ReservedNode -> Maybe Double
fixedPrice} -> Maybe Double
fixedPrice) (\s :: ReservedNode
s@ReservedNode' {} Maybe Double
a -> ReservedNode
s {$sel:fixedPrice:ReservedNode' :: Maybe Double
fixedPrice = Maybe Double
a} :: ReservedNode)

-- | The duration of the node reservation in seconds.
reservedNode_duration :: Lens.Lens' ReservedNode (Prelude.Maybe Prelude.Int)
reservedNode_duration :: (Maybe Int -> f (Maybe Int)) -> ReservedNode -> f ReservedNode
reservedNode_duration = (ReservedNode -> Maybe Int)
-> (ReservedNode -> Maybe Int -> ReservedNode)
-> Lens ReservedNode ReservedNode (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedNode' {Maybe Int
duration :: Maybe Int
$sel:duration:ReservedNode' :: ReservedNode -> Maybe Int
duration} -> Maybe Int
duration) (\s :: ReservedNode
s@ReservedNode' {} Maybe Int
a -> ReservedNode
s {$sel:duration:ReservedNode' :: Maybe Int
duration = Maybe Int
a} :: ReservedNode)

instance Core.FromXML ReservedNode where
  parseXML :: [Node] -> Either String ReservedNode
parseXML [Node]
x =
    Maybe ReservedNodeOfferingType
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [RecurringCharge]
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> ReservedNode
ReservedNode'
      (Maybe ReservedNodeOfferingType
 -> Maybe Text
 -> Maybe Text
 -> Maybe ISO8601
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe [RecurringCharge]
 -> Maybe Text
 -> Maybe Double
 -> Maybe Text
 -> Maybe Double
 -> Maybe Int
 -> ReservedNode)
-> Either String (Maybe ReservedNodeOfferingType)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe ISO8601
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReservedNodeOfferingType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReservedNodeOfferingType")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe ISO8601
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe ISO8601
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
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
"State")
      Either
  String
  (Maybe Text
   -> Maybe ISO8601
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
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
"CurrencyCode")
      Either
  String
  (Maybe ISO8601
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StartTime")
      Either
  String
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
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
"NodeCount")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
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
"ReservedNodeId")
      Either
  String
  (Maybe Text
   -> Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [RecurringCharge]
      -> Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
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
"ReservedNodeOfferingId")
      Either
  String
  (Maybe [RecurringCharge]
   -> Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe [RecurringCharge])
-> Either
     String
     (Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> ReservedNode)
forall (f :: * -> *) a b. Applicative f => 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
"RecurringCharges"
                      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 [RecurringCharge]))
-> Either String (Maybe [RecurringCharge])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [RecurringCharge])
-> [Node] -> Either String (Maybe [RecurringCharge])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [RecurringCharge]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"RecurringCharge")
                  )
      Either
  String
  (Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> ReservedNode)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Double
      -> Maybe Text -> Maybe Double -> Maybe Int -> ReservedNode)
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
"OfferingType")
      Either
  String
  (Maybe Double
   -> Maybe Text -> Maybe Double -> Maybe Int -> ReservedNode)
-> Either String (Maybe Double)
-> Either
     String (Maybe Text -> Maybe Double -> Maybe Int -> ReservedNode)
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
"UsagePrice")
      Either
  String (Maybe Text -> Maybe Double -> Maybe Int -> ReservedNode)
-> Either String (Maybe Text)
-> Either String (Maybe Double -> Maybe Int -> ReservedNode)
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 -> Maybe Int -> ReservedNode)
-> Either String (Maybe Double)
-> Either String (Maybe Int -> ReservedNode)
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
"FixedPrice")
      Either String (Maybe Int -> ReservedNode)
-> Either String (Maybe Int) -> Either String ReservedNode
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
"Duration")

instance Prelude.Hashable ReservedNode

instance Prelude.NFData ReservedNode