{-# 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.DrS.Types.SourceProperties
-- 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.DrS.Types.SourceProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DrS.Types.CPU
import Amazonka.DrS.Types.Disk
import Amazonka.DrS.Types.IdentificationHints
import Amazonka.DrS.Types.NetworkInterface
import Amazonka.DrS.Types.OS
import qualified Amazonka.Prelude as Prelude

-- | Properties of the Source Server machine.
--
-- /See:/ 'newSourceProperties' smart constructor.
data SourceProperties = SourceProperties'
  { -- | An array of CPUs.
    SourceProperties -> Maybe [CPU]
cpus :: Prelude.Maybe [CPU],
    -- | An array of disks.
    SourceProperties -> Maybe [Disk]
disks :: Prelude.Maybe [Disk],
    -- | Hints used to uniquely identify a machine.
    SourceProperties -> Maybe IdentificationHints
identificationHints :: Prelude.Maybe IdentificationHints,
    -- | The date and time the Source Properties were last updated on.
    SourceProperties -> Maybe Text
lastUpdatedDateTime :: Prelude.Maybe Prelude.Text,
    -- | An array of network interfaces.
    SourceProperties -> Maybe [NetworkInterface]
networkInterfaces :: Prelude.Maybe [NetworkInterface],
    -- | Operating system.
    SourceProperties -> Maybe OS
os :: Prelude.Maybe OS,
    -- | The amount of RAM in bytes.
    SourceProperties -> Maybe Natural
ramBytes :: Prelude.Maybe Prelude.Natural,
    -- | The recommended EC2 instance type that will be used when recovering the
    -- Source Server.
    SourceProperties -> Maybe Text
recommendedInstanceType :: Prelude.Maybe Prelude.Text
  }
  deriving (SourceProperties -> SourceProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceProperties -> SourceProperties -> Bool
$c/= :: SourceProperties -> SourceProperties -> Bool
== :: SourceProperties -> SourceProperties -> Bool
$c== :: SourceProperties -> SourceProperties -> Bool
Prelude.Eq, ReadPrec [SourceProperties]
ReadPrec SourceProperties
Int -> ReadS SourceProperties
ReadS [SourceProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceProperties]
$creadListPrec :: ReadPrec [SourceProperties]
readPrec :: ReadPrec SourceProperties
$creadPrec :: ReadPrec SourceProperties
readList :: ReadS [SourceProperties]
$creadList :: ReadS [SourceProperties]
readsPrec :: Int -> ReadS SourceProperties
$creadsPrec :: Int -> ReadS SourceProperties
Prelude.Read, Int -> SourceProperties -> ShowS
[SourceProperties] -> ShowS
SourceProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceProperties] -> ShowS
$cshowList :: [SourceProperties] -> ShowS
show :: SourceProperties -> String
$cshow :: SourceProperties -> String
showsPrec :: Int -> SourceProperties -> ShowS
$cshowsPrec :: Int -> SourceProperties -> ShowS
Prelude.Show, forall x. Rep SourceProperties x -> SourceProperties
forall x. SourceProperties -> Rep SourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceProperties x -> SourceProperties
$cfrom :: forall x. SourceProperties -> Rep SourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'SourceProperties' 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:
--
-- 'cpus', 'sourceProperties_cpus' - An array of CPUs.
--
-- 'disks', 'sourceProperties_disks' - An array of disks.
--
-- 'identificationHints', 'sourceProperties_identificationHints' - Hints used to uniquely identify a machine.
--
-- 'lastUpdatedDateTime', 'sourceProperties_lastUpdatedDateTime' - The date and time the Source Properties were last updated on.
--
-- 'networkInterfaces', 'sourceProperties_networkInterfaces' - An array of network interfaces.
--
-- 'os', 'sourceProperties_os' - Operating system.
--
-- 'ramBytes', 'sourceProperties_ramBytes' - The amount of RAM in bytes.
--
-- 'recommendedInstanceType', 'sourceProperties_recommendedInstanceType' - The recommended EC2 instance type that will be used when recovering the
-- Source Server.
newSourceProperties ::
  SourceProperties
newSourceProperties :: SourceProperties
newSourceProperties =
  SourceProperties'
    { $sel:cpus:SourceProperties' :: Maybe [CPU]
cpus = forall a. Maybe a
Prelude.Nothing,
      $sel:disks:SourceProperties' :: Maybe [Disk]
disks = forall a. Maybe a
Prelude.Nothing,
      $sel:identificationHints:SourceProperties' :: Maybe IdentificationHints
identificationHints = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:SourceProperties' :: Maybe Text
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:networkInterfaces:SourceProperties' :: Maybe [NetworkInterface]
networkInterfaces = forall a. Maybe a
Prelude.Nothing,
      $sel:os:SourceProperties' :: Maybe OS
os = forall a. Maybe a
Prelude.Nothing,
      $sel:ramBytes:SourceProperties' :: Maybe Natural
ramBytes = forall a. Maybe a
Prelude.Nothing,
      $sel:recommendedInstanceType:SourceProperties' :: Maybe Text
recommendedInstanceType = forall a. Maybe a
Prelude.Nothing
    }

-- | An array of CPUs.
sourceProperties_cpus :: Lens.Lens' SourceProperties (Prelude.Maybe [CPU])
sourceProperties_cpus :: Lens' SourceProperties (Maybe [CPU])
sourceProperties_cpus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe [CPU]
cpus :: Maybe [CPU]
$sel:cpus:SourceProperties' :: SourceProperties -> Maybe [CPU]
cpus} -> Maybe [CPU]
cpus) (\s :: SourceProperties
s@SourceProperties' {} Maybe [CPU]
a -> SourceProperties
s {$sel:cpus:SourceProperties' :: Maybe [CPU]
cpus = Maybe [CPU]
a} :: SourceProperties) 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

