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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.AddOn
import Amazonka.Lightsail.Types.DiskState
import Amazonka.Lightsail.Types.ResourceLocation
import Amazonka.Lightsail.Types.ResourceType
import Amazonka.Lightsail.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a block storage disk.
--
-- /See:/ 'newDisk' smart constructor.
data Disk = Disk'
  { -- | Describes the status of the disk.
    Disk -> Maybe DiskState
state :: Prelude.Maybe DiskState,
    -- | The Lightsail resource type (e.g., @Disk@).
    Disk -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The Amazon Resource Name (ARN) of the disk.
    Disk -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The disk path.
    Disk -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The date when the disk was created.
    Disk -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The AWS Region and Availability Zone where the disk is located.
    Disk -> Maybe ResourceLocation
location :: Prelude.Maybe ResourceLocation,
    -- | The input\/output operations per second (IOPS) of the disk.
    Disk -> Maybe Int
iops :: Prelude.Maybe Prelude.Int,
    -- | A Boolean value indicating whether the disk is attached.
    Disk -> Maybe Bool
isAttached :: Prelude.Maybe Prelude.Bool,
    -- | An array of objects representing the add-ons enabled on the disk.
    Disk -> Maybe [AddOn]
addOns :: Prelude.Maybe [AddOn],
    -- | (Deprecated) The attachment state of the disk.
    --
    -- In releases prior to November 14, 2017, this parameter returned
    -- @attached@ for system disks in the API response. It is now deprecated,
    -- but still included in the response. Use @isAttached@ instead.
    Disk -> Maybe Text
attachmentState :: Prelude.Maybe Prelude.Text,
    -- | The unique name of the disk.
    Disk -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The size of the disk in GB.
    Disk -> Maybe Int
sizeInGb :: Prelude.Maybe Prelude.Int,
    -- | The support code. Include this code in your email to support when you
    -- have questions about an instance or another resource in Lightsail. This
    -- code enables our support team to look up your Lightsail information more
    -- easily.
    Disk -> Maybe Text
supportCode :: Prelude.Maybe Prelude.Text,
    -- | A Boolean value indicating whether this disk is a system disk (has an
    -- operating system loaded on it).
    Disk -> Maybe Bool
isSystemDisk :: Prelude.Maybe Prelude.Bool,
    -- | The resources to which the disk is attached.
    Disk -> Maybe Text
attachedTo :: Prelude.Maybe Prelude.Text,
    -- | (Deprecated) The number of GB in use by the disk.
    --
    -- In releases prior to November 14, 2017, this parameter was not included
    -- in the API response. It is now deprecated.
    Disk -> Maybe Int
gbInUse :: Prelude.Maybe Prelude.Int,
    -- | The tag keys and optional values for the resource. For more information
    -- about tags in Lightsail, see the
    -- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
    Disk -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  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:
--
-- 'state', 'disk_state' - Describes the status of the disk.
--
-- 'resourceType', 'disk_resourceType' - The Lightsail resource type (e.g., @Disk@).
--
-- 'arn', 'disk_arn' - The Amazon Resource Name (ARN) of the disk.
--
-- 'path', 'disk_path' - The disk path.
--
-- 'createdAt', 'disk_createdAt' - The date when the disk was created.
--
-- 'location', 'disk_location' - The AWS Region and Availability Zone where the disk is located.
--
-- 'iops', 'disk_iops' - The input\/output operations per second (IOPS) of the disk.
--
-- 'isAttached', 'disk_isAttached' - A Boolean value indicating whether the disk is attached.
--
-- 'addOns', 'disk_addOns' - An array of objects representing the add-ons enabled on the disk.
--
-- 'attachmentState', 'disk_attachmentState' - (Deprecated) The attachment state of the disk.
--
-- In releases prior to November 14, 2017, this parameter returned
-- @attached@ for system disks in the API response. It is now deprecated,
-- but still included in the response. Use @isAttached@ instead.
--
-- 'name', 'disk_name' - The unique name of the disk.
--
-- 'sizeInGb', 'disk_sizeInGb' - The size of the disk in GB.
--
-- 'supportCode', 'disk_supportCode' - The support code. Include this code in your email to support when you
-- have questions about an instance or another resource in Lightsail. This
-- code enables our support team to look up your Lightsail information more
-- easily.
--
-- 'isSystemDisk', 'disk_isSystemDisk' - A Boolean value indicating whether this disk is a system disk (has an
-- operating system loaded on it).
--
-- 'attachedTo', 'disk_attachedTo' - The resources to which the disk is attached.
--
-- 'gbInUse', 'disk_gbInUse' - (Deprecated) The number of GB in use by the disk.
--
-- In releases prior to November 14, 2017, this parameter was not included
-- in the API response. It is now deprecated.
--
-- 'tags', 'disk_tags' - The tag keys and optional values for the resource. For more information
-- about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
newDisk ::
  Disk
newDisk :: Disk
newDisk =
  Disk' :: Maybe DiskState
-> Maybe ResourceType
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceLocation
-> Maybe Int
-> Maybe Bool
-> Maybe [AddOn]
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe [Tag]
-> Disk
Disk'
    { $sel:state:Disk' :: Maybe DiskState
state = Maybe DiskState
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:Disk' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Disk' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:path:Disk' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Disk' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:location:Disk' :: Maybe ResourceLocation
location = Maybe ResourceLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:iops:Disk' :: Maybe Int
iops = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:isAttached:Disk' :: Maybe Bool
isAttached = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:addOns:Disk' :: Maybe [AddOn]
addOns = Maybe [AddOn]
forall a. Maybe a
Prelude.Nothing,
      $sel:attachmentState:Disk' :: Maybe Text
attachmentState = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Disk' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sizeInGb:Disk' :: Maybe Int
sizeInGb = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:supportCode:Disk' :: Maybe Text
supportCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isSystemDisk:Disk' :: Maybe Bool
isSystemDisk = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:attachedTo:Disk' :: Maybe Text
attachedTo = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gbInUse:Disk' :: Maybe Int
gbInUse = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Disk' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the status of the disk.
disk_state :: Lens.Lens' Disk (Prelude.Maybe DiskState)
disk_state :: (Maybe DiskState -> f (Maybe DiskState)) -> Disk -> f Disk
disk_state = (Disk -> Maybe DiskState)
-> (Disk -> Maybe DiskState -> Disk)
-> Lens Disk Disk (Maybe DiskState) (Maybe DiskState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe DiskState
state :: Maybe DiskState
$sel:state:Disk' :: Disk -> Maybe DiskState
state} -> Maybe DiskState
state) (\s :: Disk
s@Disk' {} Maybe DiskState
a -> Disk
s {$sel:state:Disk' :: Maybe DiskState
state = Maybe DiskState
a} :: Disk)

-- | The Lightsail resource type (e.g., @Disk@).
disk_resourceType :: Lens.Lens' Disk (Prelude.Maybe ResourceType)
disk_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType)) -> Disk -> f Disk
disk_resourceType = (Disk -> Maybe ResourceType)
-> (Disk -> Maybe ResourceType -> Disk)
-> Lens Disk Disk (Maybe ResourceType) (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:Disk' :: Disk -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: Disk
s@Disk' {} Maybe ResourceType
a -> Disk
s {$sel:resourceType:Disk' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: Disk)

-- | The Amazon Resource Name (ARN) of the disk.
disk_arn :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_arn :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_arn = (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
arn :: Maybe Text
$sel:arn:Disk' :: Disk -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:arn:Disk' :: Maybe Text
arn = Maybe Text
a} :: Disk)

-- | The disk path.
disk_path :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_path :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_path = (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
path :: Maybe Text
$sel:path:Disk' :: Disk -> Maybe Text
path} -> Maybe Text
path) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:path:Disk' :: Maybe Text
path = Maybe Text
a} :: Disk)

