{-# 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.MGN.Types.ReplicationConfigurationReplicatedDisk
-- 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.MGN.Types.ReplicationConfigurationReplicatedDisk where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types.ReplicationConfigurationReplicatedDiskStagingDiskType
import qualified Amazonka.Prelude as Prelude

-- | Replication Configuration replicated disk.
--
-- /See:/ 'newReplicationConfigurationReplicatedDisk' smart constructor.
data ReplicationConfigurationReplicatedDisk = ReplicationConfigurationReplicatedDisk'
  { -- | Replication Configuration replicated disk staging disk type.
    ReplicationConfigurationReplicatedDisk
-> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType :: Prelude.Maybe ReplicationConfigurationReplicatedDiskStagingDiskType,
    -- | Replication Configuration replicated disk IOPs.
    ReplicationConfigurationReplicatedDisk -> Maybe Natural
iops :: Prelude.Maybe Prelude.Natural,
    -- | Replication Configuration replicated disk boot disk.
    ReplicationConfigurationReplicatedDisk -> Maybe Bool
isBootDisk :: Prelude.Maybe Prelude.Bool,
    -- | Replication Configuration replicated disk device name.
    ReplicationConfigurationReplicatedDisk -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicationConfigurationReplicatedDisk
-> ReplicationConfigurationReplicatedDisk -> Bool
(ReplicationConfigurationReplicatedDisk
 -> ReplicationConfigurationReplicatedDisk -> Bool)
-> (ReplicationConfigurationReplicatedDisk
    -> ReplicationConfigurationReplicatedDisk -> Bool)
-> Eq ReplicationConfigurationReplicatedDisk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicationConfigurationReplicatedDisk
-> ReplicationConfigurationReplicatedDisk -> Bool
$c/= :: ReplicationConfigurationReplicatedDisk
-> ReplicationConfigurationReplicatedDisk -> Bool
== :: ReplicationConfigurationReplicatedDisk
-> ReplicationConfigurationReplicatedDisk -> Bool
$c== :: ReplicationConfigurationReplicatedDisk
-> ReplicationConfigurationReplicatedDisk -> Bool
Prelude.Eq, ReadPrec [ReplicationConfigurationReplicatedDisk]
ReadPrec ReplicationConfigurationReplicatedDisk
Int -> ReadS ReplicationConfigurationReplicatedDisk
ReadS [ReplicationConfigurationReplicatedDisk]
(Int -> ReadS ReplicationConfigurationReplicatedDisk)
-> ReadS [ReplicationConfigurationReplicatedDisk]
-> ReadPrec ReplicationConfigurationReplicatedDisk
-> ReadPrec [ReplicationConfigurationReplicatedDisk]
-> Read ReplicationConfigurationReplicatedDisk
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicationConfigurationReplicatedDisk]
$creadListPrec :: ReadPrec [ReplicationConfigurationReplicatedDisk]
readPrec :: ReadPrec ReplicationConfigurationReplicatedDisk
$creadPrec :: ReadPrec ReplicationConfigurationReplicatedDisk
readList :: ReadS [ReplicationConfigurationReplicatedDisk]
$creadList :: ReadS [ReplicationConfigurationReplicatedDisk]
readsPrec :: Int -> ReadS ReplicationConfigurationReplicatedDisk
$creadsPrec :: Int -> ReadS ReplicationConfigurationReplicatedDisk
Prelude.Read, Int -> ReplicationConfigurationReplicatedDisk -> ShowS
[ReplicationConfigurationReplicatedDisk] -> ShowS
ReplicationConfigurationReplicatedDisk -> String
(Int -> ReplicationConfigurationReplicatedDisk -> ShowS)
-> (ReplicationConfigurationReplicatedDisk -> String)
-> ([ReplicationConfigurationReplicatedDisk] -> ShowS)
-> Show ReplicationConfigurationReplicatedDisk
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicationConfigurationReplicatedDisk] -> ShowS
$cshowList :: [ReplicationConfigurationReplicatedDisk] -> ShowS
show :: ReplicationConfigurationReplicatedDisk -> String
$cshow :: ReplicationConfigurationReplicatedDisk -> String
showsPrec :: Int -> ReplicationConfigurationReplicatedDisk -> ShowS
$cshowsPrec :: Int -> ReplicationConfigurationReplicatedDisk -> ShowS
Prelude.Show, (forall x.
 ReplicationConfigurationReplicatedDisk
 -> Rep ReplicationConfigurationReplicatedDisk x)
-> (forall x.
    Rep ReplicationConfigurationReplicatedDisk x
    -> ReplicationConfigurationReplicatedDisk)
-> Generic ReplicationConfigurationReplicatedDisk
forall x.
Rep ReplicationConfigurationReplicatedDisk x
-> ReplicationConfigurationReplicatedDisk
forall x.
ReplicationConfigurationReplicatedDisk
-> Rep ReplicationConfigurationReplicatedDisk x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicationConfigurationReplicatedDisk x
-> ReplicationConfigurationReplicatedDisk
$cfrom :: forall x.
ReplicationConfigurationReplicatedDisk
-> Rep ReplicationConfigurationReplicatedDisk x
Prelude.Generic)

