{-# 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.HostInstance
-- 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.HostInstance 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 an instance running on a Dedicated Host.
--
-- /See:/ 'newHostInstance' smart constructor.
data HostInstance = HostInstance'
  { -- | The ID of instance that is running on the Dedicated Host.
    HostInstance -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    -- | The instance type (for example, @m3.medium@) of the running instance.
    HostInstance -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services account that owns the instance.
    HostInstance -> Maybe Text
ownerId :: Prelude.Maybe Prelude.Text
  }
  deriving (HostInstance -> HostInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostInstance -> HostInstance -> Bool
$c/= :: HostInstance -> HostInstance -> Bool
== :: HostInstance -> HostInstance -> Bool
$c== :: HostInstance -> HostInstance -> Bool
Prelude.Eq, ReadPrec [HostInstance]
ReadPrec HostInstance
Int -> ReadS HostInstance
ReadS [HostInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostInstance]
$creadListPrec :: ReadPrec [HostInstance]
readPrec :: ReadPrec HostInstance
$creadPrec :: ReadPrec HostInstance
readList :: ReadS [HostInstance]
$creadList :: ReadS [HostInstance]
readsPrec :: Int -> ReadS HostInstance
$creadsPrec :: Int -> ReadS HostInstance
Prelude.Read, Int -> HostInstance -> ShowS
[HostInstance] -> ShowS
HostInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostInstance] -> ShowS
$cshowList :: [HostInstance] -> ShowS
show :: HostInstance -> String
$cshow :: HostInstance -> String
showsPrec :: Int -> HostInstance -> ShowS
$cshowsPrec :: Int -> HostInstance -> ShowS
Prelude.Show, forall x. Rep HostInstance x -> HostInstance
forall x. HostInstance -> Rep HostInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostInstance x -> HostInstance
$cfrom :: forall x. HostInstance -> Rep HostInstance x
Prelude.Generic)

-- |
-- Create a value of 'HostInstance' 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:
--
-- 'instanceId', 'hostInstance_instanceId' - The ID of instance that is running on the Dedicated Host.
--
-- 'instanceType', 'hostInstance_instanceType' - The instance type (for example, @m3.medium@) of the running instance.
--
-- 'ownerId', 'hostInstance_ownerId' - The ID of the Amazon Web Services account that owns the instance.
newHostInstance ::
  HostInstance
newHostInstance :: HostInstance
newHostInstance =
  HostInstance'
    { $sel:instanceId:HostInstance' :: Maybe Text
instanceId = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:HostInstance' :: Maybe Text
instanceType = forall a. Maybe a
Prelude.Nothing,
      $sel:ownerId:HostInstance' :: Maybe Text
ownerId = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of instance that is running on the Dedicated Host.
hostInstance_instanceId :: Lens.Lens' HostInstance (Prelude.Maybe Prelude.Text)
hostInstance_instanceId :: Lens' HostInstance (Maybe Text)
hostInstance_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostInstance' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:HostInstance' :: HostInstance -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: HostInstance
s@HostInstance' {} Maybe Text
a -> HostInstance
s {$sel:instanceId:HostInstance' :: Maybe Text
instanceId = Maybe Text
a} :: HostInstance)

-- | The instance type (for example, @m3.medium@) of the running instance.
hostInstance_instanceType :: Lens.Lens' HostInstance (Prelude.Maybe Prelude.Text)
hostInstance_instanceType :: Lens' HostInstance (Maybe Text)
hostInstance_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostInstance' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:HostInstance' :: HostInstance -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: HostInstance
s@HostInstance' {} Maybe Text
a -> HostInstance
s {$sel:instanceType:HostInstance' :: Maybe Text
instanceType = Maybe Text
a} :: HostInstance)

-- | The ID of the Amazon Web Services account that owns the instance.
hostInstance_ownerId :: Lens.Lens' HostInstance (Prelude.Maybe Prelude.Text)
hostInstance_ownerId :: Lens' HostInstance (Maybe Text)
hostInstance_ownerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostInstance' {Maybe Text
ownerId :: Maybe Text
$sel:ownerId:HostInstance' :: HostInstance -> Maybe Text
ownerId} -> Maybe Text
ownerId) (\s :: HostInstance
s@HostInstance' {} Maybe Text
a -> HostInstance
s {$sel:ownerId:HostInstance' :: Maybe Text
ownerId = Maybe Text
a} :: HostInstance)

instance Data.FromXML HostInstance where
  parseXML :: [Node] -> Either String HostInstance
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> HostInstance
HostInstance'
      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
"instanceId")
      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
"ownerId")

instance Prelude.Hashable HostInstance where
  hashWithSalt :: Int -> HostInstance -> Int
hashWithSalt Int
_salt HostInstance' {Maybe Text
ownerId :: Maybe Text
instanceType :: Maybe Text
instanceId :: Maybe Text
$sel:ownerId:HostInstance' :: HostInstance -> Maybe Text
$sel:instanceType:HostInstance' :: HostInstance -> Maybe Text
$sel:instanceId:HostInstance' :: HostInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ownerId

instance Prelude.NFData HostInstance where
  rnf :: HostInstance -> ()
rnf HostInstance' {Maybe Text
ownerId :: Maybe Text
instanceType :: Maybe Text
instanceId :: Maybe Text
$sel:ownerId:HostInstance' :: HostInstance -> Maybe Text
$sel:instanceType:HostInstance' :: HostInstance -> Maybe Text
$sel:instanceId:HostInstance' :: HostInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceId
      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 Text
ownerId