{-# 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.StagingSourceServer
-- 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.StagingSourceServer where

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

-- | Source server in staging account that extended source server connected
-- to.
--
-- /See:/ 'newStagingSourceServer' smart constructor.
data StagingSourceServer = StagingSourceServer'
  { -- | The ARN of the source server.
    StagingSourceServer -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Hostname of staging source server.
    StagingSourceServer -> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
    -- | A list of tags associated with the staging source server.
    StagingSourceServer -> Maybe (Sensitive (HashMap Text Text))
tags :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text))
  }
  deriving (StagingSourceServer -> StagingSourceServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StagingSourceServer -> StagingSourceServer -> Bool
$c/= :: StagingSourceServer -> StagingSourceServer -> Bool
== :: StagingSourceServer -> StagingSourceServer -> Bool
$c== :: StagingSourceServer -> StagingSourceServer -> Bool
Prelude.Eq, Int -> StagingSourceServer -> ShowS
[StagingSourceServer] -> ShowS
StagingSourceServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StagingSourceServer] -> ShowS
$cshowList :: [StagingSourceServer] -> ShowS
show :: StagingSourceServer -> String
$cshow :: StagingSourceServer -> String
showsPrec :: Int -> StagingSourceServer -> ShowS
$cshowsPrec :: Int -> StagingSourceServer -> ShowS
Prelude.Show, forall x. Rep StagingSourceServer x -> StagingSourceServer
forall x. StagingSourceServer -> Rep StagingSourceServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StagingSourceServer x -> StagingSourceServer
$cfrom :: forall x. StagingSourceServer -> Rep StagingSourceServer x
Prelude.Generic)

-- |
-- Create a value of 'StagingSourceServer' 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:
--
-- 'arn', 'stagingSourceServer_arn' - The ARN of the source server.
--
-- 'hostname', 'stagingSourceServer_hostname' - Hostname of staging source server.
--
-- 'tags', 'stagingSourceServer_tags' - A list of tags associated with the staging source server.
newStagingSourceServer ::
  StagingSourceServer
newStagingSourceServer :: StagingSourceServer
newStagingSourceServer =
  StagingSourceServer'
    { $sel:arn:StagingSourceServer' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:hostname:StagingSourceServer' :: Maybe Text
hostname = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:StagingSourceServer' :: Maybe (Sensitive (HashMap Text Text))
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the source server.
stagingSourceServer_arn :: Lens.Lens' StagingSourceServer (Prelude.Maybe Prelude.Text)
stagingSourceServer_arn :: Lens' StagingSourceServer (Maybe Text)
stagingSourceServer_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingSourceServer' {Maybe Text
arn :: Maybe Text
$sel:arn:StagingSourceServer' :: StagingSourceServer -> Maybe Text
arn} -> Maybe Text
arn) (\s :: StagingSourceServer
s@StagingSourceServer' {} Maybe Text
a -> StagingSourceServer
s {$sel:arn:StagingSourceServer' :: Maybe Text
arn = Maybe Text
a} :: StagingSourceServer)

-- | Hostname of staging source server.
stagingSourceServer_hostname :: Lens.Lens' StagingSourceServer (Prelude.Maybe Prelude.Text)
stagingSourceServer_hostname :: Lens' StagingSourceServer (Maybe Text)
stagingSourceServer_hostname = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingSourceServer' {Maybe Text
hostname :: Maybe Text
$sel:hostname:StagingSourceServer' :: StagingSourceServer -> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: StagingSourceServer
s@StagingSourceServer' {} Maybe Text
a -> StagingSourceServer
s {$sel:hostname:StagingSourceServer' :: Maybe Text
hostname = Maybe Text
a} :: StagingSourceServer)

-- | A list of tags associated with the staging source server.
stagingSourceServer_tags :: Lens.Lens' StagingSourceServer (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
stagingSourceServer_tags :: Lens' StagingSourceServer (Maybe (HashMap Text Text))
stagingSourceServer_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StagingSourceServer' {Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:tags:StagingSourceServer' :: StagingSourceServer -> Maybe (Sensitive (HashMap Text Text))
tags} -> Maybe (Sensitive (HashMap Text Text))
tags) (\s :: StagingSourceServer
s@StagingSourceServer' {} Maybe (Sensitive (HashMap Text Text))
a -> StagingSourceServer
s {$sel:tags:StagingSourceServer' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
a} :: StagingSourceServer) 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 a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

instance Data.FromJSON StagingSourceServer where
  parseJSON :: Value -> Parser StagingSourceServer
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StagingSourceServer"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (Sensitive (HashMap Text Text))
-> StagingSourceServer
StagingSourceServer'
            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
"arn")
            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
"hostname")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable StagingSourceServer where
  hashWithSalt :: Int -> StagingSourceServer -> Int
hashWithSalt Int
_salt StagingSourceServer' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
hostname :: Maybe Text
arn :: Maybe Text
$sel:tags:StagingSourceServer' :: StagingSourceServer -> Maybe (Sensitive (HashMap Text Text))
$sel:hostname:StagingSourceServer' :: StagingSourceServer -> Maybe Text
$sel:arn:StagingSourceServer' :: StagingSourceServer -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostname
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text Text))
tags

instance Prelude.NFData StagingSourceServer where
  rnf :: StagingSourceServer -> ()
rnf StagingSourceServer' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
hostname :: Maybe Text
arn :: Maybe Text
$sel:tags:StagingSourceServer' :: StagingSourceServer -> Maybe (Sensitive (HashMap Text Text))
$sel:hostname:StagingSourceServer' :: StagingSourceServer -> Maybe Text
$sel:arn:StagingSourceServer' :: StagingSourceServer -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostname
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text Text))
tags