{-# 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.Outposts.Types.ComputeAttributes
-- 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.Outposts.Types.ComputeAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Outposts.Types.ComputeAssetState
import qualified Amazonka.Prelude as Prelude

-- | Information about compute hardware assets.
--
-- /See:/ 'newComputeAttributes' smart constructor.
data ComputeAttributes = ComputeAttributes'
  { -- | The host ID of the Dedicated Host on the asset.
    ComputeAttributes -> Maybe Text
hostId :: Prelude.Maybe Prelude.Text,
    -- | The state.
    --
    -- -   ACTIVE - The asset is available and can provide capacity for new
    --     compute resources.
    --
    -- -   ISOLATED - The asset is undergoing maintenance and can\'t provide
    --     capacity for new compute resources. Existing compute resources on
    --     the asset are not affected.
    --
    -- -   RETIRING - The underlying hardware for the asset is degraded.
    --     Capacity for new compute resources is reduced. Amazon Web Services
    --     sends notifications for resources that must be stopped before the
    --     asset can be replaced.
    ComputeAttributes -> Maybe ComputeAssetState
state :: Prelude.Maybe ComputeAssetState
  }
  deriving (ComputeAttributes -> ComputeAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComputeAttributes -> ComputeAttributes -> Bool
$c/= :: ComputeAttributes -> ComputeAttributes -> Bool
== :: ComputeAttributes -> ComputeAttributes -> Bool
$c== :: ComputeAttributes -> ComputeAttributes -> Bool
Prelude.Eq, ReadPrec [ComputeAttributes]
ReadPrec ComputeAttributes
Int -> ReadS ComputeAttributes
ReadS [ComputeAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComputeAttributes]
$creadListPrec :: ReadPrec [ComputeAttributes]
readPrec :: ReadPrec ComputeAttributes
$creadPrec :: ReadPrec ComputeAttributes
readList :: ReadS [ComputeAttributes]
$creadList :: ReadS [ComputeAttributes]
readsPrec :: Int -> ReadS ComputeAttributes
$creadsPrec :: Int -> ReadS ComputeAttributes
Prelude.Read, Int -> ComputeAttributes -> ShowS
[ComputeAttributes] -> ShowS
ComputeAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComputeAttributes] -> ShowS
$cshowList :: [ComputeAttributes] -> ShowS
show :: ComputeAttributes -> String
$cshow :: ComputeAttributes -> String
showsPrec :: Int -> ComputeAttributes -> ShowS
$cshowsPrec :: Int -> ComputeAttributes -> ShowS
Prelude.Show, forall x. Rep ComputeAttributes x -> ComputeAttributes
forall x. ComputeAttributes -> Rep ComputeAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComputeAttributes x -> ComputeAttributes
$cfrom :: forall x. ComputeAttributes -> Rep ComputeAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ComputeAttributes' 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:
--
-- 'hostId', 'computeAttributes_hostId' - The host ID of the Dedicated Host on the asset.
--
-- 'state', 'computeAttributes_state' - The state.
--
-- -   ACTIVE - The asset is available and can provide capacity for new
--     compute resources.
--
-- -   ISOLATED - The asset is undergoing maintenance and can\'t provide
--     capacity for new compute resources. Existing compute resources on
--     the asset are not affected.
--
-- -   RETIRING - The underlying hardware for the asset is degraded.
--     Capacity for new compute resources is reduced. Amazon Web Services
--     sends notifications for resources that must be stopped before the
--     asset can be replaced.
newComputeAttributes ::
  ComputeAttributes
newComputeAttributes :: ComputeAttributes
newComputeAttributes =
  ComputeAttributes'
    { $sel:hostId:ComputeAttributes' :: Maybe Text
hostId = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ComputeAttributes' :: Maybe ComputeAssetState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The host ID of the Dedicated Host on the asset.
computeAttributes_hostId :: Lens.Lens' ComputeAttributes (Prelude.Maybe Prelude.Text)
computeAttributes_hostId :: Lens' ComputeAttributes (Maybe Text)
computeAttributes_hostId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeAttributes' {Maybe Text
hostId :: Maybe Text
$sel:hostId:ComputeAttributes' :: ComputeAttributes -> Maybe Text
hostId} -> Maybe Text
hostId) (\s :: ComputeAttributes
s@ComputeAttributes' {} Maybe Text
a -> ComputeAttributes
s {$sel:hostId:ComputeAttributes' :: Maybe Text
hostId = Maybe Text
a} :: ComputeAttributes)

-- | The state.
--
-- -   ACTIVE - The asset is available and can provide capacity for new
--     compute resources.
--
-- -   ISOLATED - The asset is undergoing maintenance and can\'t provide
--     capacity for new compute resources. Existing compute resources on
--     the asset are not affected.
--
-- -   RETIRING - The underlying hardware for the asset is degraded.
--     Capacity for new compute resources is reduced. Amazon Web Services
--     sends notifications for resources that must be stopped before the
--     asset can be replaced.
computeAttributes_state :: Lens.Lens' ComputeAttributes (Prelude.Maybe ComputeAssetState)
computeAttributes_state :: Lens' ComputeAttributes (Maybe ComputeAssetState)
computeAttributes_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeAttributes' {Maybe ComputeAssetState
state :: Maybe ComputeAssetState
$sel:state:ComputeAttributes' :: ComputeAttributes -> Maybe ComputeAssetState
state} -> Maybe ComputeAssetState
state) (\s :: ComputeAttributes
s@ComputeAttributes' {} Maybe ComputeAssetState
a -> ComputeAttributes
s {$sel:state:ComputeAttributes' :: Maybe ComputeAssetState
state = Maybe ComputeAssetState
a} :: ComputeAttributes)

instance Data.FromJSON ComputeAttributes where
  parseJSON :: Value -> Parser ComputeAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComputeAttributes"
      ( \Object
x ->
          Maybe Text -> Maybe ComputeAssetState -> ComputeAttributes
ComputeAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"HostId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
      )

instance Prelude.Hashable ComputeAttributes where
  hashWithSalt :: Int -> ComputeAttributes -> Int
hashWithSalt Int
_salt ComputeAttributes' {Maybe Text
Maybe ComputeAssetState
state :: Maybe ComputeAssetState
hostId :: Maybe Text
$sel:state:ComputeAttributes' :: ComputeAttributes -> Maybe ComputeAssetState
$sel:hostId:ComputeAttributes' :: ComputeAttributes -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComputeAssetState
state

instance Prelude.NFData ComputeAttributes where
  rnf :: ComputeAttributes -> ()
rnf ComputeAttributes' {Maybe Text
Maybe ComputeAssetState
state :: Maybe ComputeAssetState
hostId :: Maybe Text
$sel:state:ComputeAttributes' :: ComputeAttributes -> Maybe ComputeAssetState
$sel:hostId:ComputeAttributes' :: ComputeAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostId seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ComputeAssetState
state