-- | An array of disks.
sourceProperties_disks :: Lens.Lens' SourceProperties (Prelude.Maybe [Disk])
sourceProperties_disks :: Lens' SourceProperties (Maybe [Disk])
sourceProperties_disks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe [Disk]
disks :: Maybe [Disk]
$sel:disks:SourceProperties' :: SourceProperties -> Maybe [Disk]
disks} -> Maybe [Disk]
disks) (\s :: SourceProperties
s@SourceProperties' {} Maybe [Disk]
a -> SourceProperties
s {$sel:disks:SourceProperties' :: Maybe [Disk]
disks = Maybe [Disk]
a} :: SourceProperties) 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

-- | Hints used to uniquely identify a machine.
sourceProperties_identificationHints :: Lens.Lens' SourceProperties (Prelude.Maybe IdentificationHints)
sourceProperties_identificationHints :: Lens' SourceProperties (Maybe IdentificationHints)
sourceProperties_identificationHints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe IdentificationHints
identificationHints :: Maybe IdentificationHints
$sel:identificationHints:SourceProperties' :: SourceProperties -> Maybe IdentificationHints
identificationHints} -> Maybe IdentificationHints
identificationHints) (\s :: SourceProperties
s@SourceProperties' {} Maybe IdentificationHints
a -> SourceProperties
s {$sel:identificationHints:SourceProperties' :: Maybe IdentificationHints
identificationHints = Maybe IdentificationHints
a} :: SourceProperties)

-- | The date and time the Source Properties were last updated on.
sourceProperties_lastUpdatedDateTime :: Lens.Lens' SourceProperties (Prelude.Maybe Prelude.Text)
sourceProperties_lastUpdatedDateTime :: Lens' SourceProperties (Maybe Text)
sourceProperties_lastUpdatedDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe Text
lastUpdatedDateTime :: Maybe Text
$sel:lastUpdatedDateTime:SourceProperties' :: SourceProperties -> Maybe Text
lastUpdatedDateTime} -> Maybe Text
lastUpdatedDateTime) (\s :: SourceProperties
s@SourceProperties' {} Maybe Text
a -> SourceProperties
s {$sel:lastUpdatedDateTime:SourceProperties' :: Maybe Text
lastUpdatedDateTime = Maybe Text
a} :: SourceProperties)

-- | An array of network interfaces.
sourceProperties_networkInterfaces :: Lens.Lens' SourceProperties (Prelude.Maybe [NetworkInterface])
sourceProperties_networkInterfaces :: Lens' SourceProperties (Maybe [NetworkInterface])
sourceProperties_networkInterfaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe [NetworkInterface]
networkInterfaces :: Maybe [NetworkInterface]
$sel:networkInterfaces:SourceProperties' :: SourceProperties -> Maybe [NetworkInterface]
networkInterfaces} -> Maybe [NetworkInterface]
networkInterfaces) (\s :: SourceProperties
s@SourceProperties' {} Maybe [NetworkInterface]
a -> SourceProperties
s {$sel:networkInterfaces:SourceProperties' :: Maybe [NetworkInterface]
networkInterfaces = Maybe [NetworkInterface]
a} :: SourceProperties) 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

-- | Operating system.
sourceProperties_os :: Lens.Lens' SourceProperties (Prelude.Maybe OS)
sourceProperties_os :: Lens' SourceProperties (Maybe OS)
sourceProperties_os = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe OS
os :: Maybe OS
$sel:os:SourceProperties' :: SourceProperties -> Maybe OS
os} -> Maybe OS
os) (\s :: SourceProperties
s@SourceProperties' {} Maybe OS
a -> SourceProperties
s {$sel:os:SourceProperties' :: Maybe OS
os = Maybe OS
a} :: SourceProperties)

