{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.RelationalDatabaseHardware where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RelationalDatabaseHardware -> RelationalDatabaseHardware -> Bool)
-> (RelationalDatabaseHardware
    -> RelationalDatabaseHardware -> Bool)
-> Eq RelationalDatabaseHardware
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]
(Int -> ReadS RelationalDatabaseHardware)
-> ReadS [RelationalDatabaseHardware]
-> ReadPrec RelationalDatabaseHardware
-> ReadPrec [RelationalDatabaseHardware]
-> Read 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
(Int -> RelationalDatabaseHardware -> ShowS)
-> (RelationalDatabaseHardware -> String)
-> ([RelationalDatabaseHardware] -> ShowS)
-> Show RelationalDatabaseHardware
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.
 RelationalDatabaseHardware -> Rep RelationalDatabaseHardware x)
-> (forall x.
    Rep RelationalDatabaseHardware x -> RelationalDatabaseHardware)
-> Generic RelationalDatabaseHardware
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' :: Maybe Int
-> Maybe Int -> Maybe Double -> RelationalDatabaseHardware
RelationalDatabaseHardware'
    { $sel:cpuCount:RelationalDatabaseHardware' :: Maybe Int
cpuCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:diskSizeInGb:RelationalDatabaseHardware' :: Maybe Int
diskSizeInGb = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:ramSizeInGb:RelationalDatabaseHardware' :: Maybe Double
ramSizeInGb = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of vCPUs for the database.
relationalDatabaseHardware_cpuCount :: Lens.Lens' RelationalDatabaseHardware (Prelude.Maybe Prelude.Int)
relationalDatabaseHardware_cpuCount :: (Maybe Int -> f (Maybe Int))
-> RelationalDatabaseHardware -> f RelationalDatabaseHardware
relationalDatabaseHardware_cpuCount = (RelationalDatabaseHardware -> Maybe Int)
-> (RelationalDatabaseHardware
    -> Maybe Int -> RelationalDatabaseHardware)
-> Lens
     RelationalDatabaseHardware
     RelationalDatabaseHardware
     (Maybe Int)
     (Maybe Int)
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 :: (Maybe Int -> f (Maybe Int))
-> RelationalDatabaseHardware -> f RelationalDatabaseHardware
relationalDatabaseHardware_diskSizeInGb = (RelationalDatabaseHardware -> Maybe Int)
-> (RelationalDatabaseHardware
    -> Maybe Int -> RelationalDatabaseHardware)
-> Lens
     RelationalDatabaseHardware
     RelationalDatabaseHardware
     (Maybe Int)
     (Maybe Int)
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 :: (Maybe Double -> f (Maybe Double))
-> RelationalDatabaseHardware -> f RelationalDatabaseHardware
relationalDatabaseHardware_ramSizeInGb = (RelationalDatabaseHardware -> Maybe Double)
-> (RelationalDatabaseHardware
    -> Maybe Double -> RelationalDatabaseHardware)
-> Lens
     RelationalDatabaseHardware
     RelationalDatabaseHardware
     (Maybe Double)
     (Maybe Double)
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 Core.FromJSON RelationalDatabaseHardware where
  parseJSON :: Value -> Parser RelationalDatabaseHardware
parseJSON =
    String
-> (Object -> Parser RelationalDatabaseHardware)
-> Value
-> Parser RelationalDatabaseHardware
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RelationalDatabaseHardware"
      ( \Object
x ->
          Maybe Int
-> Maybe Int -> Maybe Double -> RelationalDatabaseHardware
RelationalDatabaseHardware'
            (Maybe Int
 -> Maybe Int -> Maybe Double -> RelationalDatabaseHardware)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Double -> RelationalDatabaseHardware)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cpuCount")
            Parser (Maybe Int -> Maybe Double -> RelationalDatabaseHardware)
-> Parser (Maybe Int)
-> Parser (Maybe Double -> RelationalDatabaseHardware)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"diskSizeInGb")
            Parser (Maybe Double -> RelationalDatabaseHardware)
-> Parser (Maybe Double) -> Parser RelationalDatabaseHardware
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ramSizeInGb")
      )

instance Prelude.Hashable RelationalDatabaseHardware

instance Prelude.NFData RelationalDatabaseHardware