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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.DiskInfo
import qualified Amazonka.Prelude as Prelude

-- | Describes an instance snapshot.
--
-- /See:/ 'newInstanceSnapshotInfo' smart constructor.
data InstanceSnapshotInfo = InstanceSnapshotInfo'
  { -- | The blueprint ID from which the source instance (e.g., @os_debian_8_3@).
    InstanceSnapshotInfo -> Maybe Text
fromBlueprintId :: Prelude.Maybe Prelude.Text,
    -- | The bundle ID from which the source instance was created (e.g.,
    -- @micro_1_0@).
    InstanceSnapshotInfo -> Maybe Text
fromBundleId :: Prelude.Maybe Prelude.Text,
    -- | A list of objects describing the disks that were attached to the source
    -- instance.
    InstanceSnapshotInfo -> Maybe [DiskInfo]
fromDiskInfo :: Prelude.Maybe [DiskInfo]
  }
  deriving (InstanceSnapshotInfo -> InstanceSnapshotInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceSnapshotInfo -> InstanceSnapshotInfo -> Bool
$c/= :: InstanceSnapshotInfo -> InstanceSnapshotInfo -> Bool
== :: InstanceSnapshotInfo -> InstanceSnapshotInfo -> Bool
$c== :: InstanceSnapshotInfo -> InstanceSnapshotInfo -> Bool
Prelude.Eq, ReadPrec [InstanceSnapshotInfo]
ReadPrec InstanceSnapshotInfo
Int -> ReadS InstanceSnapshotInfo
ReadS [InstanceSnapshotInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceSnapshotInfo]
$creadListPrec :: ReadPrec [InstanceSnapshotInfo]
readPrec :: ReadPrec InstanceSnapshotInfo
$creadPrec :: ReadPrec InstanceSnapshotInfo
readList :: ReadS [InstanceSnapshotInfo]
$creadList :: ReadS [InstanceSnapshotInfo]
readsPrec :: Int -> ReadS InstanceSnapshotInfo
$creadsPrec :: Int -> ReadS InstanceSnapshotInfo
Prelude.Read, Int -> InstanceSnapshotInfo -> ShowS
[InstanceSnapshotInfo] -> ShowS
InstanceSnapshotInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceSnapshotInfo] -> ShowS
$cshowList :: [InstanceSnapshotInfo] -> ShowS
show :: InstanceSnapshotInfo -> String
$cshow :: InstanceSnapshotInfo -> String
showsPrec :: Int -> InstanceSnapshotInfo -> ShowS
$cshowsPrec :: Int -> InstanceSnapshotInfo -> ShowS
Prelude.Show, forall x. Rep InstanceSnapshotInfo x -> InstanceSnapshotInfo
forall x. InstanceSnapshotInfo -> Rep InstanceSnapshotInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceSnapshotInfo x -> InstanceSnapshotInfo
$cfrom :: forall x. InstanceSnapshotInfo -> Rep InstanceSnapshotInfo x
Prelude.Generic)

-- |
-- Create a value of 'InstanceSnapshotInfo' 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:
--
-- 'fromBlueprintId', 'instanceSnapshotInfo_fromBlueprintId' - The blueprint ID from which the source instance (e.g., @os_debian_8_3@).
--
-- 'fromBundleId', 'instanceSnapshotInfo_fromBundleId' - The bundle ID from which the source instance was created (e.g.,
-- @micro_1_0@).
--
-- 'fromDiskInfo', 'instanceSnapshotInfo_fromDiskInfo' - A list of objects describing the disks that were attached to the source
-- instance.
newInstanceSnapshotInfo ::
  InstanceSnapshotInfo
newInstanceSnapshotInfo :: InstanceSnapshotInfo
newInstanceSnapshotInfo =
  InstanceSnapshotInfo'
    { $sel:fromBlueprintId:InstanceSnapshotInfo' :: Maybe Text
fromBlueprintId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fromBundleId:InstanceSnapshotInfo' :: Maybe Text
fromBundleId = forall a. Maybe a
Prelude.Nothing,
      $sel:fromDiskInfo:InstanceSnapshotInfo' :: Maybe [DiskInfo]
fromDiskInfo = forall a. Maybe a
Prelude.Nothing
    }

