{-# 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.Lightsail.Types.RelationalDatabaseHardware
-- 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.Lightsail.Types.RelationalDatabaseHardware 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

-- | Describes the hardware of a database.
--
-- /See:/ 'newRelationalDatabaseHardware' smart constructor.
data RelationalDatabaseHardware = RelationalDatabaseHardware'
  { -- | The number of vCPUs for the database.
    RelationalDatabaseHardware -> Maybe Int
cpuCount :: Prelude.Maybe Prelude.Int,
    -- | The size of the disk for the database.
    RelationalDatabaseHardware -> Maybe Int
diskSizeInGb :: Prelude.Maybe Prelude.Int,
    -- | The amount of RAM in GB for the database.
    RelationalDatabaseHardware -> Maybe Double
ramSizeInGb :: Prelude.Maybe Prelude.Double
  }
  deriving (RelationalDatabaseHardware -> RelationalDatabaseHardware -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelationalDatabaseHardware -> RelationalDatabaseHardware -> Bool
$c/= :: RelationalDatabaseHardware -> RelationalDatabaseHardware -> Bool
== :: RelationalDatabaseHardware -> RelationalDatabaseHardware -> Bool
$c== :: RelationalDatabaseHardware -> RelationalDatabaseHardware -> Bool
Prelude.Eq, ReadPrec [RelationalDatabaseHardware]
ReadPrec RelationalDatabaseHardware
Int -> ReadS RelationalDatabaseHardware
ReadS [RelationalDatabaseHardware]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelationalDatabaseHardware]
$creadListPrec :: ReadPrec [RelationalDatabaseHardware]
readPrec :: ReadPrec RelationalDatabaseHardware
$creadPrec :: ReadPrec RelationalDatabaseHardware
readList :: ReadS [RelationalDatabaseHardware]
$creadList :: ReadS [RelationalDatabaseHardware]
readsPrec :: Int -> ReadS RelationalDatabaseHardware
$creadsPrec :: Int -> ReadS RelationalDatabaseHardware
Prelude.Read, Int -> RelationalDatabaseHardware -> ShowS
[RelationalDatabaseHardware] -> ShowS
RelationalDatabaseHardware -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelationalDatabaseHardware] -> ShowS
$cshowList :: [RelationalDatabaseHardware] -> ShowS
show :: RelationalDatabaseHardware -> String
$cshow :: RelationalDatabaseHardware -> String
showsPrec :: Int -> RelationalDatabaseHardware -> ShowS
$cshowsPrec :: Int -> RelationalDatabaseHardware -> ShowS
Prelude.Show, forall x.
Rep RelationalDatabaseHardware x -> RelationalDatabaseHardware
forall x.
RelationalDatabaseHardware -> Rep RelationalDatabaseHardware x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RelationalDatabaseHardware x -> RelationalDatabaseHardware
$cfrom :: forall x.
RelationalDatabaseHardware -> Rep RelationalDatabaseHardware x
Prelude.Generic)

-- |
-- Create a value of 'RelationalDatabaseHardware' 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:
--
-- 'cpuCount', 'relationalDatabaseHardware_cpuCount' - The number of vCPUs for the database.
--
-- 'diskSizeInGb', 'relationalDatabaseHardware_diskSizeInGb' - The size of the disk for the database.
--
-- 'ramSizeInGb', 'relationalDatabaseHardware_ramSizeInGb' - The amount of RAM in GB for the database.
newRelationalDatabaseHardware ::
  RelationalDatabaseHardware