-- | The date when the disk was created.
disk_createdAt :: Lens.Lens' Disk (Prelude.Maybe Prelude.UTCTime)
disk_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Disk -> f Disk
disk_createdAt = (Disk -> Maybe POSIX)
-> (Disk -> Maybe POSIX -> Disk)
-> Lens Disk Disk (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Disk' :: Disk -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Disk
s@Disk' {} Maybe POSIX
a -> Disk
s {$sel:createdAt:Disk' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Disk) ((Maybe POSIX -> f (Maybe POSIX)) -> Disk -> f Disk)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Disk
-> f Disk
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The AWS Region and Availability Zone where the disk is located.
disk_location :: Lens.Lens' Disk (Prelude.Maybe ResourceLocation)
disk_location :: (Maybe ResourceLocation -> f (Maybe ResourceLocation))
-> Disk -> f Disk
disk_location = (Disk -> Maybe ResourceLocation)
-> (Disk -> Maybe ResourceLocation -> Disk)
-> Lens Disk Disk (Maybe ResourceLocation) (Maybe ResourceLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe ResourceLocation
location :: Maybe ResourceLocation
$sel:location:Disk' :: Disk -> Maybe ResourceLocation
location} -> Maybe ResourceLocation
location) (\s :: Disk
s@Disk' {} Maybe ResourceLocation
a -> Disk
s {$sel:location:Disk' :: Maybe ResourceLocation
location = Maybe ResourceLocation
a} :: Disk)

-- | The input\/output operations per second (IOPS) of the disk.
disk_iops :: Lens.Lens' Disk (Prelude.Maybe Prelude.Int)
disk_iops :: (Maybe Int -> f (Maybe Int)) -> Disk -> f Disk
disk_iops = (Disk -> Maybe Int)
-> (Disk -> Maybe Int -> Disk)
-> Lens Disk Disk (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Int
iops :: Maybe Int
$sel:iops:Disk' :: Disk -> Maybe Int
iops} -> Maybe Int
iops) (\s :: Disk
s@Disk' {} Maybe Int
a -> Disk
s {$sel:iops:Disk' :: Maybe Int
iops = Maybe Int
a} :: Disk)

