{-# 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.EC2InstanceDetails
-- 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.EC2InstanceDetails where

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

-- | Details about the Amazon EC2 instances that Amazon Web Services
-- recommends that you purchase.
--
-- /See:/ 'newEC2InstanceDetails' smart constructor.
data EC2InstanceDetails = EC2InstanceDetails'
  { -- | Determines whether the recommendation is for a current-generation
    -- instance.
    EC2InstanceDetails -> Maybe Bool
currentGeneration :: Prelude.Maybe Prelude.Bool,
    -- | The platform of the recommended reservation. The platform is the
    -- specific combination of operating system, license model, and software on
    -- an instance.
    EC2InstanceDetails -> Maybe Text
platform :: Prelude.Maybe Prelude.Text,
    -- | The instance family of the recommended reservation.
    EC2InstanceDetails -> Maybe Text
family :: Prelude.Maybe Prelude.Text,
    -- | The type of instance that Amazon Web Services recommends.
    EC2InstanceDetails -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The Availability Zone of the recommended reservation.
    EC2InstanceDetails -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | Determines whether the recommended reservation is size flexible.
    EC2InstanceDetails -> Maybe Bool
sizeFlexEligible :: Prelude.Maybe Prelude.Bool,
    -- | Determines whether the recommended reservation is dedicated or shared.
    EC2InstanceDetails -> Maybe Text
tenancy :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region of the recommended reservation.
    EC2InstanceDetails -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (EC2InstanceDetails -> EC2InstanceDetails -> Bool
(EC2InstanceDetails -> EC2InstanceDetails -> Bool)
-> (EC2InstanceDetails -> EC2InstanceDetails -> Bool)
-> Eq EC2InstanceDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2InstanceDetails -> EC2InstanceDetails -> Bool
$c/= :: EC2InstanceDetails -> EC2InstanceDetails -> Bool
== :: EC2InstanceDetails -> EC2InstanceDetails -> Bool
$c== :: EC2InstanceDetails -> EC2InstanceDetails -> Bool
Prelude.Eq, ReadPrec [EC2InstanceDetails]
ReadPrec EC2InstanceDetails
Int -> ReadS EC2InstanceDetails
ReadS [EC2InstanceDetails]
(Int -> ReadS EC2InstanceDetails)
-> ReadS [EC2InstanceDetails]
-> ReadPrec EC2InstanceDetails
-> ReadPrec [EC2InstanceDetails]
-> Read EC2InstanceDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2InstanceDetails]
$creadListPrec :: ReadPrec [EC2InstanceDetails]
readPrec :: ReadPrec EC2InstanceDetails
$creadPrec :: ReadPrec EC2InstanceDetails
readList :: ReadS [EC2InstanceDetails]
$creadList :: ReadS [EC2InstanceDetails]
readsPrec :: Int -> ReadS EC2InstanceDetails
$creadsPrec :: Int -> ReadS EC2InstanceDetails
Prelude.Read, Int -> EC2InstanceDetails -> ShowS
[EC2InstanceDetails] -> ShowS
EC2InstanceDetails -> String
(Int -> EC2InstanceDetails -> ShowS)
-> (EC2InstanceDetails -> String)
-> ([EC2InstanceDetails] -> ShowS)
-> Show EC2InstanceDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2InstanceDetails] -> ShowS
$cshowList :: [EC2InstanceDetails] -> ShowS
show :: EC2InstanceDetails -> String
$cshow :: EC2InstanceDetails -> String
showsPrec :: Int -> EC2InstanceDetails -> ShowS
$cshowsPrec :: Int -> EC2InstanceDetails -> ShowS
Prelude.Show, (forall x. EC2InstanceDetails -> Rep EC2InstanceDetails x)
-> (forall x. Rep EC2InstanceDetails x -> EC2InstanceDetails)
-> Generic EC2InstanceDetails
forall x. Rep EC2InstanceDetails x -> EC2InstanceDetails
forall x. EC2InstanceDetails -> Rep EC2InstanceDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EC2InstanceDetails x -> EC2InstanceDetails
$cfrom :: forall x. EC2InstanceDetails -> Rep EC2InstanceDetails x
Prelude.Generic)

-- |
-- Create a value of 'EC2InstanceDetails' 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', 'eC2InstanceDetails_currentGeneration' - Determines whether the recommendation is for a current-generation
-- instance.
--
-- 'platform', 'eC2InstanceDetails_platform' - The platform of the recommended reservation. The platform is the
-- specific combination of operating system, license model, and software on
-- an instance.
--
-- 'family', 'eC2InstanceDetails_family' - The instance family of the recommended reservation.
--
-- 'instanceType', 'eC2InstanceDetails_instanceType' - The type of instance that Amazon Web Services recommends.
--
-- 'availabilityZone', 'eC2InstanceDetails_availabilityZone' - The Availability Zone of the recommended reservation.
--
-- 'sizeFlexEligible', 'eC2InstanceDetails_sizeFlexEligible' - Determines whether the recommended reservation is size flexible.
--
-- 'tenancy', 'eC2InstanceDetails_tenancy' - Determines whether the recommended reservation is dedicated or shared.
--
-- 'region', 'eC2InstanceDetails_region' - The Amazon Web Services Region of the recommended reservation.
newEC2InstanceDetails ::
  EC2InstanceDetails
newEC2InstanceDetails :: EC2InstanceDetails
newEC2InstanceDetails =
  EC2InstanceDetails' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> EC2InstanceDetails