newRelationalDatabaseHardware :: RelationalDatabaseHardware
newRelationalDatabaseHardware =
  RelationalDatabaseHardware'
    { $sel:cpuCount:RelationalDatabaseHardware' :: Maybe Int
cpuCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:diskSizeInGb:RelationalDatabaseHardware' :: Maybe Int
diskSizeInGb = forall a. Maybe a
Prelude.Nothing,
      $sel:ramSizeInGb:RelationalDatabaseHardware' :: Maybe Double
ramSizeInGb = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of vCPUs for the database.
relationalDatabaseHardware_cpuCount :: Lens.Lens' RelationalDatabaseHardware (Prelude.Maybe Prelude.Int)
relationalDatabaseHardware_cpuCount :: Lens' RelationalDatabaseHardware (Maybe Int)
relationalDatabaseHardware_cpuCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelationalDatabaseHardware' {Maybe Int
cpuCount :: Maybe Int
$sel:cpuCount:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Int
cpuCount} -> Maybe Int
cpuCount) (\s :: RelationalDatabaseHardware
s@RelationalDatabaseHardware' {} Maybe Int
a -> RelationalDatabaseHardware
s {$sel:cpuCount:RelationalDatabaseHardware' :: Maybe Int
cpuCount = Maybe Int
a} :: RelationalDatabaseHardware)

-- | The size of the disk for the database.
relationalDatabaseHardware_diskSizeInGb :: Lens.Lens' RelationalDatabaseHardware (Prelude.Maybe Prelude.Int)
relationalDatabaseHardware_diskSizeInGb :: Lens' RelationalDatabaseHardware (Maybe Int)
relationalDatabaseHardware_diskSizeInGb = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelationalDatabaseHardware' {Maybe Int
diskSizeInGb :: Maybe Int
$sel:diskSizeInGb:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Int
diskSizeInGb} -> Maybe Int
diskSizeInGb) (\s :: RelationalDatabaseHardware
s@RelationalDatabaseHardware' {} Maybe Int
a -> RelationalDatabaseHardware
s {$sel:diskSizeInGb:RelationalDatabaseHardware' :: Maybe Int
diskSizeInGb = Maybe Int
a} :: RelationalDatabaseHardware)

-- | The amount of RAM in GB for the database.
relationalDatabaseHardware_ramSizeInGb :: Lens.Lens' RelationalDatabaseHardware (Prelude.Maybe Prelude.Double)
relationalDatabaseHardware_ramSizeInGb :: Lens' RelationalDatabaseHardware (Maybe Double)
relationalDatabaseHardware_ramSizeInGb = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelationalDatabaseHardware' {Maybe Double
ramSizeInGb :: Maybe Double
$sel:ramSizeInGb:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Double
ramSizeInGb} -> Maybe Double
ramSizeInGb) (\s :: RelationalDatabaseHardware
s@RelationalDatabaseHardware' {} Maybe Double
a -> RelationalDatabaseHardware
s {$sel:ramSizeInGb:RelationalDatabaseHardware' :: Maybe Double
ramSizeInGb = Maybe Double
a} :: RelationalDatabaseHardware)

instance Data.FromJSON RelationalDatabaseHardware where
  parseJSON :: Value -> Parser RelationalDatabaseHardware
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RelationalDatabaseHardware"
      ( \Object
x ->
          Maybe Int
-> Maybe Int -> Maybe Double -> RelationalDatabaseHardware
RelationalDatabaseHardware'
            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
"cpuCount")
            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
"diskSizeInGb")
            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
"ramSizeInGb")
      )

instance Prelude.Hashable RelationalDatabaseHardware where
  hashWithSalt :: Int -> RelationalDatabaseHardware -> Int
hashWithSalt Int
_salt RelationalDatabaseHardware' {Maybe Double
Maybe Int
ramSizeInGb :: Maybe Double
diskSizeInGb :: Maybe Int
cpuCount :: Maybe Int
$sel:ramSizeInGb:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Double
$sel:diskSizeInGb:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Int
$sel:cpuCount:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
cpuCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
diskSizeInGb
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
ramSizeInGb

instance Prelude.NFData RelationalDatabaseHardware where
  rnf :: RelationalDatabaseHardware -> ()
rnf RelationalDatabaseHardware' {Maybe Double
Maybe Int
ramSizeInGb :: Maybe Double
diskSizeInGb :: Maybe Int
cpuCount :: Maybe Int
$sel:ramSizeInGb:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Double
$sel:diskSizeInGb:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Int
$sel:cpuCount:RelationalDatabaseHardware' :: RelationalDatabaseHardware -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
cpuCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
diskSizeInGb
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
ramSizeInGb