{-# 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.OpenSearch.Types.ReservedInstance
-- 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.OpenSearch.Types.ReservedInstance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.OpenSearchPartitionInstanceType
import Amazonka.OpenSearch.Types.RecurringCharge
import Amazonka.OpenSearch.Types.ReservedInstancePaymentOption
import qualified Amazonka.Prelude as Prelude

-- | Details of a reserved OpenSearch instance.
--
-- /See:/ 'newReservedInstance' smart constructor.
data ReservedInstance = ReservedInstance'
  { -- | The state of the reserved OpenSearch instance.
    ReservedInstance -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The currency code for the reserved OpenSearch instance offering.
    ReservedInstance -> Maybe Text
currencyCode :: Prelude.Maybe Prelude.Text,
    -- | The number of OpenSearch instances that have been reserved.
    ReservedInstance -> Maybe Int
instanceCount :: Prelude.Maybe Prelude.Int,
    -- | The time the reservation started.
    ReservedInstance -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The OpenSearch instance type offered by the reserved instance offering.
    ReservedInstance -> Maybe OpenSearchPartitionInstanceType
instanceType :: Prelude.Maybe OpenSearchPartitionInstanceType,
    -- | The customer-specified identifier to track this reservation.
    ReservedInstance -> Maybe Text
reservationName :: Prelude.Maybe Prelude.Text,
    ReservedInstance -> Maybe Integer
billingSubscriptionId :: Prelude.Maybe Prelude.Integer,
    -- | The charge to your account regardless of whether you are creating any
    -- domains using the instance offering.
    ReservedInstance -> Maybe [RecurringCharge]
recurringCharges :: Prelude.Maybe [RecurringCharge],
    -- | The rate you are charged for each hour for the domain that is using this
    -- reserved instance.
    ReservedInstance -> Maybe Double
usagePrice :: Prelude.Maybe Prelude.Double,
    -- | The unique identifier for the reservation.
    ReservedInstance -> Maybe Text
reservedInstanceId :: Prelude.Maybe Prelude.Text,
    -- | The offering identifier.
    ReservedInstance -> Maybe Text
reservedInstanceOfferingId :: Prelude.Maybe Prelude.Text,
    -- | The upfront fixed charge you will paid to purchase the specific reserved
    -- OpenSearch instance offering.
    ReservedInstance -> Maybe Double
fixedPrice :: Prelude.Maybe Prelude.Double,
    -- | The duration, in seconds, for which the OpenSearch instance is reserved.
    ReservedInstance -> Maybe Int
duration :: Prelude.Maybe Prelude.Int,
    -- | The payment option as defined in the reserved OpenSearch instance
    -- offering.
    ReservedInstance -> Maybe ReservedInstancePaymentOption
paymentOption :: Prelude.Maybe ReservedInstancePaymentOption
  }
  deriving (ReservedInstance -> ReservedInstance -> Bool
(ReservedInstance -> ReservedInstance -> Bool)
-> (ReservedInstance -> ReservedInstance -> Bool)
-> Eq ReservedInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReservedInstance -> ReservedInstance -> Bool
$c/= :: ReservedInstance -> ReservedInstance -> Bool
== :: ReservedInstance -> ReservedInstance -> Bool
$c== :: ReservedInstance -> ReservedInstance -> Bool
Prelude.Eq, ReadPrec [ReservedInstance]
ReadPrec ReservedInstance
Int -> ReadS ReservedInstance
ReadS [ReservedInstance]
(Int -> ReadS ReservedInstance)
-> ReadS [ReservedInstance]
-> ReadPrec ReservedInstance
-> ReadPrec [ReservedInstance]
-> Read ReservedInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReservedInstance]
$creadListPrec :: ReadPrec [ReservedInstance]
readPrec :: ReadPrec ReservedInstance
$creadPrec :: ReadPrec ReservedInstance
readList :: ReadS [ReservedInstance]
$creadList :: ReadS [ReservedInstance]
readsPrec :: Int -> ReadS ReservedInstance
$creadsPrec :: Int -> ReadS ReservedInstance
Prelude.Read, Int -> ReservedInstance -> ShowS
[ReservedInstance] -> ShowS
ReservedInstance -> String
(Int -> ReservedInstance -> ShowS)
-> (ReservedInstance -> String)
-> ([ReservedInstance] -> ShowS)
-> Show ReservedInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReservedInstance] -> ShowS
$cshowList :: [ReservedInstance] -> ShowS
show :: ReservedInstance -> String
$cshow :: ReservedInstance -> String
showsPrec :: Int -> ReservedInstance -> ShowS
$cshowsPrec :: Int -> ReservedInstance -> ShowS
Prelude.Show, (forall x. ReservedInstance -> Rep ReservedInstance x)
-> (forall x. Rep ReservedInstance x -> ReservedInstance)
-> Generic ReservedInstance
forall x. Rep ReservedInstance x -> ReservedInstance
forall x. ReservedInstance -> Rep ReservedInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReservedInstance x -> ReservedInstance
$cfrom :: forall x. ReservedInstance -> Rep ReservedInstance x
Prelude.Generic)

