{-# 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.HostProperties
-- 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.HostProperties 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

-- | Describes the properties of a Dedicated Host.
--
-- /See:/ 'newHostProperties' smart constructor.
data HostProperties = HostProperties'
  { -- | The number of cores on the Dedicated Host.
    HostProperties -> Maybe Int
cores :: Prelude.Maybe Prelude.Int,
    -- | The instance family supported by the Dedicated Host. For example, @m5@.
    HostProperties -> Maybe Text
instanceFamily :: Prelude.Maybe Prelude.Text,
    -- | The instance type supported by the Dedicated Host. For example,
    -- @m5.large@. If the host supports multiple instance types, no
    -- __instanceType__ is returned.
    HostProperties -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The number of sockets on the Dedicated Host.
    HostProperties -> Maybe Int
sockets :: Prelude.Maybe Prelude.Int,
    -- | The total number of vCPUs on the Dedicated Host.
    HostProperties -> Maybe Int
totalVCpus :: Prelude.Maybe Prelude.Int
  }
  deriving (HostProperties -> HostProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostProperties -> HostProperties -> Bool
$c/= :: HostProperties -> HostProperties -> Bool
== :: HostProperties -> HostProperties -> Bool
$c== :: HostProperties -> HostProperties -> Bool
Prelude.Eq, ReadPrec [HostProperties]
ReadPrec HostProperties
Int -> ReadS HostProperties
ReadS [HostProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostProperties]
$creadListPrec :: ReadPrec [HostProperties]
readPrec :: ReadPrec HostProperties
$creadPrec :: ReadPrec HostProperties
readList :: ReadS [HostProperties]
$creadList :: ReadS [HostProperties]
readsPrec :: Int -> ReadS HostProperties
$creadsPrec :: Int -> ReadS HostProperties
Prelude.Read, Int -> HostProperties -> ShowS
[HostProperties] -> ShowS
HostProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostProperties] -> ShowS
$cshowList :: [HostProperties] -> ShowS
show :: HostProperties -> String
$cshow :: HostProperties -> String
showsPrec :: Int -> HostProperties -> ShowS
$cshowsPrec :: Int -> HostProperties -> ShowS
Prelude.Show, forall x. Rep HostProperties x -> HostProperties
forall x. HostProperties -> Rep HostProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostProperties x -> HostProperties
$cfrom :: forall x. HostProperties -> Rep HostProperties x
Prelude.Generic)

-- |
-- Create a value of 'HostProperties' 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:
--
-- 'cores', 'hostProperties_cores' - The number of cores on the Dedicated Host.
--
-- 'instanceFamily', 'hostProperties_instanceFamily' - The instance family supported by the Dedicated Host. For example, @m5@.
--
-- 'instanceType', 'hostProperties_instanceType' - The instance type supported by the Dedicated Host. For example,
-- @m5.large@. If the host supports multiple instance types, no
-- __instanceType__ is returned.
--
-- 'sockets', 'hostProperties_sockets' - The number of sockets on the Dedicated Host.
--
-- 'totalVCpus', 'hostProperties_totalVCpus' - The total number of vCPUs on the Dedicated Host.
newHostProperties ::
  HostProperties
newHostProperties :: HostProperties
newHostProperties =
  HostProperties'
    { $sel:cores:HostProperties' :: Maybe Int
cores = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceFamily:HostProperties' :: Maybe Text
instanceFamily = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:HostProperties' :: Maybe Text
instanceType = forall a. Maybe a
Prelude.Nothing,
      $sel:sockets:HostProperties' :: Maybe Int
sockets = forall a. Maybe a
Prelude.Nothing,
      $sel:totalVCpus:HostProperties' :: Maybe Int
totalVCpus = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of cores on the Dedicated Host.
hostProperties_cores :: Lens.Lens' HostProperties (Prelude.Maybe Prelude.Int)
hostProperties_cores :: Lens' HostProperties (Maybe Int)
hostProperties_cores = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostProperties' {Maybe Int
cores :: Maybe Int
$sel:cores:HostProperties' :: HostProperties -> Maybe Int
cores} -> Maybe Int
cores) (\s :: HostProperties
s@HostProperties' {} Maybe Int
a -> HostProperties
s {$sel:cores:HostProperties' :: Maybe Int
cores = Maybe Int
a} :: HostProperties)

