{-# 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.StorageGateway.Types.Disk
-- 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.StorageGateway.Types.Disk where

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

-- | Represents a gateway\'s local disk.
--
-- /See:/ 'newDisk' smart constructor.
data Disk = Disk'
  { -- | The iSCSI qualified name (IQN) that is defined for a disk. This field is
    -- not included in the response if the local disk is not defined as an
    -- iSCSI target. The format of this field is
    -- /targetIqn::LUNNumber::region-volumeId/.
    Disk -> Maybe Text
diskAllocationResource :: Prelude.Maybe Prelude.Text,
    Disk -> Maybe Text
diskAllocationType :: Prelude.Maybe Prelude.Text,
    -- | The device node of a local disk as assigned by the virtualization
    -- environment.
    Disk -> Maybe Text
diskNode :: Prelude.Maybe Prelude.Text,
    -- | The path of a local disk in the gateway virtual machine (VM).
    Disk -> Maybe Text
diskPath :: Prelude.Maybe Prelude.Text,
    -- | The local disk size in bytes.
    Disk -> Maybe Integer
diskSizeInBytes :: Prelude.Maybe Prelude.Integer,
    -- | A value that represents the status of a local disk.
    Disk -> Maybe Text
diskStatus :: Prelude.Maybe Prelude.Text,
    -- | The unique device ID or other distinguishing data that identifies a
    -- local disk.
    Disk -> Maybe Text
diskId :: Prelude.Maybe Prelude.Text,
    Disk -> Maybe [Text]
diskAttributeList :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Disk -> Disk -> Bool
(Disk -> Disk -> Bool) -> (Disk -> Disk -> Bool) -> Eq Disk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Disk -> Disk -> Bool
$c/= :: Disk -> Disk -> Bool
== :: Disk -> Disk -> Bool
$c== :: Disk -> Disk -> Bool
Prelude.Eq, ReadPrec [Disk]
ReadPrec Disk
Int -> ReadS Disk
ReadS [Disk]
(Int -> ReadS Disk)
-> ReadS [Disk] -> ReadPrec Disk -> ReadPrec [Disk] -> Read Disk
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Disk]
$creadListPrec :: ReadPrec [Disk]
readPrec :: ReadPrec Disk
$creadPrec :: ReadPrec Disk
readList :: ReadS [Disk]
$creadList :: ReadS [Disk]
readsPrec :: Int -> ReadS Disk
$creadsPrec :: Int -> ReadS Disk
Prelude.Read, Int -> Disk -> ShowS
[Disk] -> ShowS
Disk -> String
(Int -> Disk -> ShowS)
-> (Disk -> String) -> ([Disk] -> ShowS) -> Show Disk
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Disk] -> ShowS
$cshowList :: [Disk] -> ShowS
show :: Disk -> String
$cshow :: Disk -> String
showsPrec :: Int -> Disk -> ShowS
$cshowsPrec :: Int -> Disk -> ShowS
Prelude.Show, (forall x. Disk -> Rep Disk x)
-> (forall x. Rep Disk x -> Disk) -> Generic Disk
forall x. Rep Disk x -> Disk
forall x. Disk -> Rep Disk x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Disk x -> Disk
$cfrom :: forall x. Disk -> Rep Disk x
Prelude.Generic)

-- |
-- Create a value of 'Disk' 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:
--
-- 'diskAllocationResource', 'disk_diskAllocationResource' - The iSCSI qualified name (IQN) that is defined for a disk. This field is
-- not included in the response if the local disk is not defined as an
-- iSCSI target. The format of this field is
-- /targetIqn::LUNNumber::region-volumeId/.
--
-- 'diskAllocationType', 'disk_diskAllocationType' - Undocumented member.
--
-- 'diskNode', 'disk_diskNode' - The device node of a local disk as assigned by the virtualization
-- environment.
--
-- 'diskPath', 'disk_diskPath' - The path of a local disk in the gateway virtual machine (VM).
--
-- 'diskSizeInBytes', 'disk_diskSizeInBytes' - The local disk size in bytes.
--
-- 'diskStatus', 'disk_diskStatus' - A value that represents the status of a local disk.
--
-- 'diskId', 'disk_diskId' - The unique device ID or other distinguishing data that identifies a
-- local disk.
--
-- 'diskAttributeList', 'disk_diskAttributeList' - Undocumented member.
newDisk ::
  Disk
newDisk :: Disk
newDisk =
  Disk' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Disk
Disk'
    { $sel:diskAllocationResource:Disk' :: Maybe Text
diskAllocationResource = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskAllocationType:Disk' :: Maybe Text
diskAllocationType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskNode:Disk' :: Maybe Text
diskNode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskPath:Disk' :: Maybe Text
diskPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskSizeInBytes:Disk' :: Maybe Integer
diskSizeInBytes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:diskStatus:Disk' :: Maybe Text
diskStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskId:Disk' :: Maybe Text
diskId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskAttributeList:Disk' :: Maybe [Text]
diskAttributeList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The iSCSI qualified name (IQN) that is defined for a disk. This field is
-- not included in the response if the local disk is not defined as an
-- iSCSI target. The format of this field is
-- /targetIqn::LUNNumber::region-volumeId/.
disk_diskAllocationResource :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_diskAllocationResource :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_diskAllocationResource = (Disk -> Maybe Text)
-> (Disk -> Maybe Text -> Disk)
-> Lens Disk Disk (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Text
diskAllocationResource :: Maybe Text
$sel:diskAllocationResource:Disk' :: Disk -> Maybe Text
diskAllocationResource} -> Maybe Text
diskAllocationResource) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:diskAllocationResource:Disk' :: Maybe Text
diskAllocationResource = Maybe Text
a} :: Disk)