-- |
-- Create a value of 'ReservedInstance' 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:
--
-- 'state', 'reservedInstance_state' - The state of the reserved OpenSearch instance.
--
-- 'currencyCode', 'reservedInstance_currencyCode' - The currency code for the reserved OpenSearch instance offering.
--
-- 'instanceCount', 'reservedInstance_instanceCount' - The number of OpenSearch instances that have been reserved.
--
-- 'startTime', 'reservedInstance_startTime' - The time the reservation started.
--
-- 'instanceType', 'reservedInstance_instanceType' - The OpenSearch instance type offered by the reserved instance offering.
--
-- 'reservationName', 'reservedInstance_reservationName' - The customer-specified identifier to track this reservation.
--
-- 'billingSubscriptionId', 'reservedInstance_billingSubscriptionId' - Undocumented member.
--
-- 'recurringCharges', 'reservedInstance_recurringCharges' - The charge to your account regardless of whether you are creating any
-- domains using the instance offering.
--
-- 'usagePrice', 'reservedInstance_usagePrice' - The rate you are charged for each hour for the domain that is using this
-- reserved instance.
--
-- 'reservedInstanceId', 'reservedInstance_reservedInstanceId' - The unique identifier for the reservation.
--
-- 'reservedInstanceOfferingId', 'reservedInstance_reservedInstanceOfferingId' - The offering identifier.
--
-- 'fixedPrice', 'reservedInstance_fixedPrice' - The upfront fixed charge you will paid to purchase the specific reserved
-- OpenSearch instance offering.
--
-- 'duration', 'reservedInstance_duration' - The duration, in seconds, for which the OpenSearch instance is reserved.
--
-- 'paymentOption', 'reservedInstance_paymentOption' - The payment option as defined in the reserved OpenSearch instance
-- offering.
newReservedInstance ::
  ReservedInstance
newReservedInstance :: ReservedInstance
newReservedInstance =
  ReservedInstance' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe POSIX