-- | The instance family supported by the Dedicated Host. For example, @m5@.
hostProperties_instanceFamily :: Lens.Lens' HostProperties (Prelude.Maybe Prelude.Text)
hostProperties_instanceFamily :: Lens' HostProperties (Maybe Text)
hostProperties_instanceFamily = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostProperties' {Maybe Text
instanceFamily :: Maybe Text
$sel:instanceFamily:HostProperties' :: HostProperties -> Maybe Text
instanceFamily} -> Maybe Text
instanceFamily) (\s :: HostProperties
s@HostProperties' {} Maybe Text
a -> HostProperties
s {$sel:instanceFamily:HostProperties' :: Maybe Text
instanceFamily = Maybe Text
a} :: HostProperties)

-- | The instance type supported by the Dedicated Host. For example,
-- @m5.large@. If the host supports multiple instance types, no
-- __instanceType__ is returned.
hostProperties_instanceType :: Lens.Lens' HostProperties (Prelude.Maybe Prelude.Text)
hostProperties_instanceType :: Lens' HostProperties (Maybe Text)
hostProperties_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostProperties' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:HostProperties' :: HostProperties -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: HostProperties
s@HostProperties' {} Maybe Text
a -> HostProperties
s {$sel:instanceType:HostProperties' :: Maybe Text
instanceType = Maybe Text
a} :: HostProperties)

-- | The number of sockets on the Dedicated Host.
hostProperties_sockets :: Lens.Lens' HostProperties (Prelude.Maybe Prelude.Int)
hostProperties_sockets :: Lens' HostProperties (Maybe Int)
hostProperties_sockets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostProperties' {Maybe Int
sockets :: Maybe Int
$sel:sockets:HostProperties' :: HostProperties -> Maybe Int
sockets} -> Maybe Int
sockets) (\s :: HostProperties
s@HostProperties' {} Maybe Int
a -> HostProperties
s {$sel:sockets:HostProperties' :: Maybe Int
sockets = Maybe Int
a} :: HostProperties)

-- | The total number of vCPUs on the Dedicated Host.
hostProperties_totalVCpus :: Lens.Lens' HostProperties (Prelude.Maybe Prelude.Int)
hostProperties_totalVCpus :: Lens' HostProperties (Maybe Int)
hostProperties_totalVCpus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostProperties' {Maybe Int
totalVCpus :: Maybe Int
$sel:totalVCpus:HostProperties' :: HostProperties -> Maybe Int
totalVCpus} -> Maybe Int
totalVCpus) (\s :: HostProperties
s@HostProperties' {} Maybe Int
a -> HostProperties
s {$sel:totalVCpus:HostProperties' :: Maybe Int
totalVCpus = Maybe Int
a} :: HostProperties)

instance Data.FromXML HostProperties where
  parseXML :: [Node] -> Either String HostProperties
parseXML [Node]
x =
    Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> HostProperties
HostProperties'
      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
"cores")
      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
"instanceFamily")
      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
"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
"sockets")
      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
"totalVCpus")

instance Prelude.Hashable HostProperties where
  hashWithSalt :: Int -> HostProperties -> Int
hashWithSalt Int
_salt HostProperties' {Maybe Int
Maybe Text
totalVCpus :: Maybe Int
sockets :: Maybe Int
instanceType :: Maybe Text
instanceFamily :: Maybe Text
cores :: Maybe Int
$sel:totalVCpus:HostProperties' :: HostProperties -> Maybe Int
$sel:sockets:HostProperties' :: HostProperties -> Maybe Int
$sel:instanceType:HostProperties' :: HostProperties -> Maybe Text
$sel:instanceFamily:HostProperties' :: HostProperties -> Maybe Text
$sel:cores:HostProperties' :: HostProperties -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
cores
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceFamily
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sockets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
totalVCpus

instance Prelude.NFData HostProperties where
  rnf :: HostProperties -> ()
rnf HostProperties' {Maybe Int
Maybe Text
totalVCpus :: Maybe Int
sockets :: Maybe Int
instanceType :: Maybe Text
instanceFamily :: Maybe Text
cores :: Maybe Int
$sel:totalVCpus:HostProperties' :: HostProperties -> Maybe Int
$sel:sockets:HostProperties' :: HostProperties -> Maybe Int
$sel:instanceType:HostProperties' :: HostProperties -> Maybe Text
$sel:instanceFamily:HostProperties' :: HostProperties -> Maybe Text
$sel:cores:HostProperties' :: HostProperties -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
cores
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceFamily
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sockets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
totalVCpus