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

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

-- | Describes a disk snapshot.
--
-- /See:/ 'newDiskSnapshotInfo' smart constructor.
data DiskSnapshotInfo = DiskSnapshotInfo'
  { -- | The size of the disk in GB (e.g., @32@).
    DiskSnapshotInfo -> Maybe Int
sizeInGb :: Prelude.Maybe Prelude.Int
  }
  deriving (DiskSnapshotInfo -> DiskSnapshotInfo -> Bool
(DiskSnapshotInfo -> DiskSnapshotInfo -> Bool)
-> (DiskSnapshotInfo -> DiskSnapshotInfo -> Bool)
-> Eq DiskSnapshotInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiskSnapshotInfo -> DiskSnapshotInfo -> Bool
$c/= :: DiskSnapshotInfo -> DiskSnapshotInfo -> Bool
== :: DiskSnapshotInfo -> DiskSnapshotInfo -> Bool
$c== :: DiskSnapshotInfo -> DiskSnapshotInfo -> Bool
Prelude.Eq, ReadPrec [DiskSnapshotInfo]
ReadPrec DiskSnapshotInfo
Int -> ReadS DiskSnapshotInfo
ReadS [DiskSnapshotInfo]
(Int -> ReadS DiskSnapshotInfo)
-> ReadS [DiskSnapshotInfo]
-> ReadPrec DiskSnapshotInfo
-> ReadPrec [DiskSnapshotInfo]
-> Read DiskSnapshotInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiskSnapshotInfo]
$creadListPrec :: ReadPrec [DiskSnapshotInfo]
readPrec :: ReadPrec DiskSnapshotInfo
$creadPrec :: ReadPrec DiskSnapshotInfo
readList :: ReadS [DiskSnapshotInfo]
$creadList :: ReadS [DiskSnapshotInfo]
readsPrec :: Int -> ReadS DiskSnapshotInfo
$creadsPrec :: Int -> ReadS DiskSnapshotInfo
Prelude.Read, Int -> DiskSnapshotInfo -> ShowS
[DiskSnapshotInfo] -> ShowS
DiskSnapshotInfo -> String
(Int -> DiskSnapshotInfo -> ShowS)
-> (DiskSnapshotInfo -> String)
-> ([DiskSnapshotInfo] -> ShowS)
-> Show DiskSnapshotInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiskSnapshotInfo] -> ShowS
$cshowList :: [DiskSnapshotInfo] -> ShowS
show :: DiskSnapshotInfo -> String
$cshow :: DiskSnapshotInfo -> String
showsPrec :: Int -> DiskSnapshotInfo -> ShowS
$cshowsPrec :: Int -> DiskSnapshotInfo -> ShowS
Prelude.Show, (forall x. DiskSnapshotInfo -> Rep DiskSnapshotInfo x)
-> (forall x. Rep DiskSnapshotInfo x -> DiskSnapshotInfo)
-> Generic DiskSnapshotInfo
forall x. Rep DiskSnapshotInfo x -> DiskSnapshotInfo
forall x. DiskSnapshotInfo -> Rep DiskSnapshotInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiskSnapshotInfo x -> DiskSnapshotInfo
$cfrom :: forall x. DiskSnapshotInfo -> Rep DiskSnapshotInfo x
Prelude.Generic)

-- |
-- Create a value of 'DiskSnapshotInfo' 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:
--
-- 'sizeInGb', 'diskSnapshotInfo_sizeInGb' - The size of the disk in GB (e.g., @32@).
newDiskSnapshotInfo ::
  DiskSnapshotInfo
newDiskSnapshotInfo :: DiskSnapshotInfo
newDiskSnapshotInfo =
  DiskSnapshotInfo' :: Maybe Int -> DiskSnapshotInfo
DiskSnapshotInfo' {$sel:sizeInGb:DiskSnapshotInfo' :: Maybe Int
sizeInGb = Maybe Int
forall a. Maybe a
Prelude.Nothing}

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

instance Core.FromJSON DiskSnapshotInfo where
  parseJSON :: Value -> Parser DiskSnapshotInfo
parseJSON =
    String
-> (Object -> Parser DiskSnapshotInfo)
-> Value
-> Parser DiskSnapshotInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DiskSnapshotInfo"
      ( \Object
x ->
          Maybe Int -> DiskSnapshotInfo
DiskSnapshotInfo'
            (Maybe Int -> DiskSnapshotInfo)
-> Parser (Maybe Int) -> Parser DiskSnapshotInfo
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
"sizeInGb")
      )

instance Prelude.Hashable DiskSnapshotInfo

instance Prelude.NFData DiskSnapshotInfo