{-# 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.CostExplorer.Types.ESInstanceDetails
-- 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.CostExplorer.Types.ESInstanceDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about the Amazon ES instances that Amazon Web Services
-- recommends that you purchase.
--
-- /See:/ 'newESInstanceDetails' smart constructor.
data ESInstanceDetails = ESInstanceDetails'
  { -- | Determines whether the recommendation is for a current-generation
    -- instance.
    ESInstanceDetails -> Maybe Bool
currentGeneration :: Prelude.Maybe Prelude.Bool,
    -- | The class of instance that Amazon Web Services recommends.
    ESInstanceDetails -> Maybe Text
instanceClass :: Prelude.Maybe Prelude.Text,
    -- | The size of instance that Amazon Web Services recommends.
    ESInstanceDetails -> Maybe Text
instanceSize :: Prelude.Maybe Prelude.Text,
    -- | Determines whether the recommended reservation is size flexible.
    ESInstanceDetails -> Maybe Bool
sizeFlexEligible :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Web Services Region of the recommended reservation.
    ESInstanceDetails -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (ESInstanceDetails -> ESInstanceDetails -> Bool
(ESInstanceDetails -> ESInstanceDetails -> Bool)
-> (ESInstanceDetails -> ESInstanceDetails -> Bool)
-> Eq ESInstanceDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ESInstanceDetails -> ESInstanceDetails -> Bool
$c/= :: ESInstanceDetails -> ESInstanceDetails -> Bool
== :: ESInstanceDetails -> ESInstanceDetails -> Bool
$c== :: ESInstanceDetails -> ESInstanceDetails -> Bool
Prelude.Eq, ReadPrec [ESInstanceDetails]
ReadPrec ESInstanceDetails
Int -> ReadS ESInstanceDetails
ReadS [ESInstanceDetails]
(Int -> ReadS ESInstanceDetails)
-> ReadS [ESInstanceDetails]
-> ReadPrec ESInstanceDetails
-> ReadPrec [ESInstanceDetails]
-> Read ESInstanceDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ESInstanceDetails]
$creadListPrec :: ReadPrec [ESInstanceDetails]
readPrec :: ReadPrec ESInstanceDetails
$creadPrec :: ReadPrec ESInstanceDetails
readList :: ReadS [ESInstanceDetails]
$creadList :: ReadS [ESInstanceDetails]
readsPrec :: Int -> ReadS ESInstanceDetails
$creadsPrec :: Int -> ReadS ESInstanceDetails
Prelude.Read, Int -> ESInstanceDetails -> ShowS
[ESInstanceDetails] -> ShowS
ESInstanceDetails -> String
(Int -> ESInstanceDetails -> ShowS)
-> (ESInstanceDetails -> String)
-> ([ESInstanceDetails] -> ShowS)
-> Show ESInstanceDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ESInstanceDetails] -> ShowS
$cshowList :: [ESInstanceDetails] -> ShowS
show :: ESInstanceDetails -> String
$cshow :: ESInstanceDetails -> String
showsPrec :: Int -> ESInstanceDetails -> ShowS
$cshowsPrec :: Int -> ESInstanceDetails -> ShowS
Prelude.Show, (forall x. ESInstanceDetails -> Rep ESInstanceDetails x)
-> (forall x. Rep ESInstanceDetails x -> ESInstanceDetails)
-> Generic ESInstanceDetails
forall x. Rep ESInstanceDetails x -> ESInstanceDetails
forall x. ESInstanceDetails -> Rep ESInstanceDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ESInstanceDetails x -> ESInstanceDetails
$cfrom :: forall x. ESInstanceDetails -> Rep ESInstanceDetails x
Prelude.Generic)

-- |
-- Create a value of 'ESInstanceDetails' 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:
--
-- 'currentGeneration', 'eSInstanceDetails_currentGeneration' - Determines whether the recommendation is for a current-generation
-- instance.
--
-- 'instanceClass', 'eSInstanceDetails_instanceClass' - The class of instance that Amazon Web Services recommends.
--
-- 'instanceSize', 'eSInstanceDetails_instanceSize' - The size of instance that Amazon Web Services recommends.
--
-- 'sizeFlexEligible', 'eSInstanceDetails_sizeFlexEligible' - Determines whether the recommended reservation is size flexible.
--
-- 'region', 'eSInstanceDetails_region' - The Amazon Web Services Region of the recommended reservation.
newESInstanceDetails ::
  ESInstanceDetails
newESInstanceDetails :: ESInstanceDetails
newESInstanceDetails =
  ESInstanceDetails' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ESInstanceDetails
ESInstanceDetails'
    { $sel:currentGeneration:ESInstanceDetails' :: Maybe Bool
currentGeneration =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceClass:ESInstanceDetails' :: Maybe Text
instanceClass = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceSize:ESInstanceDetails' :: Maybe Text
instanceSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sizeFlexEligible:ESInstanceDetails' :: Maybe Bool
sizeFlexEligible = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:region:ESInstanceDetails' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Determines whether the recommendation is for a current-generation
-- instance.
eSInstanceDetails_currentGeneration :: Lens.Lens' ESInstanceDetails (Prelude.Maybe Prelude.Bool)
eSInstanceDetails_currentGeneration :: (Maybe Bool -> f (Maybe Bool))
-> ESInstanceDetails -> f ESInstanceDetails
eSInstanceDetails_currentGeneration = (ESInstanceDetails -> Maybe Bool)
-> (ESInstanceDetails -> Maybe Bool -> ESInstanceDetails)
-> Lens
     ESInstanceDetails ESInstanceDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ESInstanceDetails' {Maybe Bool
currentGeneration :: Maybe Bool
$sel:currentGeneration:ESInstanceDetails' :: ESInstanceDetails -> Maybe Bool
currentGeneration} -> Maybe Bool
currentGeneration) (\s :: ESInstanceDetails
s@ESInstanceDetails' {} Maybe Bool
a -> ESInstanceDetails
s {$sel:currentGeneration:ESInstanceDetails' :: Maybe Bool
currentGeneration = Maybe Bool
a} :: ESInstanceDetails)

