{-# 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.SnowDeviceManagement.Types.Capacity
-- 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.SnowDeviceManagement.Types.Capacity 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

-- | The physical capacity of the Amazon Web Services Snow Family device.
--
-- /See:/ 'newCapacity' smart constructor.
data Capacity = Capacity'
  { -- | The amount of capacity available for use on the device.
    Capacity -> Maybe Integer
available :: Prelude.Maybe Prelude.Integer,
    -- | The name of the type of capacity, such as memory.
    Capacity -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The total capacity on the device.
    Capacity -> Maybe Integer
total :: Prelude.Maybe Prelude.Integer,
    -- | The unit of measure for the type of capacity.
    Capacity -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
    -- | The amount of capacity used on the device.
    Capacity -> Maybe Integer
used :: Prelude.Maybe Prelude.Integer
  }
  deriving (Capacity -> Capacity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Capacity -> Capacity -> Bool
$c/= :: Capacity -> Capacity -> Bool
== :: Capacity -> Capacity -> Bool
$c== :: Capacity -> Capacity -> Bool
Prelude.Eq, ReadPrec [Capacity]
ReadPrec Capacity
Int -> ReadS Capacity
ReadS [Capacity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Capacity]
$creadListPrec :: ReadPrec [Capacity]
readPrec :: ReadPrec Capacity
$creadPrec :: ReadPrec Capacity
readList :: ReadS [Capacity]
$creadList :: ReadS [Capacity]
readsPrec :: Int -> ReadS Capacity
$creadsPrec :: Int -> ReadS Capacity
Prelude.Read, Int -> Capacity -> ShowS
[Capacity] -> ShowS
Capacity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Capacity] -> ShowS
$cshowList :: [Capacity] -> ShowS
show :: Capacity -> String
$cshow :: Capacity -> String
showsPrec :: Int -> Capacity -> ShowS
$cshowsPrec :: Int -> Capacity -> ShowS
Prelude.Show, forall x. Rep Capacity x -> Capacity
forall x. Capacity -> Rep Capacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Capacity x -> Capacity
$cfrom :: forall x. Capacity -> Rep Capacity x
Prelude.Generic)

-- |
-- Create a value of 'Capacity' 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:
--
-- 'available', 'capacity_available' - The amount of capacity available for use on the device.
--
-- 'name', 'capacity_name' - The name of the type of capacity, such as memory.
--
-- 'total', 'capacity_total' - The total capacity on the device.
--
-- 'unit', 'capacity_unit' - The unit of measure for the type of capacity.
--
-- 'used', 'capacity_used' - The amount of capacity used on the device.
newCapacity ::
  Capacity
newCapacity :: Capacity
newCapacity =
  Capacity'
    { $sel:available:Capacity' :: Maybe Integer
available = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Capacity' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:total:Capacity' :: Maybe Integer
total = forall a. Maybe a
Prelude.Nothing,
      $sel:unit:Capacity' :: Maybe Text
unit = forall a. Maybe a
Prelude.Nothing,
      $sel:used:Capacity' :: Maybe Integer
used = forall a. Maybe a
Prelude.Nothing
    }

-- | The amount of capacity available for use on the device.
capacity_available :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Integer)
capacity_available :: Lens' Capacity (Maybe Integer)
capacity_available = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Integer
available :: Maybe Integer
$sel:available:Capacity' :: Capacity -> Maybe Integer
available} -> Maybe Integer
available) (\s :: Capacity
s@Capacity' {} Maybe Integer
a -> Capacity
s {$sel:available:Capacity' :: Maybe Integer
available = Maybe Integer
a} :: Capacity)

-- | The name of the type of capacity, such as memory.
capacity_name :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Text)
capacity_name :: Lens' Capacity (Maybe Text)
capacity_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Text
name :: Maybe Text
$sel:name:Capacity' :: Capacity -> Maybe Text
name} -> Maybe Text
name) (\s :: Capacity
s@Capacity' {} Maybe Text
a -> Capacity
s {$sel:name:Capacity' :: Maybe Text
name = Maybe Text
a} :: Capacity)

-- | The total capacity on the device.
capacity_total :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Integer)
capacity_total :: Lens' Capacity (Maybe Integer)
capacity_total = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Integer
total :: Maybe Integer
$sel:total:Capacity' :: Capacity -> Maybe Integer
total} -> Maybe Integer
total) (\s :: Capacity
s@Capacity' {} Maybe Integer
a -> Capacity
s {$sel:total:Capacity' :: Maybe Integer
total = Maybe Integer
a} :: Capacity)

-- | The unit of measure for the type of capacity.
capacity_unit :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Text)
capacity_unit :: Lens' Capacity (Maybe Text)
capacity_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Text
unit :: Maybe Text
$sel:unit:Capacity' :: Capacity -> Maybe Text
unit} -> Maybe Text
unit) (\s :: Capacity
s@Capacity' {} Maybe Text
a -> Capacity
s {$sel:unit:Capacity' :: Maybe Text
unit = Maybe Text
a} :: Capacity)

-- | The amount of capacity used on the device.
capacity_used :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Integer)
capacity_used :: Lens' Capacity (Maybe Integer)
capacity_used = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Integer
used :: Maybe Integer
$sel:used:Capacity' :: Capacity -> Maybe Integer
used} -> Maybe Integer
used) (\s :: Capacity
s@Capacity' {} Maybe Integer
a -> Capacity
s {$sel:used:Capacity' :: Maybe Integer
used = Maybe Integer
a} :: Capacity)

instance Data.FromJSON Capacity where
  parseJSON :: Value -> Parser Capacity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Capacity"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Capacity
Capacity'
            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
"available")
            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
"name")
            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
"total")
            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
"unit")
            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
"used")
      )

instance Prelude.Hashable Capacity where
  hashWithSalt :: Int -> Capacity -> Int
hashWithSalt Int
_salt Capacity' {Maybe Integer
Maybe Text
used :: Maybe Integer
unit :: Maybe Text
total :: Maybe Integer
name :: Maybe Text
available :: Maybe Integer
$sel:used:Capacity' :: Capacity -> Maybe Integer
$sel:unit:Capacity' :: Capacity -> Maybe Text
$sel:total:Capacity' :: Capacity -> Maybe Integer
$sel:name:Capacity' :: Capacity -> Maybe Text
$sel:available:Capacity' :: Capacity -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
available
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
total
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
used

instance Prelude.NFData Capacity where
  rnf :: Capacity -> ()
rnf Capacity' {Maybe Integer
Maybe Text
used :: Maybe Integer
unit :: Maybe Text
total :: Maybe Integer
name :: Maybe Text
available :: Maybe Integer
$sel:used:Capacity' :: Capacity -> Maybe Integer
$sel:unit:Capacity' :: Capacity -> Maybe Text
$sel:total:Capacity' :: Capacity -> Maybe Integer
$sel:name:Capacity' :: Capacity -> Maybe Text
$sel:available:Capacity' :: Capacity -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
available
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
total
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
used