-> Maybe OpenSearchPartitionInstanceType
-> Maybe Text
-> Maybe Integer
-> Maybe [RecurringCharge]
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe ReservedInstancePaymentOption
-> ReservedInstance
ReservedInstance'
    { $sel:state:ReservedInstance' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:currencyCode:ReservedInstance' :: Maybe Text
currencyCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceCount:ReservedInstance' :: Maybe Int
instanceCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ReservedInstance' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:ReservedInstance' :: Maybe OpenSearchPartitionInstanceType
instanceType = Maybe OpenSearchPartitionInstanceType
forall a. Maybe a
Prelude.Nothing,
      $sel:reservationName:ReservedInstance' :: Maybe Text
reservationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:billingSubscriptionId:ReservedInstance' :: Maybe Integer
billingSubscriptionId = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:recurringCharges:ReservedInstance' :: Maybe [RecurringCharge]
recurringCharges = Maybe [RecurringCharge]
forall a. Maybe a
Prelude.Nothing,
      $sel:usagePrice:ReservedInstance' :: Maybe Double
usagePrice = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:reservedInstanceId:ReservedInstance' :: Maybe Text
reservedInstanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reservedInstanceOfferingId:ReservedInstance' :: Maybe Text
reservedInstanceOfferingId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fixedPrice:ReservedInstance' :: Maybe Double
fixedPrice = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:duration:ReservedInstance' :: Maybe Int
duration = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:paymentOption:ReservedInstance' :: Maybe ReservedInstancePaymentOption
paymentOption = Maybe ReservedInstancePaymentOption
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the reserved OpenSearch instance.
reservedInstance_state :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Text)
reservedInstance_state :: (Maybe Text -> f (Maybe Text))
-> ReservedInstance -> f ReservedInstance
reservedInstance_state = (ReservedInstance -> Maybe Text)
-> (ReservedInstance -> Maybe Text -> ReservedInstance)
-> Lens ReservedInstance ReservedInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Text
state :: Maybe Text
$sel:state:ReservedInstance' :: ReservedInstance -> Maybe Text
state} -> Maybe Text
state) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Text
a -> ReservedInstance
s {$sel:state:ReservedInstance' :: Maybe Text
state = Maybe Text
a} :: ReservedInstance)

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

-- | The number of OpenSearch instances that have been reserved.
reservedInstance_instanceCount :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Int)
reservedInstance_instanceCount :: (Maybe Int -> f (Maybe Int))
-> ReservedInstance -> f ReservedInstance
reservedInstance_instanceCount = (ReservedInstance -> Maybe Int)
-> (ReservedInstance -> Maybe Int -> ReservedInstance)
-> Lens ReservedInstance ReservedInstance (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Int
instanceCount :: Maybe Int
$sel:instanceCount:ReservedInstance' :: ReservedInstance -> Maybe Int
instanceCount} -> Maybe Int
instanceCount) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Int
a -> ReservedInstance
s {$sel:instanceCount:ReservedInstance' :: Maybe Int
instanceCount = Maybe Int
a} :: ReservedInstance)

-- | The time the reservation started.
reservedInstance_startTime :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.UTCTime)
reservedInstance_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservedInstance -> f ReservedInstance
reservedInstance_startTime = (ReservedInstance -> Maybe POSIX)
-> (ReservedInstance -> Maybe POSIX -> ReservedInstance)
-> Lens
     ReservedInstance ReservedInstance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ReservedInstance' :: ReservedInstance -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe POSIX
a -> ReservedInstance
s {$sel:startTime:ReservedInstance' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ReservedInstance) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReservedInstance -> f ReservedInstance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservedInstance
-> f ReservedInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The OpenSearch instance type offered by the reserved instance offering.
reservedInstance_instanceType :: Lens.Lens' ReservedInstance (Prelude.Maybe OpenSearchPartitionInstanceType)
reservedInstance_instanceType :: (Maybe OpenSearchPartitionInstanceType
 -> f (Maybe OpenSearchPartitionInstanceType))
-> ReservedInstance -> f ReservedInstance
reservedInstance_instanceType = (ReservedInstance -> Maybe OpenSearchPartitionInstanceType)
-> (ReservedInstance
    -> Maybe OpenSearchPartitionInstanceType -> ReservedInstance)
-> Lens
     ReservedInstance
     ReservedInstance
     (Maybe OpenSearchPartitionInstanceType)
     (Maybe OpenSearchPartitionInstanceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe OpenSearchPartitionInstanceType
instanceType :: Maybe OpenSearchPartitionInstanceType
$sel:instanceType:ReservedInstance' :: ReservedInstance -> Maybe OpenSearchPartitionInstanceType
instanceType} -> Maybe OpenSearchPartitionInstanceType
instanceType) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe OpenSearchPartitionInstanceType
a -> ReservedInstance
s {$sel:instanceType:ReservedInstance' :: Maybe OpenSearchPartitionInstanceType
instanceType = Maybe OpenSearchPartitionInstanceType
a} :: ReservedInstance)