-- | A Boolean value indicating whether the disk is attached.
disk_isAttached :: Lens.Lens' Disk (Prelude.Maybe Prelude.Bool)
disk_isAttached :: (Maybe Bool -> f (Maybe Bool)) -> Disk -> f Disk
disk_isAttached = (Disk -> Maybe Bool)
-> (Disk -> Maybe Bool -> Disk)
-> Lens Disk Disk (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Bool
isAttached :: Maybe Bool
$sel:isAttached:Disk' :: Disk -> Maybe Bool
isAttached} -> Maybe Bool
isAttached) (\s :: Disk
s@Disk' {} Maybe Bool
a -> Disk
s {$sel:isAttached:Disk' :: Maybe Bool
isAttached = Maybe Bool
a} :: Disk)

-- | An array of objects representing the add-ons enabled on the disk.
disk_addOns :: Lens.Lens' Disk (Prelude.Maybe [AddOn])
disk_addOns :: (Maybe [AddOn] -> f (Maybe [AddOn])) -> Disk -> f Disk
disk_addOns = (Disk -> Maybe [AddOn])
-> (Disk -> Maybe [AddOn] -> Disk)
-> Lens Disk Disk (Maybe [AddOn]) (Maybe [AddOn])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe [AddOn]
addOns :: Maybe [AddOn]
$sel:addOns:Disk' :: Disk -> Maybe [AddOn]
addOns} -> Maybe [AddOn]
addOns) (\s :: Disk
s@Disk' {} Maybe [AddOn]
a -> Disk
s {$sel:addOns:Disk' :: Maybe [AddOn]
addOns = Maybe [AddOn]
a} :: Disk) ((Maybe [AddOn] -> f (Maybe [AddOn])) -> Disk -> f Disk)
-> ((Maybe [AddOn] -> f (Maybe [AddOn]))
    -> Maybe [AddOn] -> f (Maybe [AddOn]))
-> (Maybe [AddOn] -> f (Maybe [AddOn]))
-> Disk
-> f Disk
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AddOn] [AddOn] [AddOn] [AddOn]
-> Iso
     (Maybe [AddOn]) (Maybe [AddOn]) (Maybe [AddOn]) (Maybe [AddOn])
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 [AddOn] [AddOn] [AddOn] [AddOn]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (Deprecated) The attachment state of the disk.
--
-- In releases prior to November 14, 2017, this parameter returned
-- @attached@ for system disks in the API response. It is now deprecated,
-- but still included in the response. Use @isAttached@ instead.
disk_attachmentState :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_attachmentState :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_attachmentState = (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
attachmentState :: Maybe Text
$sel:attachmentState:Disk' :: Disk -> Maybe Text
attachmentState} -> Maybe Text
attachmentState) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:attachmentState:Disk' :: Maybe Text
attachmentState = Maybe Text
a} :: Disk)

-- | The unique name of the disk.
disk_name :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_name :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_name = (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
name :: Maybe Text
$sel:name:Disk' :: Disk -> Maybe Text
name} -> Maybe Text
name) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:name:Disk' :: Maybe Text
name = Maybe Text
a} :: Disk)

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

-- | The support code. Include this code in your email to support when you
-- have questions about an instance or another resource in Lightsail. This
-- code enables our support team to look up your Lightsail information more
-- easily.
disk_supportCode :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_supportCode :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_supportCode = (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
supportCode :: Maybe Text
$sel:supportCode:Disk' :: Disk -> Maybe Text
supportCode} -> Maybe Text
supportCode) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:supportCode:Disk' :: Maybe Text
supportCode = Maybe Text
a} :: Disk)

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

