{-# 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.OpenSearch.Types.OutboundConnection
-- 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.OpenSearch.Types.OutboundConnection where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearch.Types.DomainInformationContainer
import Amazonka.OpenSearch.Types.OutboundConnectionStatus
import qualified Amazonka.Prelude as Prelude

-- | Specifies details about an outbound cross-cluster connection.
--
-- /See:/ 'newOutboundConnection' smart constructor.
data OutboundConnection = OutboundConnection'
  { -- | Name of the connection.
    OutboundConnection -> Maybe Text
connectionAlias :: Prelude.Maybe Prelude.Text,
    -- | Unique identifier of the connection.
    OutboundConnection -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
    -- | Status of the connection.
    OutboundConnection -> Maybe OutboundConnectionStatus
connectionStatus :: Prelude.Maybe OutboundConnectionStatus,
    -- | Information about the source (local) domain.
    OutboundConnection -> Maybe DomainInformationContainer
localDomainInfo :: Prelude.Maybe DomainInformationContainer,
    -- | Information about the destination (remote) domain.
    OutboundConnection -> Maybe DomainInformationContainer
remoteDomainInfo :: Prelude.Maybe DomainInformationContainer
  }
  deriving (OutboundConnection -> OutboundConnection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutboundConnection -> OutboundConnection -> Bool
$c/= :: OutboundConnection -> OutboundConnection -> Bool
== :: OutboundConnection -> OutboundConnection -> Bool
$c== :: OutboundConnection -> OutboundConnection -> Bool
Prelude.Eq, ReadPrec [OutboundConnection]
ReadPrec OutboundConnection
Int -> ReadS OutboundConnection
ReadS [OutboundConnection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutboundConnection]
$creadListPrec :: ReadPrec [OutboundConnection]
readPrec :: ReadPrec OutboundConnection
$creadPrec :: ReadPrec OutboundConnection
readList :: ReadS [OutboundConnection]
$creadList :: ReadS [OutboundConnection]
readsPrec :: Int -> ReadS OutboundConnection
$creadsPrec :: Int -> ReadS OutboundConnection
Prelude.Read, Int -> OutboundConnection -> ShowS
[OutboundConnection] -> ShowS
OutboundConnection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutboundConnection] -> ShowS
$cshowList :: [OutboundConnection] -> ShowS
show :: OutboundConnection -> String
$cshow :: OutboundConnection -> String
showsPrec :: Int -> OutboundConnection -> ShowS
$cshowsPrec :: Int -> OutboundConnection -> ShowS
Prelude.Show, forall x. Rep OutboundConnection x -> OutboundConnection
forall x. OutboundConnection -> Rep OutboundConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutboundConnection x -> OutboundConnection
$cfrom :: forall x. OutboundConnection -> Rep OutboundConnection x
Prelude.Generic)

-- |
-- Create a value of 'OutboundConnection' 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:
--
-- 'connectionAlias', 'outboundConnection_connectionAlias' - Name of the connection.
--
-- 'connectionId', 'outboundConnection_connectionId' - Unique identifier of the connection.
--
-- 'connectionStatus', 'outboundConnection_connectionStatus' - Status of the connection.
--
-- 'localDomainInfo', 'outboundConnection_localDomainInfo' - Information about the source (local) domain.
--
-- 'remoteDomainInfo', 'outboundConnection_remoteDomainInfo' - Information about the destination (remote) domain.
newOutboundConnection ::
  OutboundConnection
newOutboundConnection :: OutboundConnection
newOutboundConnection =
  OutboundConnection'
    { $sel:connectionAlias:OutboundConnection' :: Maybe Text
connectionAlias =
        forall a. Maybe a
Prelude.Nothing,
      $sel:connectionId:OutboundConnection' :: Maybe Text
connectionId = forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:OutboundConnection' :: Maybe OutboundConnectionStatus
connectionStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:localDomainInfo:OutboundConnection' :: Maybe DomainInformationContainer
localDomainInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:remoteDomainInfo:OutboundConnection' :: Maybe DomainInformationContainer
remoteDomainInfo = forall a. Maybe a
Prelude.Nothing
    }

-- | Name of the connection.
outboundConnection_connectionAlias :: Lens.Lens' OutboundConnection (Prelude.Maybe Prelude.Text)
outboundConnection_connectionAlias :: Lens' OutboundConnection (Maybe Text)
outboundConnection_connectionAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnection' {Maybe Text
connectionAlias :: Maybe Text
$sel:connectionAlias:OutboundConnection' :: OutboundConnection -> Maybe Text
connectionAlias} -> Maybe Text
connectionAlias) (\s :: OutboundConnection
s@OutboundConnection' {} Maybe Text
a -> OutboundConnection
s {$sel:connectionAlias:OutboundConnection' :: Maybe Text
connectionAlias = Maybe Text
a} :: OutboundConnection)

-- | Unique identifier of the connection.
outboundConnection_connectionId :: Lens.Lens' OutboundConnection (Prelude.Maybe Prelude.Text)
outboundConnection_connectionId :: Lens' OutboundConnection (Maybe Text)
outboundConnection_connectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnection' {Maybe Text
connectionId :: Maybe Text
$sel:connectionId:OutboundConnection' :: OutboundConnection -> Maybe Text
connectionId} -> Maybe Text
connectionId) (\s :: OutboundConnection
s@OutboundConnection' {} Maybe Text
a -> OutboundConnection
s {$sel:connectionId:OutboundConnection' :: Maybe Text
connectionId = Maybe Text
a} :: OutboundConnection)