-- | The amount of RAM in bytes.
sourceProperties_ramBytes :: Lens.Lens' SourceProperties (Prelude.Maybe Prelude.Natural)
sourceProperties_ramBytes :: Lens' SourceProperties (Maybe Natural)
sourceProperties_ramBytes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe Natural
ramBytes :: Maybe Natural
$sel:ramBytes:SourceProperties' :: SourceProperties -> Maybe Natural
ramBytes} -> Maybe Natural
ramBytes) (\s :: SourceProperties
s@SourceProperties' {} Maybe Natural
a -> SourceProperties
s {$sel:ramBytes:SourceProperties' :: Maybe Natural
ramBytes = Maybe Natural
a} :: SourceProperties)

-- | The recommended EC2 instance type that will be used when recovering the
-- Source Server.
sourceProperties_recommendedInstanceType :: Lens.Lens' SourceProperties (Prelude.Maybe Prelude.Text)
sourceProperties_recommendedInstanceType :: Lens' SourceProperties (Maybe Text)
sourceProperties_recommendedInstanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceProperties' {Maybe Text
recommendedInstanceType :: Maybe Text
$sel:recommendedInstanceType:SourceProperties' :: SourceProperties -> Maybe Text
recommendedInstanceType} -> Maybe Text
recommendedInstanceType) (\s :: SourceProperties
s@SourceProperties' {} Maybe Text
a -> SourceProperties
s {$sel:recommendedInstanceType:SourceProperties' :: Maybe Text
recommendedInstanceType = Maybe Text
a} :: SourceProperties)

instance Data.FromJSON SourceProperties where
  parseJSON :: Value -> Parser SourceProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SourceProperties"
      ( \Object
x ->
          Maybe [CPU]
-> Maybe [Disk]
-> Maybe IdentificationHints
-> Maybe Text
-> Maybe [NetworkInterface]
-> Maybe OS
-> Maybe Natural
-> Maybe Text
-> SourceProperties
SourceProperties'
            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
"cpus" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"disks" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"identificationHints")
            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
"lastUpdatedDateTime")
            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
"networkInterfaces"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"os")
            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
"ramBytes")
            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
"recommendedInstanceType")
      )

instance Prelude.Hashable SourceProperties where
  hashWithSalt :: Int -> SourceProperties -> Int
hashWithSalt Int
_salt SourceProperties' {Maybe Natural
Maybe [CPU]
Maybe [Disk]
Maybe [NetworkInterface]
Maybe Text
Maybe IdentificationHints
Maybe OS
recommendedInstanceType :: Maybe Text
ramBytes :: Maybe Natural
os :: Maybe OS
networkInterfaces :: Maybe [NetworkInterface]
lastUpdatedDateTime :: Maybe Text
identificationHints :: Maybe IdentificationHints
disks :: Maybe [Disk]
cpus :: Maybe [CPU]
$sel:recommendedInstanceType:SourceProperties' :: SourceProperties -> Maybe Text
$sel:ramBytes:SourceProperties' :: SourceProperties -> Maybe Natural
$sel:os:SourceProperties' :: SourceProperties -> Maybe OS
$sel:networkInterfaces:SourceProperties' :: SourceProperties -> Maybe [NetworkInterface]
$sel:lastUpdatedDateTime:SourceProperties' :: SourceProperties -> Maybe Text
$sel:identificationHints:SourceProperties' :: SourceProperties -> Maybe IdentificationHints
$sel:disks:SourceProperties' :: SourceProperties -> Maybe [Disk]
$sel:cpus:SourceProperties' :: SourceProperties -> Maybe [CPU]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CPU]
cpus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Disk]
disks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IdentificationHints
identificationHints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NetworkInterface]
networkInterfaces
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OS
os
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
ramBytes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recommendedInstanceType

instance Prelude.NFData SourceProperties where
  rnf :: SourceProperties -> ()
rnf SourceProperties' {Maybe Natural
Maybe [CPU]
Maybe [Disk]
Maybe [NetworkInterface]
Maybe Text
Maybe IdentificationHints
Maybe OS
recommendedInstanceType :: Maybe Text
ramBytes :: Maybe Natural
os :: Maybe OS
networkInterfaces :: Maybe [NetworkInterface]
lastUpdatedDateTime :: Maybe Text
identificationHints :: Maybe IdentificationHints
disks :: Maybe [Disk]
cpus :: Maybe [CPU]
$sel:recommendedInstanceType:SourceProperties' :: SourceProperties -> Maybe Text
$sel:ramBytes:SourceProperties' :: SourceProperties -> Maybe Natural
$sel:os:SourceProperties' :: SourceProperties -> Maybe OS
$sel:networkInterfaces:SourceProperties' :: SourceProperties -> Maybe [NetworkInterface]
$sel:lastUpdatedDateTime:SourceProperties' :: SourceProperties -> Maybe Text
$sel:identificationHints:SourceProperties' :: SourceProperties -> Maybe IdentificationHints
$sel:disks:SourceProperties' :: SourceProperties -> Maybe [Disk]
$sel:cpus:SourceProperties' :: SourceProperties -> Maybe [CPU]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [CPU]
cpus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Disk]
disks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentificationHints
identificationHints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [NetworkInterface]
networkInterfaces
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OS
os
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
ramBytes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recommendedInstanceType