{-# 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.Redshift.Types.DataTransferProgress
-- 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.Redshift.Types.DataTransferProgress where

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

-- | Describes the status of a cluster while it is in the process of resizing
-- with an incremental resize.
--
-- /See:/ 'newDataTransferProgress' smart constructor.
data DataTransferProgress = DataTransferProgress'
  { -- | Describes the data transfer rate in MB\'s per second.
    DataTransferProgress -> Maybe Double
currentRateInMegaBytesPerSecond :: Prelude.Maybe Prelude.Double,
    -- | Describes the status of the cluster. While the transfer is in progress
    -- the status is @transferringdata@.
    DataTransferProgress -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | Describes the estimated number of seconds remaining to complete the
    -- transfer.
    DataTransferProgress -> Maybe Integer
estimatedTimeToCompletionInSeconds :: Prelude.Maybe Prelude.Integer,
    -- | Describes the total amount of data that has been transfered in MB\'s.
    DataTransferProgress -> Maybe Integer
dataTransferredInMegaBytes :: Prelude.Maybe Prelude.Integer,
    -- | Describes the total amount of data to be transfered in megabytes.
    DataTransferProgress -> Maybe Integer
totalDataInMegaBytes :: Prelude.Maybe Prelude.Integer,
    -- | Describes the number of seconds that have elapsed during the data
    -- transfer.
    DataTransferProgress -> Maybe Integer
elapsedTimeInSeconds :: Prelude.Maybe Prelude.Integer
  }
  deriving (DataTransferProgress -> DataTransferProgress -> Bool
(DataTransferProgress -> DataTransferProgress -> Bool)
-> (DataTransferProgress -> DataTransferProgress -> Bool)
-> Eq DataTransferProgress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataTransferProgress -> DataTransferProgress -> Bool
$c/= :: DataTransferProgress -> DataTransferProgress -> Bool
== :: DataTransferProgress -> DataTransferProgress -> Bool
$c== :: DataTransferProgress -> DataTransferProgress -> Bool
Prelude.Eq, ReadPrec [DataTransferProgress]
ReadPrec DataTransferProgress
Int -> ReadS DataTransferProgress
ReadS [DataTransferProgress]
(Int -> ReadS DataTransferProgress)
-> ReadS [DataTransferProgress]
-> ReadPrec DataTransferProgress
-> ReadPrec [DataTransferProgress]
-> Read DataTransferProgress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataTransferProgress]
$creadListPrec :: ReadPrec [DataTransferProgress]
readPrec :: ReadPrec DataTransferProgress
$creadPrec :: ReadPrec DataTransferProgress
readList :: ReadS [DataTransferProgress]
$creadList :: ReadS [DataTransferProgress]
readsPrec :: Int -> ReadS DataTransferProgress
$creadsPrec :: Int -> ReadS DataTransferProgress
Prelude.Read, Int -> DataTransferProgress -> ShowS
[DataTransferProgress] -> ShowS
DataTransferProgress -> String
(Int -> DataTransferProgress -> ShowS)
-> (DataTransferProgress -> String)
-> ([DataTransferProgress] -> ShowS)
-> Show DataTransferProgress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataTransferProgress] -> ShowS
$cshowList :: [DataTransferProgress] -> ShowS
show :: DataTransferProgress -> String
$cshow :: DataTransferProgress -> String
showsPrec :: Int -> DataTransferProgress -> ShowS
$cshowsPrec :: Int -> DataTransferProgress -> ShowS
Prelude.Show, (forall x. DataTransferProgress -> Rep DataTransferProgress x)
-> (forall x. Rep DataTransferProgress x -> DataTransferProgress)
-> Generic DataTransferProgress
forall x. Rep DataTransferProgress x -> DataTransferProgress
forall x. DataTransferProgress -> Rep DataTransferProgress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataTransferProgress x -> DataTransferProgress
$cfrom :: forall x. DataTransferProgress -> Rep DataTransferProgress x
Prelude.Generic)

-- |
-- Create a value of 'DataTransferProgress' 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:
--
-- 'currentRateInMegaBytesPerSecond', 'dataTransferProgress_currentRateInMegaBytesPerSecond' - Describes the data transfer rate in MB\'s per second.
--
-- 'status', 'dataTransferProgress_status' - Describes the status of the cluster. While the transfer is in progress
-- the status is @transferringdata@.
--
-- 'estimatedTimeToCompletionInSeconds', 'dataTransferProgress_estimatedTimeToCompletionInSeconds' - Describes the estimated number of seconds remaining to complete the
-- transfer.
--
-- 'dataTransferredInMegaBytes', 'dataTransferProgress_dataTransferredInMegaBytes' - Describes the total amount of data that has been transfered in MB\'s.
--
-- 'totalDataInMegaBytes', 'dataTransferProgress_totalDataInMegaBytes' - Describes the total amount of data to be transfered in megabytes.
--
-- 'elapsedTimeInSeconds', 'dataTransferProgress_elapsedTimeInSeconds' - Describes the number of seconds that have elapsed during the data
-- transfer.
newDataTransferProgress ::
  DataTransferProgress