-- | Status of the connection.
outboundConnection_connectionStatus :: Lens.Lens' OutboundConnection (Prelude.Maybe OutboundConnectionStatus)
outboundConnection_connectionStatus :: Lens' OutboundConnection (Maybe OutboundConnectionStatus)
outboundConnection_connectionStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnection' {Maybe OutboundConnectionStatus
connectionStatus :: Maybe OutboundConnectionStatus
$sel:connectionStatus:OutboundConnection' :: OutboundConnection -> Maybe OutboundConnectionStatus
connectionStatus} -> Maybe OutboundConnectionStatus
connectionStatus) (\s :: OutboundConnection
s@OutboundConnection' {} Maybe OutboundConnectionStatus
a -> OutboundConnection
s {$sel:connectionStatus:OutboundConnection' :: Maybe OutboundConnectionStatus
connectionStatus = Maybe OutboundConnectionStatus
a} :: OutboundConnection)

-- | Information about the source (local) domain.
outboundConnection_localDomainInfo :: Lens.Lens' OutboundConnection (Prelude.Maybe DomainInformationContainer)
outboundConnection_localDomainInfo :: Lens' OutboundConnection (Maybe DomainInformationContainer)
outboundConnection_localDomainInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnection' {Maybe DomainInformationContainer
localDomainInfo :: Maybe DomainInformationContainer
$sel:localDomainInfo:OutboundConnection' :: OutboundConnection -> Maybe DomainInformationContainer
localDomainInfo} -> Maybe DomainInformationContainer
localDomainInfo) (\s :: OutboundConnection
s@OutboundConnection' {} Maybe DomainInformationContainer
a -> OutboundConnection
s {$sel:localDomainInfo:OutboundConnection' :: Maybe DomainInformationContainer
localDomainInfo = Maybe DomainInformationContainer
a} :: OutboundConnection)

-- | Information about the destination (remote) domain.
outboundConnection_remoteDomainInfo :: Lens.Lens' OutboundConnection (Prelude.Maybe DomainInformationContainer)
outboundConnection_remoteDomainInfo :: Lens' OutboundConnection (Maybe DomainInformationContainer)
outboundConnection_remoteDomainInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnection' {Maybe DomainInformationContainer
remoteDomainInfo :: Maybe DomainInformationContainer
$sel:remoteDomainInfo:OutboundConnection' :: OutboundConnection -> Maybe DomainInformationContainer
remoteDomainInfo} -> Maybe DomainInformationContainer
remoteDomainInfo) (\s :: OutboundConnection
s@OutboundConnection' {} Maybe DomainInformationContainer
a -> OutboundConnection
s {$sel:remoteDomainInfo:OutboundConnection' :: Maybe DomainInformationContainer
remoteDomainInfo = Maybe DomainInformationContainer
a} :: OutboundConnection)

instance Data.FromJSON OutboundConnection where
  parseJSON :: Value -> Parser OutboundConnection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutboundConnection"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe OutboundConnectionStatus
-> Maybe DomainInformationContainer
-> Maybe DomainInformationContainer
-> OutboundConnection
OutboundConnection'
            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
"ConnectionAlias")
            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
"ConnectionId")
            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
"ConnectionStatus")
            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
"LocalDomainInfo")
            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
"RemoteDomainInfo")
      )

instance Prelude.Hashable OutboundConnection where
  hashWithSalt :: Int -> OutboundConnection -> Int
hashWithSalt Int
_salt OutboundConnection' {Maybe Text
Maybe DomainInformationContainer
Maybe OutboundConnectionStatus
remoteDomainInfo :: Maybe DomainInformationContainer
localDomainInfo :: Maybe DomainInformationContainer
connectionStatus :: Maybe OutboundConnectionStatus
connectionId :: Maybe Text
connectionAlias :: Maybe Text
$sel:remoteDomainInfo:OutboundConnection' :: OutboundConnection -> Maybe DomainInformationContainer
$sel:localDomainInfo:OutboundConnection' :: OutboundConnection -> Maybe DomainInformationContainer
$sel:connectionStatus:OutboundConnection' :: OutboundConnection -> Maybe OutboundConnectionStatus
$sel:connectionId:OutboundConnection' :: OutboundConnection -> Maybe Text
$sel:connectionAlias:OutboundConnection' :: OutboundConnection -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionAlias
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutboundConnectionStatus
connectionStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DomainInformationContainer
localDomainInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DomainInformationContainer
remoteDomainInfo

instance Prelude.NFData OutboundConnection where
  rnf :: OutboundConnection -> ()
rnf OutboundConnection' {Maybe Text
Maybe DomainInformationContainer
Maybe OutboundConnectionStatus
remoteDomainInfo :: Maybe DomainInformationContainer
localDomainInfo :: Maybe DomainInformationContainer
connectionStatus :: Maybe OutboundConnectionStatus
connectionId :: Maybe Text
connectionAlias :: Maybe Text
$sel:remoteDomainInfo:OutboundConnection' :: OutboundConnection -> Maybe DomainInformationContainer
$sel:localDomainInfo:OutboundConnection' :: OutboundConnection -> Maybe DomainInformationContainer
$sel:connectionStatus:OutboundConnection' :: OutboundConnection -> Maybe OutboundConnectionStatus
$sel:connectionId:OutboundConnection' :: OutboundConnection -> Maybe Text
$sel:connectionAlias:OutboundConnection' :: OutboundConnection -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionAlias
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OutboundConnectionStatus
connectionStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DomainInformationContainer
localDomainInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DomainInformationContainer
remoteDomainInfo