{-# 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.StagingArea
-- 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.StagingArea 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.ExtensionStatus
import qualified Amazonka.Prelude as Prelude

-- | Staging information related to source server.
--
-- /See:/ 'newStagingArea' smart constructor.
data StagingArea = StagingArea'
  { -- | Shows an error message that occurred when DRS tried to access the
    -- staging source server. In this case StagingArea$status will have value
    -- EXTENSION_ERROR
    StagingArea -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | Account ID of the account to which source server belongs. If this source
    -- server is extended - shows Account ID of staging source server.
    StagingArea -> Maybe Text
stagingAccountID :: Prelude.Maybe Prelude.Text,
    -- | Arn of the staging source server if this source server is extended
    StagingArea -> Maybe Text
stagingSourceServerArn :: Prelude.Maybe Prelude.Text,
    -- | Status of Source server extension. Possible values: (a) NOT_EXTENDED -
    -- This is a source server that is replicating in the current account. (b)
    -- EXTENDED - Source server is extended from a staging source server. In
    -- this case, the value of stagingSourceServerArn is pointing to the Arn of
    -- the source server in the staging account. (c) EXTENSION_ERROR - Some
    -- issue occurred when accessing staging source server. In this case,
    -- errorMessage field will contain an error message that explains what
    -- happened.
    StagingArea -> Maybe ExtensionStatus
status :: Prelude.Maybe ExtensionStatus
  }
  deriving (StagingArea -> StagingArea -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StagingArea -> StagingArea -> Bool
$c/= :: StagingArea -> StagingArea -> Bool
== :: StagingArea -> StagingArea -> Bool
$c== :: StagingArea -> StagingArea -> Bool
Prelude.Eq, ReadPrec [StagingArea]
ReadPrec StagingArea
Int -> ReadS StagingArea
ReadS [StagingArea]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StagingArea]
$creadListPrec :: ReadPrec [StagingArea]
readPrec :: ReadPrec StagingArea
$creadPrec :: ReadPrec StagingArea
readList :: ReadS [StagingArea]
$creadList :: ReadS [StagingArea]
readsPrec :: Int -> ReadS StagingArea
$creadsPrec :: Int -> ReadS StagingArea
Prelude.Read, Int -> StagingArea -> ShowS
[StagingArea] -> ShowS
StagingArea -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StagingArea] -> ShowS
$cshowList :: [StagingArea] -> ShowS
show :: StagingArea -> String
$cshow :: StagingArea -> String
showsPrec :: Int -> StagingArea -> ShowS
$cshowsPrec :: Int -> StagingArea -> ShowS
Prelude.Show, forall x. Rep StagingArea x -> StagingArea
forall x. StagingArea -> Rep StagingArea x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StagingArea x -> StagingArea
$cfrom :: forall x. StagingArea -> Rep StagingArea x
Prelude.Generic)

-- |
-- Create a value of 'StagingArea' 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:
--
-- 'errorMessage', 'stagingArea_errorMessage' - Shows an error message that occurred when DRS tried to access the
-- staging source server. In this case StagingArea$status will have value
-- EXTENSION_ERROR
--
-- 'stagingAccountID', 'stagingArea_stagingAccountID' - Account ID of the account to which source server belongs. If this source
-- server is extended - shows Account ID of staging source server.
--
-- 'stagingSourceServerArn', 'stagingArea_stagingSourceServerArn' - Arn of the staging source server if this source server is extended
--
-- 'status', 'stagingArea_status' - Status of Source server extension. Possible values: (a) NOT_EXTENDED -
-- This is a source server that is replicating in the current account. (b)
-- EXTENDED - Source server is extended from a staging source server. In
-- this case, the value of stagingSourceServerArn is pointing to the Arn of
-- the source server in the staging account. (c) EXTENSION_ERROR - Some
-- issue occurred when accessing staging source server. In this case,
-- errorMessage field will contain an error message that explains what
-- happened.
newStagingArea ::
  StagingArea
newStagingArea :: StagingArea
newStagingArea =
  StagingArea'
    { $sel:errorMessage:StagingArea' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:stagingAccountID:StagingArea' :: Maybe Text
stagingAccountID = forall a. Maybe a
Prelude.Nothing,
      $sel:stagingSourceServerArn:StagingArea' :: Maybe Text
stagingSourceServerArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:StagingArea' :: Maybe ExtensionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Shows an error message that occurred when DRS tried to access the
-- staging source server. In this case StagingArea$status will have value
-- EXTENSION_ERROR
stagingArea_errorMessage :: Lens.Lens' StagingArea (Prelude.Maybe Prelude.Text)
stagingArea_errorMessage :: Lens' StagingArea (Maybe Text)
stagingArea_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingArea' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:StagingArea' :: StagingArea -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: StagingArea
s@StagingArea' {} Maybe Text
a -> StagingArea
s {$sel:errorMessage:StagingArea' :: Maybe Text
errorMessage = Maybe Text
a} :: StagingArea)