-- |
-- Create a value of 'ReplicationConfigurationReplicatedDisk' 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:
--
-- 'stagingDiskType', 'replicationConfigurationReplicatedDisk_stagingDiskType' - Replication Configuration replicated disk staging disk type.
--
-- 'iops', 'replicationConfigurationReplicatedDisk_iops' - Replication Configuration replicated disk IOPs.
--
-- 'isBootDisk', 'replicationConfigurationReplicatedDisk_isBootDisk' - Replication Configuration replicated disk boot disk.
--
-- 'deviceName', 'replicationConfigurationReplicatedDisk_deviceName' - Replication Configuration replicated disk device name.
newReplicationConfigurationReplicatedDisk ::
  ReplicationConfigurationReplicatedDisk
newReplicationConfigurationReplicatedDisk :: ReplicationConfigurationReplicatedDisk
newReplicationConfigurationReplicatedDisk =
  ReplicationConfigurationReplicatedDisk' :: Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
-> Maybe Natural
-> Maybe Bool
-> Maybe Text
-> ReplicationConfigurationReplicatedDisk
ReplicationConfigurationReplicatedDisk'
    { $sel:stagingDiskType:ReplicationConfigurationReplicatedDisk' :: Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType =
        Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
forall a. Maybe a
Prelude.Nothing,
      $sel:iops:ReplicationConfigurationReplicatedDisk' :: Maybe Natural
iops = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:isBootDisk:ReplicationConfigurationReplicatedDisk' :: Maybe Bool
isBootDisk = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceName:ReplicationConfigurationReplicatedDisk' :: Maybe Text
deviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Replication Configuration replicated disk staging disk type.
replicationConfigurationReplicatedDisk_stagingDiskType :: Lens.Lens' ReplicationConfigurationReplicatedDisk (Prelude.Maybe ReplicationConfigurationReplicatedDiskStagingDiskType)
replicationConfigurationReplicatedDisk_stagingDiskType :: (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
 -> f (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType))
-> ReplicationConfigurationReplicatedDisk
-> f ReplicationConfigurationReplicatedDisk
replicationConfigurationReplicatedDisk_stagingDiskType = (ReplicationConfigurationReplicatedDisk
 -> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType)
-> (ReplicationConfigurationReplicatedDisk
    -> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
    -> ReplicationConfigurationReplicatedDisk)
-> Lens
     ReplicationConfigurationReplicatedDisk
     ReplicationConfigurationReplicatedDisk
     (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType)
     (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationConfigurationReplicatedDisk' {Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType :: Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
$sel:stagingDiskType:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk
-> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType} -> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType) (\s :: ReplicationConfigurationReplicatedDisk
s@ReplicationConfigurationReplicatedDisk' {} Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
a -> ReplicationConfigurationReplicatedDisk
s {$sel:stagingDiskType:ReplicationConfigurationReplicatedDisk' :: Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType = Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
a} :: ReplicationConfigurationReplicatedDisk)

-- | Replication Configuration replicated disk IOPs.
replicationConfigurationReplicatedDisk_iops :: Lens.Lens' ReplicationConfigurationReplicatedDisk (Prelude.Maybe Prelude.Natural)
replicationConfigurationReplicatedDisk_iops :: (Maybe Natural -> f (Maybe Natural))
-> ReplicationConfigurationReplicatedDisk
-> f ReplicationConfigurationReplicatedDisk
replicationConfigurationReplicatedDisk_iops = (ReplicationConfigurationReplicatedDisk -> Maybe Natural)
-> (ReplicationConfigurationReplicatedDisk
    -> Maybe Natural -> ReplicationConfigurationReplicatedDisk)
-> Lens
     ReplicationConfigurationReplicatedDisk
     ReplicationConfigurationReplicatedDisk
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationConfigurationReplicatedDisk' {Maybe Natural
iops :: Maybe Natural
$sel:iops:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk -> Maybe Natural
iops} -> Maybe Natural
iops) (\s :: ReplicationConfigurationReplicatedDisk
s@ReplicationConfigurationReplicatedDisk' {} Maybe Natural
a -> ReplicationConfigurationReplicatedDisk
s {$sel:iops:ReplicationConfigurationReplicatedDisk' :: Maybe Natural
iops = Maybe Natural
a} :: ReplicationConfigurationReplicatedDisk)

-- | Replication Configuration replicated disk boot disk.
replicationConfigurationReplicatedDisk_isBootDisk :: Lens.Lens' ReplicationConfigurationReplicatedDisk (Prelude.Maybe Prelude.Bool)
replicationConfigurationReplicatedDisk_isBootDisk :: (Maybe Bool -> f (Maybe Bool))
-> ReplicationConfigurationReplicatedDisk
-> f ReplicationConfigurationReplicatedDisk
replicationConfigurationReplicatedDisk_isBootDisk = (ReplicationConfigurationReplicatedDisk -> Maybe Bool)
-> (ReplicationConfigurationReplicatedDisk
    -> Maybe Bool -> ReplicationConfigurationReplicatedDisk)