-- | The customer-specified identifier to track this reservation.
reservedInstance_reservationName :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Text)
reservedInstance_reservationName :: (Maybe Text -> f (Maybe Text))
-> ReservedInstance -> f ReservedInstance
reservedInstance_reservationName = (ReservedInstance -> Maybe Text)
-> (ReservedInstance -> Maybe Text -> ReservedInstance)
-> Lens ReservedInstance ReservedInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Text
reservationName :: Maybe Text
$sel:reservationName:ReservedInstance' :: ReservedInstance -> Maybe Text
reservationName} -> Maybe Text
reservationName) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Text
a -> ReservedInstance
s {$sel:reservationName:ReservedInstance' :: Maybe Text
reservationName = Maybe Text
a} :: ReservedInstance)

-- | Undocumented member.
reservedInstance_billingSubscriptionId :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Integer)
reservedInstance_billingSubscriptionId :: (Maybe Integer -> f (Maybe Integer))
-> ReservedInstance -> f ReservedInstance
reservedInstance_billingSubscriptionId = (ReservedInstance -> Maybe Integer)
-> (ReservedInstance -> Maybe Integer -> ReservedInstance)
-> Lens
     ReservedInstance ReservedInstance (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Integer
billingSubscriptionId :: Maybe Integer
$sel:billingSubscriptionId:ReservedInstance' :: ReservedInstance -> Maybe Integer
billingSubscriptionId} -> Maybe Integer
billingSubscriptionId) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Integer
a -> ReservedInstance
s {$sel:billingSubscriptionId:ReservedInstance' :: Maybe Integer
billingSubscriptionId = Maybe Integer
a} :: ReservedInstance)

-- | The charge to your account regardless of whether you are creating any
-- domains using the instance offering.
reservedInstance_recurringCharges :: Lens.Lens' ReservedInstance (Prelude.Maybe [RecurringCharge])
reservedInstance_recurringCharges :: (Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> ReservedInstance -> f ReservedInstance
reservedInstance_recurringCharges = (ReservedInstance -> Maybe [RecurringCharge])
-> (ReservedInstance
    -> Maybe [RecurringCharge] -> ReservedInstance)
-> Lens
     ReservedInstance
     ReservedInstance
     (Maybe [RecurringCharge])
     (Maybe [RecurringCharge])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe [RecurringCharge]
recurringCharges :: Maybe [RecurringCharge]
$sel:recurringCharges:ReservedInstance' :: ReservedInstance -> Maybe [RecurringCharge]
recurringCharges} -> Maybe [RecurringCharge]
recurringCharges) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe [RecurringCharge]
a -> ReservedInstance
s {$sel:recurringCharges:ReservedInstance' :: Maybe [RecurringCharge]
recurringCharges = Maybe [RecurringCharge]
a} :: ReservedInstance) ((Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
 -> ReservedInstance -> f ReservedInstance)
-> ((Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
    -> Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> (Maybe [RecurringCharge] -> f (Maybe [RecurringCharge]))
-> ReservedInstance
-> f ReservedInstance
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 rate you are charged for each hour for the domain that is using this
-- reserved instance.
reservedInstance_usagePrice :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Double)
reservedInstance_usagePrice :: (Maybe Double -> f (Maybe Double))
-> ReservedInstance -> f ReservedInstance
reservedInstance_usagePrice = (ReservedInstance -> Maybe Double)
-> (ReservedInstance -> Maybe Double -> ReservedInstance)
-> Lens
     ReservedInstance ReservedInstance (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Double
usagePrice :: Maybe Double
$sel:usagePrice:ReservedInstance' :: ReservedInstance -> Maybe Double
usagePrice} -> Maybe Double
usagePrice) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Double
a -> ReservedInstance
s {$sel:usagePrice:ReservedInstance' :: Maybe Double
usagePrice = Maybe Double
a} :: ReservedInstance)

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