-- | Account ID of the account to which source server belongs. If this source
-- server is extended - shows Account ID of staging source server.
stagingArea_stagingAccountID :: Lens.Lens' StagingArea (Prelude.Maybe Prelude.Text)
stagingArea_stagingAccountID :: Lens' StagingArea (Maybe Text)
stagingArea_stagingAccountID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingArea' {Maybe Text
stagingAccountID :: Maybe Text
$sel:stagingAccountID:StagingArea' :: StagingArea -> Maybe Text
stagingAccountID} -> Maybe Text
stagingAccountID) (\s :: StagingArea
s@StagingArea' {} Maybe Text
a -> StagingArea
s {$sel:stagingAccountID:StagingArea' :: Maybe Text
stagingAccountID = Maybe Text
a} :: StagingArea)

-- | Arn of the staging source server if this source server is extended
stagingArea_stagingSourceServerArn :: Lens.Lens' StagingArea (Prelude.Maybe Prelude.Text)
stagingArea_stagingSourceServerArn :: Lens' StagingArea (Maybe Text)
stagingArea_stagingSourceServerArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingArea' {Maybe Text
stagingSourceServerArn :: Maybe Text
$sel:stagingSourceServerArn:StagingArea' :: StagingArea -> Maybe Text
stagingSourceServerArn} -> Maybe Text
stagingSourceServerArn) (\s :: StagingArea
s@StagingArea' {} Maybe Text
a -> StagingArea
s {$sel:stagingSourceServerArn:StagingArea' :: Maybe Text
stagingSourceServerArn = Maybe Text
a} :: StagingArea)

-- | Status of Source server extension. Possible values: (a) NOT_EXTENDED -
-- This is a source server that is replicating in the current account. (b)
-- EXTENDED - Source server is extended from a staging source server. In
-- this case, the value of stagingSourceServerArn is pointing to the Arn of
-- the source server in the staging account. (c) EXTENSION_ERROR - Some
-- issue occurred when accessing staging source server. In this case,
-- errorMessage field will contain an error message that explains what
-- happened.
stagingArea_status :: Lens.Lens' StagingArea (Prelude.Maybe ExtensionStatus)
stagingArea_status :: Lens' StagingArea (Maybe ExtensionStatus)
stagingArea_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingArea' {Maybe ExtensionStatus
status :: Maybe ExtensionStatus
$sel:status:StagingArea' :: StagingArea -> Maybe ExtensionStatus
status} -> Maybe ExtensionStatus
status) (\s :: StagingArea
s@StagingArea' {} Maybe ExtensionStatus
a -> StagingArea
s {$sel:status:StagingArea' :: Maybe ExtensionStatus
status = Maybe ExtensionStatus
a} :: StagingArea)

instance Data.FromJSON StagingArea where
  parseJSON :: Value -> Parser StagingArea
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StagingArea"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe ExtensionStatus -> StagingArea
StagingArea'
            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
"errorMessage")
            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
"stagingAccountID")
            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
"stagingSourceServerArn")
            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
"status")
      )

instance Prelude.Hashable StagingArea where
  hashWithSalt :: Int -> StagingArea -> Int
hashWithSalt Int
_salt StagingArea' {Maybe Text
Maybe ExtensionStatus
status :: Maybe ExtensionStatus
stagingSourceServerArn :: Maybe Text
stagingAccountID :: Maybe Text
errorMessage :: Maybe Text
$sel:status:StagingArea' :: StagingArea -> Maybe ExtensionStatus
$sel:stagingSourceServerArn:StagingArea' :: StagingArea -> Maybe Text
$sel:stagingAccountID:StagingArea' :: StagingArea -> Maybe Text
$sel:errorMessage:StagingArea' :: StagingArea -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stagingAccountID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stagingSourceServerArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExtensionStatus
status

instance Prelude.NFData StagingArea where
  rnf :: StagingArea -> ()
rnf StagingArea' {Maybe Text
Maybe ExtensionStatus
status :: Maybe ExtensionStatus
stagingSourceServerArn :: Maybe Text
stagingAccountID :: Maybe Text
errorMessage :: Maybe Text
$sel:status:StagingArea' :: StagingArea -> Maybe ExtensionStatus
$sel:stagingSourceServerArn:StagingArea' :: StagingArea -> Maybe Text
$sel:stagingAccountID:StagingArea' :: StagingArea -> Maybe Text
$sel:errorMessage:StagingArea' :: StagingArea -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stagingAccountID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stagingSourceServerArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExtensionStatus
status