-> Lens
     ReplicationConfigurationReplicatedDisk
     ReplicationConfigurationReplicatedDisk
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationConfigurationReplicatedDisk' {Maybe Bool
isBootDisk :: Maybe Bool
$sel:isBootDisk:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk -> Maybe Bool
isBootDisk} -> Maybe Bool
isBootDisk) (\s :: ReplicationConfigurationReplicatedDisk
s@ReplicationConfigurationReplicatedDisk' {} Maybe Bool
a -> ReplicationConfigurationReplicatedDisk
s {$sel:isBootDisk:ReplicationConfigurationReplicatedDisk' :: Maybe Bool
isBootDisk = Maybe Bool
a} :: ReplicationConfigurationReplicatedDisk)

-- | Replication Configuration replicated disk device name.
replicationConfigurationReplicatedDisk_deviceName :: Lens.Lens' ReplicationConfigurationReplicatedDisk (Prelude.Maybe Prelude.Text)
replicationConfigurationReplicatedDisk_deviceName :: (Maybe Text -> f (Maybe Text))
-> ReplicationConfigurationReplicatedDisk
-> f ReplicationConfigurationReplicatedDisk
replicationConfigurationReplicatedDisk_deviceName = (ReplicationConfigurationReplicatedDisk -> Maybe Text)
-> (ReplicationConfigurationReplicatedDisk
    -> Maybe Text -> ReplicationConfigurationReplicatedDisk)
-> Lens
     ReplicationConfigurationReplicatedDisk
     ReplicationConfigurationReplicatedDisk
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationConfigurationReplicatedDisk' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: ReplicationConfigurationReplicatedDisk
s@ReplicationConfigurationReplicatedDisk' {} Maybe Text
a -> ReplicationConfigurationReplicatedDisk
s {$sel:deviceName:ReplicationConfigurationReplicatedDisk' :: Maybe Text
deviceName = Maybe Text
a} :: ReplicationConfigurationReplicatedDisk)

instance
  Core.FromJSON
    ReplicationConfigurationReplicatedDisk
  where
  parseJSON :: Value -> Parser ReplicationConfigurationReplicatedDisk
parseJSON =
    String
-> (Object -> Parser ReplicationConfigurationReplicatedDisk)
-> Value
-> Parser ReplicationConfigurationReplicatedDisk
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReplicationConfigurationReplicatedDisk"
      ( \Object
x ->
          Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
-> Maybe Natural
-> Maybe Bool
-> Maybe Text
-> ReplicationConfigurationReplicatedDisk
ReplicationConfigurationReplicatedDisk'
            (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
 -> Maybe Natural
 -> Maybe Bool
 -> Maybe Text
 -> ReplicationConfigurationReplicatedDisk)
-> Parser
     (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType)
-> Parser
     (Maybe Natural
      -> Maybe Bool
      -> Maybe Text
      -> ReplicationConfigurationReplicatedDisk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe ReplicationConfigurationReplicatedDiskStagingDiskType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stagingDiskType")
            Parser
  (Maybe Natural
   -> Maybe Bool
   -> Maybe Text
   -> ReplicationConfigurationReplicatedDisk)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Bool
      -> Maybe Text -> ReplicationConfigurationReplicatedDisk)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"iops")
            Parser
  (Maybe Bool
   -> Maybe Text -> ReplicationConfigurationReplicatedDisk)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> ReplicationConfigurationReplicatedDisk)
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
"isBootDisk")
            Parser (Maybe Text -> ReplicationConfigurationReplicatedDisk)
-> Parser (Maybe Text)
-> Parser ReplicationConfigurationReplicatedDisk
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
"deviceName")
      )

instance
  Prelude.Hashable
    ReplicationConfigurationReplicatedDisk

instance
  Prelude.NFData
    ReplicationConfigurationReplicatedDisk

instance
  Core.ToJSON
    ReplicationConfigurationReplicatedDisk
  where
  toJSON :: ReplicationConfigurationReplicatedDisk -> Value
toJSON ReplicationConfigurationReplicatedDisk' {Maybe Bool
Maybe Natural
Maybe Text
Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
deviceName :: Maybe Text
isBootDisk :: Maybe Bool
iops :: Maybe Natural
stagingDiskType :: Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
$sel:deviceName:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk -> Maybe Text
$sel:isBootDisk:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk -> Maybe Bool
$sel:iops:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk -> Maybe Natural
$sel:stagingDiskType:ReplicationConfigurationReplicatedDisk' :: ReplicationConfigurationReplicatedDisk
-> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"stagingDiskType" Text
-> ReplicationConfigurationReplicatedDiskStagingDiskType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReplicationConfigurationReplicatedDiskStagingDiskType -> Pair)
-> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReplicationConfigurationReplicatedDiskStagingDiskType
stagingDiskType,
            (Text
"iops" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
iops,
            (Text
"isBootDisk" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isBootDisk,
            (Text
"deviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deviceName
          ]
      )