-- | The offering identifier.
reservedInstance_reservedInstanceOfferingId :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Text)
reservedInstance_reservedInstanceOfferingId :: (Maybe Text -> f (Maybe Text))
-> ReservedInstance -> f ReservedInstance
reservedInstance_reservedInstanceOfferingId = (ReservedInstance -> Maybe Text)
-> (ReservedInstance -> Maybe Text -> ReservedInstance)
-> Lens ReservedInstance ReservedInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Text
reservedInstanceOfferingId :: Maybe Text
$sel:reservedInstanceOfferingId:ReservedInstance' :: ReservedInstance -> Maybe Text
reservedInstanceOfferingId} -> Maybe Text
reservedInstanceOfferingId) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Text
a -> ReservedInstance
s {$sel:reservedInstanceOfferingId:ReservedInstance' :: Maybe Text
reservedInstanceOfferingId = Maybe Text
a} :: ReservedInstance)

-- | The upfront fixed charge you will paid to purchase the specific reserved
-- OpenSearch instance offering.
reservedInstance_fixedPrice :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Double)
reservedInstance_fixedPrice :: (Maybe Double -> f (Maybe Double))
-> ReservedInstance -> f ReservedInstance
reservedInstance_fixedPrice = (ReservedInstance -> Maybe Double)
-> (ReservedInstance -> Maybe Double -> ReservedInstance)
-> Lens
     ReservedInstance ReservedInstance (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Double
fixedPrice :: Maybe Double
$sel:fixedPrice:ReservedInstance' :: ReservedInstance -> Maybe Double
fixedPrice} -> Maybe Double
fixedPrice) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Double
a -> ReservedInstance
s {$sel:fixedPrice:ReservedInstance' :: Maybe Double
fixedPrice = Maybe Double
a} :: ReservedInstance)

-- | The duration, in seconds, for which the OpenSearch instance is reserved.
reservedInstance_duration :: Lens.Lens' ReservedInstance (Prelude.Maybe Prelude.Int)
reservedInstance_duration :: (Maybe Int -> f (Maybe Int))
-> ReservedInstance -> f ReservedInstance
reservedInstance_duration = (ReservedInstance -> Maybe Int)
-> (ReservedInstance -> Maybe Int -> ReservedInstance)
-> Lens ReservedInstance ReservedInstance (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe Int
duration :: Maybe Int
$sel:duration:ReservedInstance' :: ReservedInstance -> Maybe Int
duration} -> Maybe Int
duration) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe Int
a -> ReservedInstance
s {$sel:duration:ReservedInstance' :: Maybe Int
duration = Maybe Int
a} :: ReservedInstance)

-- | The payment option as defined in the reserved OpenSearch instance
-- offering.
reservedInstance_paymentOption :: Lens.Lens' ReservedInstance (Prelude.Maybe ReservedInstancePaymentOption)
reservedInstance_paymentOption :: (Maybe ReservedInstancePaymentOption
 -> f (Maybe ReservedInstancePaymentOption))
-> ReservedInstance -> f ReservedInstance
reservedInstance_paymentOption = (ReservedInstance -> Maybe ReservedInstancePaymentOption)
-> (ReservedInstance
    -> Maybe ReservedInstancePaymentOption -> ReservedInstance)
-> Lens
     ReservedInstance
     ReservedInstance
     (Maybe ReservedInstancePaymentOption)
     (Maybe ReservedInstancePaymentOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservedInstance' {Maybe ReservedInstancePaymentOption
paymentOption :: Maybe ReservedInstancePaymentOption
$sel:paymentOption:ReservedInstance' :: ReservedInstance -> Maybe ReservedInstancePaymentOption
paymentOption} -> Maybe ReservedInstancePaymentOption
paymentOption) (\s :: ReservedInstance
s@ReservedInstance' {} Maybe ReservedInstancePaymentOption
a -> ReservedInstance
s {$sel:paymentOption:ReservedInstance' :: Maybe ReservedInstancePaymentOption
paymentOption = Maybe ReservedInstancePaymentOption
a} :: ReservedInstance)