newDataTransferProgress :: DataTransferProgress
newDataTransferProgress =
  DataTransferProgress' :: Maybe Double
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> DataTransferProgress
DataTransferProgress'
    { $sel:currentRateInMegaBytesPerSecond:DataTransferProgress' :: Maybe Double
currentRateInMegaBytesPerSecond =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DataTransferProgress' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedTimeToCompletionInSeconds:DataTransferProgress' :: Maybe Integer
estimatedTimeToCompletionInSeconds = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:dataTransferredInMegaBytes:DataTransferProgress' :: Maybe Integer
dataTransferredInMegaBytes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:totalDataInMegaBytes:DataTransferProgress' :: Maybe Integer
totalDataInMegaBytes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:elapsedTimeInSeconds:DataTransferProgress' :: Maybe Integer
elapsedTimeInSeconds = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the data transfer rate in MB\'s per second.
dataTransferProgress_currentRateInMegaBytesPerSecond :: Lens.Lens' DataTransferProgress (Prelude.Maybe Prelude.Double)
dataTransferProgress_currentRateInMegaBytesPerSecond :: (Maybe Double -> f (Maybe Double))
-> DataTransferProgress -> f DataTransferProgress
dataTransferProgress_currentRateInMegaBytesPerSecond = (DataTransferProgress -> Maybe Double)
-> (DataTransferProgress -> Maybe Double -> DataTransferProgress)
-> Lens
     DataTransferProgress
     DataTransferProgress
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataTransferProgress' {Maybe Double
currentRateInMegaBytesPerSecond :: Maybe Double
$sel:currentRateInMegaBytesPerSecond:DataTransferProgress' :: DataTransferProgress -> Maybe Double
currentRateInMegaBytesPerSecond} -> Maybe Double
currentRateInMegaBytesPerSecond) (\s :: DataTransferProgress
s@DataTransferProgress' {} Maybe Double
a -> DataTransferProgress
s {$sel:currentRateInMegaBytesPerSecond:DataTransferProgress' :: Maybe Double
currentRateInMegaBytesPerSecond = Maybe Double
a} :: DataTransferProgress)

-- | Describes the status of the cluster. While the transfer is in progress
-- the status is @transferringdata@.
dataTransferProgress_status :: Lens.Lens' DataTransferProgress (Prelude.Maybe Prelude.Text)
dataTransferProgress_status :: (Maybe Text -> f (Maybe Text))
-> DataTransferProgress -> f DataTransferProgress
dataTransferProgress_status = (DataTransferProgress -> Maybe Text)
-> (DataTransferProgress -> Maybe Text -> DataTransferProgress)
-> Lens
     DataTransferProgress DataTransferProgress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataTransferProgress' {Maybe Text
status :: Maybe Text
$sel:status:DataTransferProgress' :: DataTransferProgress -> Maybe Text
status} -> Maybe Text
status) (\s :: DataTransferProgress
s@DataTransferProgress' {} Maybe Text
a -> DataTransferProgress
s {$sel:status:DataTransferProgress' :: Maybe Text
status = Maybe Text
a} :: DataTransferProgress)

-- | Describes the estimated number of seconds remaining to complete the
-- transfer.
dataTransferProgress_estimatedTimeToCompletionInSeconds :: Lens.Lens' DataTransferProgress (Prelude.Maybe Prelude.Integer)
dataTransferProgress_estimatedTimeToCompletionInSeconds :: (Maybe Integer -> f (Maybe Integer))
-> DataTransferProgress -> f DataTransferProgress
dataTransferProgress_estimatedTimeToCompletionInSeconds = (DataTransferProgress -> Maybe Integer)
-> (DataTransferProgress -> Maybe Integer -> DataTransferProgress)
-> Lens
     DataTransferProgress
     DataTransferProgress
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataTransferProgress' {Maybe Integer
estimatedTimeToCompletionInSeconds :: Maybe Integer
$sel:estimatedTimeToCompletionInSeconds:DataTransferProgress' :: DataTransferProgress -> Maybe Integer
estimatedTimeToCompletionInSeconds} -> Maybe Integer
estimatedTimeToCompletionInSeconds) (\s :: DataTransferProgress
s@DataTransferProgress' {} Maybe Integer
a -> DataTransferProgress
s {$sel:estimatedTimeToCompletionInSeconds:DataTransferProgress' :: Maybe Integer
estimatedTimeToCompletionInSeconds = Maybe Integer
a} :: DataTransferProgress)

