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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 used on the device.
    Capacity -> Maybe Integer
used :: 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 available for use on the device.
    Capacity -> Maybe Integer
available :: Prelude.Maybe Prelude.Integer
  }
  deriving (Capacity -> Capacity -> Bool
(Capacity -> Capacity -> Bool)
-> (Capacity -> Capacity -> Bool) -> Eq Capacity
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]
(Int -> ReadS Capacity)
-> ReadS [Capacity]
-> ReadPrec Capacity
-> ReadPrec [Capacity]
-> Read 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
(Int -> Capacity -> ShowS)
-> (Capacity -> String) -> ([Capacity] -> ShowS) -> Show Capacity
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. Capacity -> Rep Capacity x)
-> (forall x. Rep Capacity x -> Capacity) -> Generic Capacity
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:
--
-- 'used', 'capacity_used' - The amount of capacity used 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.
--
-- 'available', 'capacity_available' - The amount of capacity available for use on the device.
newCapacity ::
  Capacity
newCapacity :: Capacity
newCapacity =
  Capacity' :: Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Capacity
Capacity'
    { $sel:used:Capacity' :: Maybe Integer
used = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Capacity' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:total:Capacity' :: Maybe Integer
total = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:unit:Capacity' :: Maybe Text
unit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:available:Capacity' :: Maybe Integer
available = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The amount of capacity used on the device.
capacity_used :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Integer)
capacity_used :: (Maybe Integer -> f (Maybe Integer)) -> Capacity -> f Capacity
capacity_used = (Capacity -> Maybe Integer)
-> (Capacity -> Maybe Integer -> Capacity)
-> Lens Capacity Capacity (Maybe Integer) (Maybe Integer)
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)

-- | The name of the type of capacity, such as memory.
capacity_name :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Text)
capacity_name :: (Maybe Text -> f (Maybe Text)) -> Capacity -> f Capacity
capacity_name = (Capacity -> Maybe Text)
-> (Capacity -> Maybe Text -> Capacity)
-> Lens Capacity Capacity (Maybe Text) (Maybe Text)
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 :: (Maybe Integer -> f (Maybe Integer)) -> Capacity -> f Capacity
capacity_total = (Capacity -> Maybe Integer)
-> (Capacity -> Maybe Integer -> Capacity)
-> Lens Capacity Capacity (Maybe Integer) (Maybe Integer)
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 :: (Maybe Text -> f (Maybe Text)) -> Capacity -> f Capacity
capacity_unit = (Capacity -> Maybe Text)
-> (Capacity -> Maybe Text -> Capacity)
-> Lens Capacity Capacity (Maybe Text) (Maybe Text)
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 available for use on the device.
capacity_available :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Integer)
capacity_available :: (Maybe Integer -> f (Maybe Integer)) -> Capacity -> f Capacity
capacity_available = (Capacity -> Maybe Integer)
-> (Capacity -> Maybe Integer -> Capacity)
-> Lens Capacity Capacity (Maybe Integer) (Maybe Integer)
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)

instance Core.FromJSON Capacity where
  parseJSON :: Value -> Parser Capacity
parseJSON =
    String -> (Object -> Parser Capacity) -> Value -> Parser Capacity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Capacity"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Capacity
Capacity'
            (Maybe Integer
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Integer
 -> Capacity)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text
      -> Maybe Integer -> Maybe Text -> Maybe Integer -> Capacity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"used")
            Parser
  (Maybe Text
   -> Maybe Integer -> Maybe Text -> Maybe Integer -> Capacity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer -> Maybe Text -> Maybe Integer -> Capacity)
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 Integer -> Maybe Text -> Maybe Integer -> Capacity)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> Maybe Integer -> Capacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"total")
            Parser (Maybe Text -> Maybe Integer -> Capacity)
-> Parser (Maybe Text) -> Parser (Maybe Integer -> Capacity)
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
"unit")
            Parser (Maybe Integer -> Capacity)
-> Parser (Maybe Integer) -> Parser Capacity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"available")
      )

instance Prelude.Hashable Capacity

instance Prelude.NFData Capacity