EC2InstanceDetails'
    { $sel:currentGeneration:EC2InstanceDetails' :: Maybe Bool
currentGeneration =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:platform:EC2InstanceDetails' :: Maybe Text
platform = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:family:EC2InstanceDetails' :: Maybe Text
family = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:EC2InstanceDetails' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:availabilityZone:EC2InstanceDetails' :: Maybe Text
availabilityZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sizeFlexEligible:EC2InstanceDetails' :: Maybe Bool
sizeFlexEligible = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:tenancy:EC2InstanceDetails' :: Maybe Text
tenancy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:EC2InstanceDetails' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The platform of the recommended reservation. The platform is the
-- specific combination of operating system, license model, and software on
-- an instance.
eC2InstanceDetails_platform :: Lens.Lens' EC2InstanceDetails (Prelude.Maybe Prelude.Text)
eC2InstanceDetails_platform :: (Maybe Text -> f (Maybe Text))
-> EC2InstanceDetails -> f EC2InstanceDetails
eC2InstanceDetails_platform = (EC2InstanceDetails -> Maybe Text)
-> (EC2InstanceDetails -> Maybe Text -> EC2InstanceDetails)
-> Lens
     EC2InstanceDetails EC2InstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceDetails' {Maybe Text
platform :: Maybe Text
$sel:platform:EC2InstanceDetails' :: EC2InstanceDetails -> Maybe Text
platform} -> Maybe Text
platform) (\s :: EC2InstanceDetails
s@EC2InstanceDetails' {} Maybe Text
a -> EC2InstanceDetails
s {$sel:platform:EC2InstanceDetails' :: Maybe Text
platform = Maybe Text
a} :: EC2InstanceDetails)

-- | The instance family of the recommended reservation.
eC2InstanceDetails_family :: Lens.Lens' EC2InstanceDetails (Prelude.Maybe Prelude.Text)
eC2InstanceDetails_family :: (Maybe Text -> f (Maybe Text))
-> EC2InstanceDetails -> f EC2InstanceDetails
eC2InstanceDetails_family = (EC2InstanceDetails -> Maybe Text)
-> (EC2InstanceDetails -> Maybe Text -> EC2InstanceDetails)
-> Lens
     EC2InstanceDetails EC2InstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceDetails' {Maybe Text
family :: Maybe Text
$sel:family:EC2InstanceDetails' :: EC2InstanceDetails -> Maybe Text
family} -> Maybe Text
family) (\s :: EC2InstanceDetails
s@EC2InstanceDetails' {} Maybe Text
a -> EC2InstanceDetails
s {$sel:family:EC2InstanceDetails' :: Maybe Text
family = Maybe Text
a} :: EC2InstanceDetails)

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

-- | The Availability Zone of the recommended reservation.
eC2InstanceDetails_availabilityZone :: Lens.Lens' EC2InstanceDetails (Prelude.Maybe Prelude.Text)
eC2InstanceDetails_availabilityZone :: (Maybe Text -> f (Maybe Text))
-> EC2InstanceDetails -> f EC2InstanceDetails
eC2InstanceDetails_availabilityZone = (EC2InstanceDetails -> Maybe Text)
-> (EC2InstanceDetails -> Maybe Text -> EC2InstanceDetails)
-> Lens
     EC2InstanceDetails EC2InstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceDetails' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:EC2InstanceDetails' :: EC2InstanceDetails -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: EC2InstanceDetails
s@EC2InstanceDetails' {} Maybe Text
a -> EC2InstanceDetails
s {$sel:availabilityZone:EC2InstanceDetails' :: Maybe Text
availabilityZone = Maybe Text
a} :: EC2InstanceDetails)

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

-- | Determines whether the recommended reservation is dedicated or shared.
eC2InstanceDetails_tenancy :: Lens.Lens' EC2InstanceDetails (Prelude.Maybe Prelude.Text)
eC2InstanceDetails_tenancy :: (Maybe Text -> f (Maybe Text))
-> EC2InstanceDetails -> f EC2InstanceDetails
eC2InstanceDetails_tenancy = (EC2InstanceDetails -> Maybe Text)
-> (EC2InstanceDetails -> Maybe Text -> EC2InstanceDetails)
-> Lens
     EC2InstanceDetails EC2InstanceDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceDetails' {Maybe Text
tenancy :: Maybe Text
$sel:tenancy:EC2InstanceDetails' :: EC2InstanceDetails -> Maybe Text
tenancy} -> Maybe Text
tenancy) (\s :: EC2InstanceDetails
s@EC2InstanceDetails' {} Maybe Text
a -> EC2InstanceDetails
s {$sel:tenancy:EC2InstanceDetails' :: Maybe Text
tenancy = Maybe Text
a} :: EC2InstanceDetails)

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

instance Core.FromJSON EC2InstanceDetails where
  parseJSON :: Value -> Parser EC2InstanceDetails
parseJSON =
    String
-> (Object -> Parser EC2InstanceDetails)
-> Value
-> Parser EC2InstanceDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EC2InstanceDetails"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> EC2InstanceDetails
EC2InstanceDetails'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> EC2InstanceDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> EC2InstanceDetails)
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 Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> EC2InstanceDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> EC2InstanceDetails)
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
"Platform")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> EC2InstanceDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> EC2InstanceDetails)
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
"Family")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> EC2InstanceDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe Text -> Maybe Text -> EC2InstanceDetails)
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
"InstanceType")
            Parser
  (Maybe Text
   -> Maybe Bool -> Maybe Text -> Maybe Text -> EC2InstanceDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Text -> EC2InstanceDetails)
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
"AvailabilityZone")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Text -> EC2InstanceDetails)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> EC2InstanceDetails)
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 -> Maybe Text -> EC2InstanceDetails)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EC2InstanceDetails)
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
"Tenancy")
            Parser (Maybe Text -> EC2InstanceDetails)
-> Parser (Maybe Text) -> Parser EC2InstanceDetails
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 EC2InstanceDetails

instance Prelude.NFData EC2InstanceDetails