-- | The class of instance that Amazon Web Services recommends.
eSInstanceDetails_instanceClass :: Lens.Lens' ESInstanceDetails (Prelude.Maybe Prelude.Text)
eSInstanceDetails_instanceClass :: (Maybe Text -> f (Maybe Text))
-> ESInstanceDetails -> f ESInstanceDetails
eSInstanceDetails_instanceClass = (ESInstanceDetails -> Maybe Text)
-> (ESInstanceDetails -> Maybe Text -> ESInstanceDetails)
-> Lens
     ESInstanceDetails ESInstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ESInstanceDetails' {Maybe Text
instanceClass :: Maybe Text
$sel:instanceClass:ESInstanceDetails' :: ESInstanceDetails -> Maybe Text
instanceClass} -> Maybe Text
instanceClass) (\s :: ESInstanceDetails
s@ESInstanceDetails' {} Maybe Text
a -> ESInstanceDetails
s {$sel:instanceClass:ESInstanceDetails' :: Maybe Text
instanceClass = Maybe Text
a} :: ESInstanceDetails)

-- | The size of instance that Amazon Web Services recommends.
eSInstanceDetails_instanceSize :: Lens.Lens' ESInstanceDetails (Prelude.Maybe Prelude.Text)
eSInstanceDetails_instanceSize :: (Maybe Text -> f (Maybe Text))
-> ESInstanceDetails -> f ESInstanceDetails
eSInstanceDetails_instanceSize = (ESInstanceDetails -> Maybe Text)
-> (ESInstanceDetails -> Maybe Text -> ESInstanceDetails)
-> Lens
     ESInstanceDetails ESInstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ESInstanceDetails' {Maybe Text
instanceSize :: Maybe Text
$sel:instanceSize:ESInstanceDetails' :: ESInstanceDetails -> Maybe Text
instanceSize} -> Maybe Text
instanceSize) (\s :: ESInstanceDetails
s@ESInstanceDetails' {} Maybe Text
a -> ESInstanceDetails
s {$sel:instanceSize:ESInstanceDetails' :: Maybe Text
instanceSize = Maybe Text
a} :: ESInstanceDetails)

-- | Determines whether the recommended reservation is size flexible.
eSInstanceDetails_sizeFlexEligible :: Lens.Lens' ESInstanceDetails (Prelude.Maybe Prelude.Bool)
eSInstanceDetails_sizeFlexEligible :: (Maybe Bool -> f (Maybe Bool))
-> ESInstanceDetails -> f ESInstanceDetails
eSInstanceDetails_sizeFlexEligible = (ESInstanceDetails -> Maybe Bool)
-> (ESInstanceDetails -> Maybe Bool -> ESInstanceDetails)
-> Lens
     ESInstanceDetails ESInstanceDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ESInstanceDetails' {Maybe Bool
sizeFlexEligible :: Maybe Bool
$sel:sizeFlexEligible:ESInstanceDetails' :: ESInstanceDetails -> Maybe Bool
sizeFlexEligible} -> Maybe Bool
sizeFlexEligible) (\s :: ESInstanceDetails
s@ESInstanceDetails' {} Maybe Bool
a -> ESInstanceDetails
s {$sel:sizeFlexEligible:ESInstanceDetails' :: Maybe Bool
sizeFlexEligible = Maybe Bool
a} :: ESInstanceDetails)

-- | The Amazon Web Services Region of the recommended reservation.
eSInstanceDetails_region :: Lens.Lens' ESInstanceDetails (Prelude.Maybe Prelude.Text)
eSInstanceDetails_region :: (Maybe Text -> f (Maybe Text))
-> ESInstanceDetails -> f ESInstanceDetails
eSInstanceDetails_region = (ESInstanceDetails -> Maybe Text)
-> (ESInstanceDetails -> Maybe Text -> ESInstanceDetails)
-> Lens
     ESInstanceDetails ESInstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ESInstanceDetails' {Maybe Text
region :: Maybe Text
$sel:region:ESInstanceDetails' :: ESInstanceDetails -> Maybe Text
region} -> Maybe Text
region) (\s :: ESInstanceDetails
s@ESInstanceDetails' {} Maybe Text
a -> ESInstanceDetails
s {$sel:region:ESInstanceDetails' :: Maybe Text
region = Maybe Text
a} :: ESInstanceDetails)

instance Core.FromJSON ESInstanceDetails where
  parseJSON :: Value -> Parser ESInstanceDetails
parseJSON =
    String
-> (Object -> Parser ESInstanceDetails)
-> Value
-> Parser ESInstanceDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ESInstanceDetails"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ESInstanceDetails
ESInstanceDetails'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> ESInstanceDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Maybe Text -> ESInstanceDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentGeneration")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Bool -> Maybe Text -> ESInstanceDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Bool -> Maybe Text -> ESInstanceDetails)
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
"InstanceClass")
            Parser
  (Maybe Text -> Maybe Bool -> Maybe Text -> ESInstanceDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Text -> ESInstanceDetails)
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
"InstanceSize")
            Parser (Maybe Bool -> Maybe Text -> ESInstanceDetails)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> ESInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SizeFlexEligible")
            Parser (Maybe Text -> ESInstanceDetails)
-> Parser (Maybe Text) -> Parser ESInstanceDetails
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
"Region")
      )

instance Prelude.Hashable ESInstanceDetails

instance Prelude.NFData ESInstanceDetails