{-# 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.InstanceTypeOffering
-- 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.InstanceTypeOffering 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 Amazonka.EC2.Types.InstanceType
import Amazonka.EC2.Types.LocationType
import qualified Amazonka.Prelude as Prelude

-- | The instance types offered.
--
-- /See:/ 'newInstanceTypeOffering' smart constructor.
data InstanceTypeOffering = InstanceTypeOffering'
  { -- | The instance type. For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html Instance types>
    -- in the /Amazon EC2 User Guide/.
    InstanceTypeOffering -> Maybe InstanceType
instanceType :: Prelude.Maybe InstanceType,
    -- | The identifier for the location. This depends on the location type. For
    -- example, if the location type is @region@, the location is the Region
    -- code (for example, @us-east-2@.)
    InstanceTypeOffering -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | The location type.
    InstanceTypeOffering -> Maybe LocationType
locationType :: Prelude.Maybe LocationType
  }
  deriving (InstanceTypeOffering -> InstanceTypeOffering -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceTypeOffering -> InstanceTypeOffering -> Bool
$c/= :: InstanceTypeOffering -> InstanceTypeOffering -> Bool
== :: InstanceTypeOffering -> InstanceTypeOffering -> Bool
$c== :: InstanceTypeOffering -> InstanceTypeOffering -> Bool
Prelude.Eq, ReadPrec [InstanceTypeOffering]
ReadPrec InstanceTypeOffering
Int -> ReadS InstanceTypeOffering
ReadS [InstanceTypeOffering]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceTypeOffering]
$creadListPrec :: ReadPrec [InstanceTypeOffering]
readPrec :: ReadPrec InstanceTypeOffering
$creadPrec :: ReadPrec InstanceTypeOffering
readList :: ReadS [InstanceTypeOffering]
$creadList :: ReadS [InstanceTypeOffering]
readsPrec :: Int -> ReadS InstanceTypeOffering
$creadsPrec :: Int -> ReadS InstanceTypeOffering
Prelude.Read, Int -> InstanceTypeOffering -> ShowS
[InstanceTypeOffering] -> ShowS
InstanceTypeOffering -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceTypeOffering] -> ShowS
$cshowList :: [InstanceTypeOffering] -> ShowS
show :: InstanceTypeOffering -> String
$cshow :: InstanceTypeOffering -> String
showsPrec :: Int -> InstanceTypeOffering -> ShowS
$cshowsPrec :: Int -> InstanceTypeOffering -> ShowS
Prelude.Show, forall x. Rep InstanceTypeOffering x -> InstanceTypeOffering
forall x. InstanceTypeOffering -> Rep InstanceTypeOffering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceTypeOffering x -> InstanceTypeOffering
$cfrom :: forall x. InstanceTypeOffering -> Rep InstanceTypeOffering x
Prelude.Generic)

-- |
-- Create a value of 'InstanceTypeOffering' 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:
--
-- 'instanceType', 'instanceTypeOffering_instanceType' - The instance type. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html Instance types>
-- in the /Amazon EC2 User Guide/.
--
-- 'location', 'instanceTypeOffering_location' - The identifier for the location. This depends on the location type. For
-- example, if the location type is @region@, the location is the Region
-- code (for example, @us-east-2@.)
--
-- 'locationType', 'instanceTypeOffering_locationType' - The location type.
newInstanceTypeOffering ::
  InstanceTypeOffering
newInstanceTypeOffering :: InstanceTypeOffering
newInstanceTypeOffering =
  InstanceTypeOffering'
    { $sel:instanceType:InstanceTypeOffering' :: Maybe InstanceType
instanceType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:location:InstanceTypeOffering' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
      $sel:locationType:InstanceTypeOffering' :: Maybe LocationType
locationType = forall a. Maybe a
Prelude.Nothing
    }

-- | The instance type. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html Instance types>
-- in the /Amazon EC2 User Guide/.
instanceTypeOffering_instanceType :: Lens.Lens' InstanceTypeOffering (Prelude.Maybe InstanceType)
instanceTypeOffering_instanceType :: Lens' InstanceTypeOffering (Maybe InstanceType)
instanceTypeOffering_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeOffering' {Maybe InstanceType
instanceType :: Maybe InstanceType
$sel:instanceType:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe InstanceType
instanceType} -> Maybe InstanceType
instanceType) (\s :: InstanceTypeOffering
s@InstanceTypeOffering' {} Maybe InstanceType
a -> InstanceTypeOffering
s {$sel:instanceType:InstanceTypeOffering' :: Maybe InstanceType
instanceType = Maybe InstanceType
a} :: InstanceTypeOffering)

-- | The identifier for the location. This depends on the location type. For
-- example, if the location type is @region@, the location is the Region
-- code (for example, @us-east-2@.)
instanceTypeOffering_location :: Lens.Lens' InstanceTypeOffering (Prelude.Maybe Prelude.Text)
instanceTypeOffering_location :: Lens' InstanceTypeOffering (Maybe Text)
instanceTypeOffering_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeOffering' {Maybe Text
location :: Maybe Text
$sel:location:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe Text
location} -> Maybe Text
location) (\s :: InstanceTypeOffering
s@InstanceTypeOffering' {} Maybe Text
a -> InstanceTypeOffering
s {$sel:location:InstanceTypeOffering' :: Maybe Text
location = Maybe Text
a} :: InstanceTypeOffering)

-- | The location type.
instanceTypeOffering_locationType :: Lens.Lens' InstanceTypeOffering (Prelude.Maybe LocationType)
instanceTypeOffering_locationType :: Lens' InstanceTypeOffering (Maybe LocationType)
instanceTypeOffering_locationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceTypeOffering' {Maybe LocationType
locationType :: Maybe LocationType
$sel:locationType:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe LocationType
locationType} -> Maybe LocationType
locationType) (\s :: InstanceTypeOffering
s@InstanceTypeOffering' {} Maybe LocationType
a -> InstanceTypeOffering
s {$sel:locationType:InstanceTypeOffering' :: Maybe LocationType
locationType = Maybe LocationType
a} :: InstanceTypeOffering)

instance Data.FromXML InstanceTypeOffering where
  parseXML :: [Node] -> Either String InstanceTypeOffering
parseXML [Node]
x =
    Maybe InstanceType
-> Maybe Text -> Maybe LocationType -> InstanceTypeOffering
InstanceTypeOffering'
      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
"instanceType")
      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
"location")
      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
"locationType")

instance Prelude.Hashable InstanceTypeOffering where
  hashWithSalt :: Int -> InstanceTypeOffering -> Int
hashWithSalt Int
_salt InstanceTypeOffering' {Maybe Text
Maybe InstanceType
Maybe LocationType
locationType :: Maybe LocationType
location :: Maybe Text
instanceType :: Maybe InstanceType
$sel:locationType:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe LocationType
$sel:location:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe Text
$sel:instanceType:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe InstanceType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceType
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LocationType
locationType

instance Prelude.NFData InstanceTypeOffering where
  rnf :: InstanceTypeOffering -> ()
rnf InstanceTypeOffering' {Maybe Text
Maybe InstanceType
Maybe LocationType
locationType :: Maybe LocationType
location :: Maybe Text
instanceType :: Maybe InstanceType
$sel:locationType:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe LocationType
$sel:location:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe Text
$sel:instanceType:InstanceTypeOffering' :: InstanceTypeOffering -> Maybe InstanceType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceType
instanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LocationType
locationType