-- | Describes the total amount of data that has been transfered in MB\'s.
dataTransferProgress_dataTransferredInMegaBytes :: Lens.Lens' DataTransferProgress (Prelude.Maybe Prelude.Integer)
dataTransferProgress_dataTransferredInMegaBytes :: (Maybe Integer -> f (Maybe Integer))
-> DataTransferProgress -> f DataTransferProgress
dataTransferProgress_dataTransferredInMegaBytes = (DataTransferProgress -> Maybe Integer)
-> (DataTransferProgress -> Maybe Integer -> DataTransferProgress)
-> Lens
     DataTransferProgress
     DataTransferProgress
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataTransferProgress' {Maybe Integer
dataTransferredInMegaBytes :: Maybe Integer
$sel:dataTransferredInMegaBytes:DataTransferProgress' :: DataTransferProgress -> Maybe Integer
dataTransferredInMegaBytes} -> Maybe Integer
dataTransferredInMegaBytes) (\s :: DataTransferProgress
s@DataTransferProgress' {} Maybe Integer
a -> DataTransferProgress
s {$sel:dataTransferredInMegaBytes:DataTransferProgress' :: Maybe Integer
dataTransferredInMegaBytes = Maybe Integer
a} :: DataTransferProgress)

-- | Describes the total amount of data to be transfered in megabytes.
dataTransferProgress_totalDataInMegaBytes :: Lens.Lens' DataTransferProgress (Prelude.Maybe Prelude.Integer)
dataTransferProgress_totalDataInMegaBytes :: (Maybe Integer -> f (Maybe Integer))
-> DataTransferProgress -> f DataTransferProgress
dataTransferProgress_totalDataInMegaBytes = (DataTransferProgress -> Maybe Integer)
-> (DataTransferProgress -> Maybe Integer -> DataTransferProgress)
-> Lens
     DataTransferProgress
     DataTransferProgress
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataTransferProgress' {Maybe Integer
totalDataInMegaBytes :: Maybe Integer
$sel:totalDataInMegaBytes:DataTransferProgress' :: DataTransferProgress -> Maybe Integer
totalDataInMegaBytes} -> Maybe Integer
totalDataInMegaBytes) (\s :: DataTransferProgress
s@DataTransferProgress' {} Maybe Integer
a -> DataTransferProgress
s {$sel:totalDataInMegaBytes:DataTransferProgress' :: Maybe Integer
totalDataInMegaBytes = Maybe Integer
a} :: DataTransferProgress)

-- | Describes the number of seconds that have elapsed during the data
-- transfer.
dataTransferProgress_elapsedTimeInSeconds :: Lens.Lens' DataTransferProgress (Prelude.Maybe Prelude.Integer)
dataTransferProgress_elapsedTimeInSeconds :: (Maybe Integer -> f (Maybe Integer))
-> DataTransferProgress -> f DataTransferProgress
dataTransferProgress_elapsedTimeInSeconds = (DataTransferProgress -> Maybe Integer)
-> (DataTransferProgress -> Maybe Integer -> DataTransferProgress)
-> Lens
     DataTransferProgress
     DataTransferProgress
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataTransferProgress' {Maybe Integer
elapsedTimeInSeconds :: Maybe Integer
$sel:elapsedTimeInSeconds:DataTransferProgress' :: DataTransferProgress -> Maybe Integer
elapsedTimeInSeconds} -> Maybe Integer
elapsedTimeInSeconds) (\s :: DataTransferProgress
s@DataTransferProgress' {} Maybe Integer
a -> DataTransferProgress
s {$sel:elapsedTimeInSeconds:DataTransferProgress' :: Maybe Integer
elapsedTimeInSeconds = Maybe Integer
a} :: DataTransferProgress)

instance Core.FromXML DataTransferProgress where
  parseXML :: [Node] -> Either String DataTransferProgress
parseXML [Node]
x =
    Maybe Double
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> DataTransferProgress
DataTransferProgress'
      (Maybe Double
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> DataTransferProgress)
-> Either String (Maybe Double)
-> Either
     String
     (Maybe Text
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> DataTransferProgress)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CurrentRateInMegaBytesPerSecond")
      Either
  String
  (Maybe Text
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> DataTransferProgress)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> DataTransferProgress)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either
  String
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> DataTransferProgress)
-> Either String (Maybe Integer)
-> Either
     String
     (Maybe Integer
      -> Maybe Integer -> Maybe Integer -> DataTransferProgress)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EstimatedTimeToCompletionInSeconds")
      Either
  String
  (Maybe Integer
   -> Maybe Integer -> Maybe Integer -> DataTransferProgress)
-> Either String (Maybe Integer)
-> Either
     String (Maybe Integer -> Maybe Integer -> DataTransferProgress)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DataTransferredInMegaBytes")
      Either
  String (Maybe Integer -> Maybe Integer -> DataTransferProgress)
-> Either String (Maybe Integer)
-> Either String (Maybe Integer -> DataTransferProgress)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TotalDataInMegaBytes")
      Either String (Maybe Integer -> DataTransferProgress)
-> Either String (Maybe Integer)
-> Either String DataTransferProgress
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ElapsedTimeInSeconds")

instance Prelude.Hashable DataTransferProgress

instance Prelude.NFData DataTransferProgress