{-# 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.EC2.Types.TargetConfiguration
-- 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.EC2.Types.TargetConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Information about the Convertible Reserved Instance offering.
--
-- /See:/ 'newTargetConfiguration' smart constructor.
data TargetConfiguration = TargetConfiguration'
  { -- | The number of instances the Convertible Reserved Instance offering can
    -- be applied to. This parameter is reserved and cannot be specified in a
    -- request
    TargetConfiguration -> Maybe Int
instanceCount :: Prelude.Maybe Prelude.Int,
    -- | The ID of the Convertible Reserved Instance offering.
    TargetConfiguration -> Maybe Text
offeringId :: Prelude.Maybe Prelude.Text
  }
  deriving (TargetConfiguration -> TargetConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetConfiguration -> TargetConfiguration -> Bool
$c/= :: TargetConfiguration -> TargetConfiguration -> Bool
== :: TargetConfiguration -> TargetConfiguration -> Bool
$c== :: TargetConfiguration -> TargetConfiguration -> Bool
Prelude.Eq, ReadPrec [TargetConfiguration]
ReadPrec TargetConfiguration
Int -> ReadS TargetConfiguration
ReadS [TargetConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TargetConfiguration]
$creadListPrec :: ReadPrec [TargetConfiguration]
readPrec :: ReadPrec TargetConfiguration
$creadPrec :: ReadPrec TargetConfiguration
readList :: ReadS [TargetConfiguration]
$creadList :: ReadS [TargetConfiguration]
readsPrec :: Int -> ReadS TargetConfiguration
$creadsPrec :: Int -> ReadS TargetConfiguration
Prelude.Read, Int -> TargetConfiguration -> ShowS
[TargetConfiguration] -> ShowS
TargetConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetConfiguration] -> ShowS
$cshowList :: [TargetConfiguration] -> ShowS
show :: TargetConfiguration -> String
$cshow :: TargetConfiguration -> String
showsPrec :: Int -> TargetConfiguration -> ShowS
$cshowsPrec :: Int -> TargetConfiguration -> ShowS
Prelude.Show, forall x. Rep TargetConfiguration x -> TargetConfiguration
forall x. TargetConfiguration -> Rep TargetConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TargetConfiguration x -> TargetConfiguration
$cfrom :: forall x. TargetConfiguration -> Rep TargetConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TargetConfiguration' 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:
--
-- 'instanceCount', 'targetConfiguration_instanceCount' - The number of instances the Convertible Reserved Instance offering can
-- be applied to. This parameter is reserved and cannot be specified in a
-- request
--
-- 'offeringId', 'targetConfiguration_offeringId' - The ID of the Convertible Reserved Instance offering.
newTargetConfiguration ::
  TargetConfiguration
newTargetConfiguration :: TargetConfiguration
newTargetConfiguration =
  TargetConfiguration'
    { $sel:instanceCount:TargetConfiguration' :: Maybe Int
instanceCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:offeringId:TargetConfiguration' :: Maybe Text
offeringId = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of instances the Convertible Reserved Instance offering can
-- be applied to. This parameter is reserved and cannot be specified in a
-- request
targetConfiguration_instanceCount :: Lens.Lens' TargetConfiguration (Prelude.Maybe Prelude.Int)
targetConfiguration_instanceCount :: Lens' TargetConfiguration (Maybe Int)
targetConfiguration_instanceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetConfiguration' {Maybe Int
instanceCount :: Maybe Int
$sel:instanceCount:TargetConfiguration' :: TargetConfiguration -> Maybe Int
instanceCount} -> Maybe Int
instanceCount) (\s :: TargetConfiguration
s@TargetConfiguration' {} Maybe Int
a -> TargetConfiguration
s {$sel:instanceCount:TargetConfiguration' :: Maybe Int
instanceCount = Maybe Int
a} :: TargetConfiguration)

-- | The ID of the Convertible Reserved Instance offering.
targetConfiguration_offeringId :: Lens.Lens' TargetConfiguration (Prelude.Maybe Prelude.Text)
targetConfiguration_offeringId :: Lens' TargetConfiguration (Maybe Text)
targetConfiguration_offeringId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetConfiguration' {Maybe Text
offeringId :: Maybe Text
$sel:offeringId:TargetConfiguration' :: TargetConfiguration -> Maybe Text
offeringId} -> Maybe Text
offeringId) (\s :: TargetConfiguration
s@TargetConfiguration' {} Maybe Text
a -> TargetConfiguration
s {$sel:offeringId:TargetConfiguration' :: Maybe Text
offeringId = Maybe Text
a} :: TargetConfiguration)

instance Data.FromXML TargetConfiguration where
  parseXML :: [Node] -> Either String TargetConfiguration
parseXML [Node]
x =
    Maybe Int -> Maybe Text -> TargetConfiguration
TargetConfiguration'
      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
"instanceCount")
      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
"offeringId")

instance Prelude.Hashable TargetConfiguration where
  hashWithSalt :: Int -> TargetConfiguration -> Int
hashWithSalt Int
_salt TargetConfiguration' {Maybe Int
Maybe Text
offeringId :: Maybe Text
instanceCount :: Maybe Int
$sel:offeringId:TargetConfiguration' :: TargetConfiguration -> Maybe Text
$sel:instanceCount:TargetConfiguration' :: TargetConfiguration -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
instanceCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
offeringId

instance Prelude.NFData TargetConfiguration where
  rnf :: TargetConfiguration -> ()
rnf TargetConfiguration' {Maybe Int
Maybe Text
offeringId :: Maybe Text
instanceCount :: Maybe Int
$sel:offeringId:TargetConfiguration' :: TargetConfiguration -> Maybe Text
$sel:instanceCount:TargetConfiguration' :: TargetConfiguration -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
instanceCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
offeringId