-- | The resources to which the disk is attached.
disk_attachedTo :: Lens.Lens' Disk (Prelude.Maybe Prelude.Text)
disk_attachedTo :: (Maybe Text -> f (Maybe Text)) -> Disk -> f Disk
disk_attachedTo = (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
attachedTo :: Maybe Text
$sel:attachedTo:Disk' :: Disk -> Maybe Text
attachedTo} -> Maybe Text
attachedTo) (\s :: Disk
s@Disk' {} Maybe Text
a -> Disk
s {$sel:attachedTo:Disk' :: Maybe Text
attachedTo = Maybe Text
a} :: Disk)

-- | (Deprecated) The number of GB in use by the disk.
--
-- In releases prior to November 14, 2017, this parameter was not included
-- in the API response. It is now deprecated.
disk_gbInUse :: Lens.Lens' Disk (Prelude.Maybe Prelude.Int)
disk_gbInUse :: (Maybe Int -> f (Maybe Int)) -> Disk -> f Disk
disk_gbInUse = (Disk -> Maybe Int)
-> (Disk -> Maybe Int -> Disk)
-> Lens Disk Disk (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe Int
gbInUse :: Maybe Int
$sel:gbInUse:Disk' :: Disk -> Maybe Int
gbInUse} -> Maybe Int
gbInUse) (\s :: Disk
s@Disk' {} Maybe Int
a -> Disk
s {$sel:gbInUse:Disk' :: Maybe Int
gbInUse = Maybe Int
a} :: Disk)

-- | The tag keys and optional values for the resource. For more information
-- about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
disk_tags :: Lens.Lens' Disk (Prelude.Maybe [Tag])
disk_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> Disk -> f Disk
disk_tags = (Disk -> Maybe [Tag])
-> (Disk -> Maybe [Tag] -> Disk)
-> Lens Disk Disk (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Disk' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Disk' :: Disk -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Disk
s@Disk' {} Maybe [Tag]
a -> Disk
s {$sel:tags:Disk' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Disk) ((Maybe [Tag] -> f (Maybe [Tag])) -> Disk -> f Disk)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> Disk
-> f Disk
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
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 DiskState
-> Maybe ResourceType
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceLocation
-> Maybe Int
-> Maybe Bool
-> Maybe [AddOn]
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe [Tag]
-> Disk
Disk'
            (Maybe DiskState
 -> Maybe ResourceType
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe ResourceLocation
 -> Maybe Int
 -> Maybe Bool
 -> Maybe [AddOn]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Int
 -> Maybe [Tag]
 -> Disk)
-> Parser (Maybe DiskState)
-> Parser
     (Maybe ResourceType
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe Int
      -> Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DiskState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe ResourceType
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe Int
   -> Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe ResourceType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe Int
      -> Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe Int
   -> Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe Int
      -> Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> 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
"arn")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe Int
   -> Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe ResourceLocation
      -> Maybe Int
      -> Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> 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
"path")
            Parser
  (Maybe POSIX
   -> Maybe ResourceLocation
   -> Maybe Int
   -> Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ResourceLocation
      -> Maybe Int
      -> Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe ResourceLocation
   -> Maybe Int
   -> Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe ResourceLocation)
-> Parser
     (Maybe Int
      -> Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"location")
            Parser
  (Maybe Int
   -> Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
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
"iops")
            Parser
  (Maybe Bool
   -> Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [AddOn]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
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
"isAttached")
            Parser
  (Maybe [AddOn]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe [AddOn])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> Disk)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AddOn]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"addOns" Parser (Maybe (Maybe [AddOn]))
-> Maybe [AddOn] -> Parser (Maybe [AddOn])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AddOn]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> 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
"attachmentState")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Int
      -> Maybe [Tag]
      -> 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
"name")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Int
   -> Maybe [Tag]
   -> Disk)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe Text -> Maybe Int -> Maybe [Tag] -> Disk)
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 Text
   -> Maybe Bool -> Maybe Text -> Maybe Int -> Maybe [Tag] -> Disk)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Int -> Maybe [Tag] -> 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
"supportCode")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Int -> Maybe [Tag] -> Disk)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Int -> Maybe [Tag] -> Disk)
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")
            Parser (Maybe Text -> Maybe Int -> Maybe [Tag] -> Disk)
-> Parser (Maybe Text) -> Parser (Maybe Int -> Maybe [Tag] -> 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
"attachedTo")
            Parser (Maybe Int -> Maybe [Tag] -> Disk)
-> Parser (Maybe Int) -> Parser (Maybe [Tag] -> Disk)
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
"gbInUse")
            Parser (Maybe [Tag] -> Disk) -> Parser (Maybe [Tag]) -> Parser Disk
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe [Tag])) -> Maybe [Tag] -> Parser (Maybe [Tag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Disk

instance Prelude.NFData Disk