instance Core.FromJSON ReservedInstance where
  parseJSON :: Value -> Parser ReservedInstance
parseJSON =
    String
-> (Object -> Parser ReservedInstance)
-> Value
-> Parser ReservedInstance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReservedInstance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe POSIX
-> Maybe OpenSearchPartitionInstanceType
-> Maybe Text
-> Maybe Integer
-> Maybe [RecurringCharge]
-> Maybe Double
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe ReservedInstancePaymentOption
-> ReservedInstance
ReservedInstance'
            (Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe POSIX
 -> Maybe OpenSearchPartitionInstanceType
 -> Maybe Text
 -> Maybe Integer
 -> Maybe [RecurringCharge]
 -> Maybe Double
 -> Maybe Text
 -> Maybe Text
 -> Maybe Double
 -> Maybe Int
 -> Maybe ReservedInstancePaymentOption
 -> ReservedInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe POSIX
      -> Maybe OpenSearchPartitionInstanceType
      -> Maybe Text
      -> Maybe Integer
      -> Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe POSIX
   -> Maybe OpenSearchPartitionInstanceType
   -> Maybe Text
   -> Maybe Integer
   -> Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe POSIX
      -> Maybe OpenSearchPartitionInstanceType
      -> Maybe Text
      -> Maybe Integer
      -> Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrencyCode")
            Parser
  (Maybe Int
   -> Maybe POSIX
   -> Maybe OpenSearchPartitionInstanceType
   -> Maybe Text
   -> Maybe Integer
   -> Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Int)
-> Parser
     (Maybe POSIX
      -> Maybe OpenSearchPartitionInstanceType
      -> Maybe Text
      -> Maybe Integer
      -> Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstanceCount")
            Parser
  (Maybe POSIX
   -> Maybe OpenSearchPartitionInstanceType
   -> Maybe Text
   -> Maybe Integer
   -> Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe OpenSearchPartitionInstanceType
      -> Maybe Text
      -> Maybe Integer
      -> Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe OpenSearchPartitionInstanceType
   -> Maybe Text
   -> Maybe Integer
   -> Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe OpenSearchPartitionInstanceType)
-> Parser
     (Maybe Text
      -> Maybe Integer
      -> Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OpenSearchPartitionInstanceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstanceType")
            Parser
  (Maybe Text
   -> Maybe Integer
   -> Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer
      -> Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReservationName")
            Parser
  (Maybe Integer
   -> Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Integer)
-> Parser
     (Maybe [RecurringCharge]
      -> Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BillingSubscriptionId")
            Parser
  (Maybe [RecurringCharge]
   -> Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe [RecurringCharge])
-> Parser
     (Maybe Double
      -> Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [RecurringCharge]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RecurringCharges"
                            Parser (Maybe (Maybe [RecurringCharge]))
-> Maybe [RecurringCharge] -> Parser (Maybe [RecurringCharge])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RecurringCharge]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Double
   -> Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Double)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UsagePrice")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReservedInstanceId")
            Parser
  (Maybe Text
   -> Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Maybe Int
      -> Maybe ReservedInstancePaymentOption
      -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReservedInstanceOfferingId")
            Parser
  (Maybe Double
   -> Maybe Int
   -> Maybe ReservedInstancePaymentOption
   -> ReservedInstance)
-> Parser (Maybe Double)
-> Parser
     (Maybe Int
      -> Maybe ReservedInstancePaymentOption -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FixedPrice")
            Parser
  (Maybe Int
   -> Maybe ReservedInstancePaymentOption -> ReservedInstance)
-> Parser (Maybe Int)
-> Parser (Maybe ReservedInstancePaymentOption -> ReservedInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Duration")
            Parser (Maybe ReservedInstancePaymentOption -> ReservedInstance)
-> Parser (Maybe ReservedInstancePaymentOption)
-> Parser ReservedInstance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReservedInstancePaymentOption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PaymentOption")
      )

instance Prelude.Hashable ReservedInstance

instance Prelude.NFData ReservedInstance