{-# 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.WorkSpaces.Types.ComputeType
-- 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.WorkSpaces.Types.ComputeType where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.Compute

-- | Describes the compute type of the bundle.
--
-- /See:/ 'newComputeType' smart constructor.
data ComputeType = ComputeType'
  { -- | The compute type.
    ComputeType -> Maybe Compute
name :: Prelude.Maybe Compute
  }
  deriving (ComputeType -> ComputeType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComputeType -> ComputeType -> Bool
$c/= :: ComputeType -> ComputeType -> Bool
== :: ComputeType -> ComputeType -> Bool
$c== :: ComputeType -> ComputeType -> Bool
Prelude.Eq, ReadPrec [ComputeType]
ReadPrec ComputeType
Int -> ReadS ComputeType
ReadS [ComputeType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComputeType]
$creadListPrec :: ReadPrec [ComputeType]
readPrec :: ReadPrec ComputeType
$creadPrec :: ReadPrec ComputeType
readList :: ReadS [ComputeType]
$creadList :: ReadS [ComputeType]
readsPrec :: Int -> ReadS ComputeType
$creadsPrec :: Int -> ReadS ComputeType
Prelude.Read, Int -> ComputeType -> ShowS
[ComputeType] -> ShowS
ComputeType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComputeType] -> ShowS
$cshowList :: [ComputeType] -> ShowS
show :: ComputeType -> String
$cshow :: ComputeType -> String
showsPrec :: Int -> ComputeType -> ShowS
$cshowsPrec :: Int -> ComputeType -> ShowS
Prelude.Show, forall x. Rep ComputeType x -> ComputeType
forall x. ComputeType -> Rep ComputeType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComputeType x -> ComputeType
$cfrom :: forall x. ComputeType -> Rep ComputeType x
Prelude.Generic)

-- |
-- Create a value of 'ComputeType' 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:
--
-- 'name', 'computeType_name' - The compute type.
newComputeType ::
  ComputeType
newComputeType :: ComputeType
newComputeType = ComputeType' {$sel:name:ComputeType' :: Maybe Compute
name = forall a. Maybe a
Prelude.Nothing}

-- | The compute type.
computeType_name :: Lens.Lens' ComputeType (Prelude.Maybe Compute)
computeType_name :: Lens' ComputeType (Maybe Compute)
computeType_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeType' {Maybe Compute
name :: Maybe Compute
$sel:name:ComputeType' :: ComputeType -> Maybe Compute
name} -> Maybe Compute
name) (\s :: ComputeType
s@ComputeType' {} Maybe Compute
a -> ComputeType
s {$sel:name:ComputeType' :: Maybe Compute
name = Maybe Compute
a} :: ComputeType)

instance Data.FromJSON ComputeType where
  parseJSON :: Value -> Parser ComputeType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComputeType"
      (\Object
x -> Maybe Compute -> ComputeType
ComputeType' 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
"Name"))

instance Prelude.Hashable ComputeType where
  hashWithSalt :: Int -> ComputeType -> Int
hashWithSalt Int
_salt ComputeType' {Maybe Compute
name :: Maybe Compute
$sel:name:ComputeType' :: ComputeType -> Maybe Compute
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Compute
name

instance Prelude.NFData ComputeType where
  rnf :: ComputeType -> ()
rnf ComputeType' {Maybe Compute
name :: Maybe Compute
$sel:name:ComputeType' :: ComputeType -> Maybe Compute
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Compute
name

instance Data.ToJSON ComputeType where
  toJSON :: ComputeType -> Value
toJSON ComputeType' {Maybe Compute
name :: Maybe Compute
$sel:name:ComputeType' :: ComputeType -> Maybe Compute
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Compute
name]
      )