-- | The blueprint ID from which the source instance (e.g., @os_debian_8_3@).
instanceSnapshotInfo_fromBlueprintId :: Lens.Lens' InstanceSnapshotInfo (Prelude.Maybe Prelude.Text)
instanceSnapshotInfo_fromBlueprintId :: Lens' InstanceSnapshotInfo (Maybe Text)
instanceSnapshotInfo_fromBlueprintId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceSnapshotInfo' {Maybe Text
fromBlueprintId :: Maybe Text
$sel:fromBlueprintId:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe Text
fromBlueprintId} -> Maybe Text
fromBlueprintId) (\s :: InstanceSnapshotInfo
s@InstanceSnapshotInfo' {} Maybe Text
a -> InstanceSnapshotInfo
s {$sel:fromBlueprintId:InstanceSnapshotInfo' :: Maybe Text
fromBlueprintId = Maybe Text
a} :: InstanceSnapshotInfo)

-- | The bundle ID from which the source instance was created (e.g.,
-- @micro_1_0@).
instanceSnapshotInfo_fromBundleId :: Lens.Lens' InstanceSnapshotInfo (Prelude.Maybe Prelude.Text)
instanceSnapshotInfo_fromBundleId :: Lens' InstanceSnapshotInfo (Maybe Text)
instanceSnapshotInfo_fromBundleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceSnapshotInfo' {Maybe Text
fromBundleId :: Maybe Text
$sel:fromBundleId:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe Text
fromBundleId} -> Maybe Text
fromBundleId) (\s :: InstanceSnapshotInfo
s@InstanceSnapshotInfo' {} Maybe Text
a -> InstanceSnapshotInfo
s {$sel:fromBundleId:InstanceSnapshotInfo' :: Maybe Text
fromBundleId = Maybe Text
a} :: InstanceSnapshotInfo)

-- | A list of objects describing the disks that were attached to the source
-- instance.
instanceSnapshotInfo_fromDiskInfo :: Lens.Lens' InstanceSnapshotInfo (Prelude.Maybe [DiskInfo])
instanceSnapshotInfo_fromDiskInfo :: Lens' InstanceSnapshotInfo (Maybe [DiskInfo])
instanceSnapshotInfo_fromDiskInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceSnapshotInfo' {Maybe [DiskInfo]
fromDiskInfo :: Maybe [DiskInfo]
$sel:fromDiskInfo:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe [DiskInfo]
fromDiskInfo} -> Maybe [DiskInfo]
fromDiskInfo) (\s :: InstanceSnapshotInfo
s@InstanceSnapshotInfo' {} Maybe [DiskInfo]
a -> InstanceSnapshotInfo
s {$sel:fromDiskInfo:InstanceSnapshotInfo' :: Maybe [DiskInfo]
fromDiskInfo = Maybe [DiskInfo]
a} :: InstanceSnapshotInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON InstanceSnapshotInfo where
  parseJSON :: Value -> Parser InstanceSnapshotInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstanceSnapshotInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe [DiskInfo] -> InstanceSnapshotInfo
InstanceSnapshotInfo'
            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
"fromBlueprintId")
            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
"fromBundleId")
            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
"fromDiskInfo" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable InstanceSnapshotInfo where
  hashWithSalt :: Int -> InstanceSnapshotInfo -> Int
hashWithSalt Int
_salt InstanceSnapshotInfo' {Maybe [DiskInfo]
Maybe Text
fromDiskInfo :: Maybe [DiskInfo]
fromBundleId :: Maybe Text
fromBlueprintId :: Maybe Text
$sel:fromDiskInfo:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe [DiskInfo]
$sel:fromBundleId:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe Text
$sel:fromBlueprintId:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fromBlueprintId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fromBundleId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DiskInfo]
fromDiskInfo

instance Prelude.NFData InstanceSnapshotInfo where
  rnf :: InstanceSnapshotInfo -> ()
rnf InstanceSnapshotInfo' {Maybe [DiskInfo]
Maybe Text
fromDiskInfo :: Maybe [DiskInfo]
fromBundleId :: Maybe Text
fromBlueprintId :: Maybe Text
$sel:fromDiskInfo:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe [DiskInfo]
$sel:fromBundleId:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe Text
$sel:fromBlueprintId:InstanceSnapshotInfo' :: InstanceSnapshotInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fromBlueprintId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fromBundleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DiskInfo]
fromDiskInfo