{-# 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.DiskInfo
-- 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.DiskInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a disk.
--
-- /See:/ 'newDiskInfo' smart constructor.
data DiskInfo = DiskInfo'
  { -- | The disk path.
    DiskInfo -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The disk name.
    DiskInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The size of the disk in GB (e.g., @32@).
    DiskInfo -> Maybe Int
sizeInGb :: Prelude.Maybe Prelude.Int,
    -- | A Boolean value indicating whether this disk is a system disk (has an
    -- operating system loaded on it).
    DiskInfo -> Maybe Bool
isSystemDisk :: Prelude.Maybe Prelude.Bool
  }
  deriving (DiskInfo -> DiskInfo -> Bool
(DiskInfo -> DiskInfo -> Bool)
-> (DiskInfo -> DiskInfo -> Bool) -> Eq DiskInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiskInfo -> DiskInfo -> Bool
$c/= :: DiskInfo -> DiskInfo -> Bool
== :: DiskInfo -> DiskInfo -> Bool
$c== :: DiskInfo -> DiskInfo -> Bool
Prelude.Eq, ReadPrec [DiskInfo]
ReadPrec DiskInfo
Int -> ReadS DiskInfo
ReadS [DiskInfo]
(Int -> ReadS DiskInfo)
-> ReadS [DiskInfo]
-> ReadPrec DiskInfo
-> ReadPrec [DiskInfo]
-> Read DiskInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiskInfo]
$creadListPrec :: ReadPrec [DiskInfo]
readPrec :: ReadPrec DiskInfo
$creadPrec :: ReadPrec DiskInfo
readList :: ReadS [DiskInfo]
$creadList :: ReadS [DiskInfo]
readsPrec :: Int -> ReadS DiskInfo
$creadsPrec :: Int -> ReadS DiskInfo
Prelude.Read, Int -> DiskInfo -> ShowS
[DiskInfo] -> ShowS
DiskInfo -> String
(Int -> DiskInfo -> ShowS)
-> (DiskInfo -> String) -> ([DiskInfo] -> ShowS) -> Show DiskInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiskInfo] -> ShowS
$cshowList :: [DiskInfo] -> ShowS
show :: DiskInfo -> String
$cshow :: DiskInfo -> String
showsPrec :: Int -> DiskInfo -> ShowS
$cshowsPrec :: Int -> DiskInfo -> ShowS
Prelude.Show, (forall x. DiskInfo -> Rep DiskInfo x)
-> (forall x. Rep DiskInfo x -> DiskInfo) -> Generic DiskInfo
forall x. Rep DiskInfo x -> DiskInfo
forall x. DiskInfo -> Rep DiskInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiskInfo x -> DiskInfo
$cfrom :: forall x. DiskInfo -> Rep DiskInfo x
Prelude.Generic)

-- |
-- Create a value of 'DiskInfo' 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:
--
-- 'path', 'diskInfo_path' - The disk path.
--
-- 'name', 'diskInfo_name' - The disk name.
--
-- 'sizeInGb', 'diskInfo_sizeInGb' - The size of the disk in GB (e.g., @32@).
--
-- 'isSystemDisk', 'diskInfo_isSystemDisk' - A Boolean value indicating whether this disk is a system disk (has an
-- operating system loaded on it).
newDiskInfo ::
  DiskInfo
newDiskInfo :: DiskInfo
newDiskInfo =
  DiskInfo' :: Maybe Text -> Maybe Text -> Maybe Int -> Maybe Bool -> DiskInfo
DiskInfo'
    { $sel:path:DiskInfo' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DiskInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sizeInGb:DiskInfo' :: Maybe Int
sizeInGb = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:isSystemDisk:DiskInfo' :: Maybe Bool
isSystemDisk = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The disk path.
diskInfo_path :: Lens.Lens' DiskInfo (Prelude.Maybe Prelude.Text)
diskInfo_path :: (Maybe Text -> f (Maybe Text)) -> DiskInfo -> f DiskInfo
diskInfo_path = (DiskInfo -> Maybe Text)
-> (DiskInfo -> Maybe Text -> DiskInfo)
-> Lens DiskInfo DiskInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe Text
path :: Maybe Text
$sel:path:DiskInfo' :: DiskInfo -> Maybe Text
path} -> Maybe Text
path) (\s :: DiskInfo
s@DiskInfo' {} Maybe Text
a -> DiskInfo
s {$sel:path:DiskInfo' :: Maybe Text
path = Maybe Text
a} :: DiskInfo)