-- | Undocumented member.
disk_diskAllocationType :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_diskAllocationType :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_diskAllocationType = (Disk -> Maybe Text)
-> (Disk -> Maybe Text -> Disk)
-> Lens Disk Disk (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Text
diskAllocationType :: Maybe Text
$sel:diskAllocationType:Disk' :: Disk -> Maybe Text
diskAllocationType} -> Maybe Text
diskAllocationType) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:diskAllocationType:Disk' :: Maybe Text
diskAllocationType = Maybe Text
a} :: Disk)

-- | The device node of a local disk as assigned by the virtualization
-- environment.
disk_diskNode :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_diskNode :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_diskNode = (Disk -> Maybe Text)
-> (Disk -> Maybe Text -> Disk)
-> Lens Disk Disk (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Text
diskNode :: Maybe Text
$sel:diskNode:Disk' :: Disk -> Maybe Text
diskNode} -> Maybe Text
diskNode) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:diskNode:Disk' :: Maybe Text
diskNode = Maybe Text
a} :: Disk)

-- | The path of a local disk in the gateway virtual machine (VM).
disk_diskPath :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_diskPath :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_diskPath = (Disk -> Maybe Text)
-> (Disk -> Maybe Text -> Disk)
-> Lens Disk Disk (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Text
diskPath :: Maybe Text
$sel:diskPath:Disk' :: Disk -> Maybe Text
diskPath} -> Maybe Text
diskPath) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:diskPath:Disk' :: Maybe Text
diskPath = Maybe Text
a} :: Disk)

-- | The local disk size in bytes.
disk_diskSizeInBytes :: Lens.Lens' Disk (Prelude.Maybe Prelude.Integer)
disk_diskSizeInBytes :: (Maybe Integer -> f (Maybe Integer)) -> Disk -> f Disk
disk_diskSizeInBytes = (Disk -> Maybe Integer)
-> (Disk -> Maybe Integer -> Disk)
-> Lens Disk Disk (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Integer
diskSizeInBytes :: Maybe Integer
$sel:diskSizeInBytes:Disk' :: Disk -> Maybe Integer
diskSizeInBytes} -> Maybe Integer
diskSizeInBytes) (\s :: Disk
s@Disk' {} Maybe Integer
a -> Disk
s {$sel:diskSizeInBytes:Disk' :: Maybe Integer
diskSizeInBytes = Maybe Integer
a} :: Disk)

-- | A value that represents the status of a local disk.
disk_diskStatus :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_diskStatus :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_diskStatus = (Disk -> Maybe Text)
-> (Disk -> Maybe Text -> Disk)
-> Lens Disk Disk (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Text
diskStatus :: Maybe Text
$sel:diskStatus:Disk' :: Disk -> Maybe Text
diskStatus} -> Maybe Text
diskStatus) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:diskStatus:Disk' :: Maybe Text
diskStatus = Maybe Text
a} :: Disk)

-- | The unique device ID or other distinguishing data that identifies a
-- local disk.
disk_diskId :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_diskId :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_diskId = (Disk -> Maybe Text)
-> (Disk -> Maybe Text -> Disk)
-> Lens Disk Disk (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Text
diskId :: Maybe Text
$sel:diskId:Disk' :: Disk -> Maybe Text
diskId} -> Maybe Text
diskId) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:diskId:Disk' :: Maybe Text
diskId = Maybe Text
a} :: Disk)

-- | Undocumented member.
disk_diskAttributeList :: Lens.Lens' Disk (Prelude.Maybe [Prelude.Text])
disk_diskAttributeList :: (Maybe [Text] -> f (Maybe [Text])) -> Disk -> f Disk
disk_diskAttributeList = (Disk -> Maybe [Text])
-> (Disk -> Maybe [Text] -> Disk)
-> Lens Disk Disk (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe [Text]
diskAttributeList :: Maybe [Text]
$sel:diskAttributeList:Disk' :: Disk -> Maybe [Text]
diskAttributeList} -> Maybe [Text]
diskAttributeList) (\s :: Disk
s@Disk' {} Maybe [Text]
a -> Disk
s {$sel:diskAttributeList:Disk' :: Maybe [Text]
diskAttributeList = Maybe [Text]
a} :: Disk) ((Maybe [Text] -> f (Maybe [Text])) -> Disk -> f Disk)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Disk
-> f Disk
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Disk where
  parseJSON :: Value -> Parser Disk
parseJSON =
    String -> (Object -> Parser Disk) -> Value -> Parser Disk
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Disk"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Disk
Disk'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Disk)
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
"DiskAllocationResource")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Disk)
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
"DiskAllocationType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Disk)
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
"DiskNode")
            Parser
  (Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer -> Maybe Text -> Maybe Text -> Maybe [Text] -> Disk)
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
"DiskPath")
            Parser
  (Maybe Integer -> Maybe Text -> Maybe Text -> Maybe [Text] -> Disk)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> Maybe Text -> Maybe [Text] -> Disk)
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
"DiskSizeInBytes")
            Parser (Maybe Text -> Maybe Text -> Maybe [Text] -> Disk)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Text] -> Disk)
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
"DiskStatus")
            Parser (Maybe Text -> Maybe [Text] -> Disk)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> Disk)
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
"DiskId")
            Parser (Maybe [Text] -> Disk)
-> Parser (Maybe [Text]) -> Parser Disk
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DiskAttributeList"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Disk

instance Prelude.NFData Disk