-- | The disk name.
diskInfo_name :: Lens.Lens' DiskInfo (Prelude.Maybe Prelude.Text)
diskInfo_name :: (Maybe Text -> f (Maybe Text)) -> DiskInfo -> f DiskInfo
diskInfo_name = (DiskInfo -> Maybe Text)
-> (DiskInfo -> Maybe Text -> DiskInfo)
-> Lens DiskInfo DiskInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe Text
name :: Maybe Text
$sel:name:DiskInfo' :: DiskInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: DiskInfo
s@DiskInfo' {} Maybe Text
a -> DiskInfo
s {$sel:name:DiskInfo' :: Maybe Text
name = Maybe Text
a} :: DiskInfo)

-- | The size of the disk in GB (e.g., @32@).
diskInfo_sizeInGb :: Lens.Lens' DiskInfo (Prelude.Maybe Prelude.Int)
diskInfo_sizeInGb :: (Maybe Int -> f (Maybe Int)) -> DiskInfo -> f DiskInfo
diskInfo_sizeInGb = (DiskInfo -> Maybe Int)
-> (DiskInfo -> Maybe Int -> DiskInfo)
-> Lens DiskInfo DiskInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe Int
sizeInGb :: Maybe Int
$sel:sizeInGb:DiskInfo' :: DiskInfo -> Maybe Int
sizeInGb} -> Maybe Int
sizeInGb) (\s :: DiskInfo
s@DiskInfo' {} Maybe Int
a -> DiskInfo
s {$sel:sizeInGb:DiskInfo' :: Maybe Int
sizeInGb = Maybe Int
a} :: DiskInfo)

-- | A Boolean value indicating whether this disk is a system disk (has an
-- operating system loaded on it).
diskInfo_isSystemDisk :: Lens.Lens' DiskInfo (Prelude.Maybe Prelude.Bool)
diskInfo_isSystemDisk :: (Maybe Bool -> f (Maybe Bool)) -> DiskInfo -> f DiskInfo
diskInfo_isSystemDisk = (DiskInfo -> Maybe Bool)
-> (DiskInfo -> Maybe Bool -> DiskInfo)
-> Lens DiskInfo DiskInfo (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskInfo' {Maybe Bool
isSystemDisk :: Maybe Bool
$sel:isSystemDisk:DiskInfo' :: DiskInfo -> Maybe Bool
isSystemDisk} -> Maybe Bool
isSystemDisk) (\s :: DiskInfo
s@DiskInfo' {} Maybe Bool
a -> DiskInfo
s {$sel:isSystemDisk:DiskInfo' :: Maybe Bool
isSystemDisk = Maybe Bool
a} :: DiskInfo)

instance Core.FromJSON DiskInfo where
  parseJSON :: Value -> Parser DiskInfo
parseJSON =
    String -> (Object -> Parser DiskInfo) -> Value -> Parser DiskInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DiskInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Int -> Maybe Bool -> DiskInfo
DiskInfo'
            (Maybe Text -> Maybe Text -> Maybe Int -> Maybe Bool -> DiskInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Int -> Maybe Bool -> DiskInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"path")
            Parser (Maybe Text -> Maybe Int -> Maybe Bool -> DiskInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Bool -> DiskInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe Int -> Maybe Bool -> DiskInfo)
-> Parser (Maybe Int) -> Parser (Maybe Bool -> DiskInfo)
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
"sizeInGb")
            Parser (Maybe Bool -> DiskInfo)
-> Parser (Maybe Bool) -> Parser DiskInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isSystemDisk")
      )

instance Prelude.Hashable DiskInfo

instance Prelude.NFData DiskInfo