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

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

-- | Specifies details about an outbound connection.
--
-- /See:/ 'newOutboundConnection' smart constructor.
data OutboundConnection = OutboundConnection'
  { -- | The @ DomainInformation @ for the remote OpenSearch domain.
    OutboundConnection -> Maybe DomainInformationContainer
remoteDomainInfo :: Prelude.Maybe DomainInformationContainer,
    -- | The connection alias for the outbound cross-cluster connection.
    OutboundConnection -> Maybe Text
connectionAlias :: Prelude.Maybe Prelude.Text,
    -- | The @ DomainInformation @ for the local OpenSearch domain.
    OutboundConnection -> Maybe DomainInformationContainer
localDomainInfo :: Prelude.Maybe DomainInformationContainer,
    -- | The connection ID for the outbound cross-cluster connection.
    OutboundConnection -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
    -- | The @ OutboundConnectionStatus @ for the outbound connection.
    OutboundConnection -> Maybe OutboundConnectionStatus
connectionStatus :: Prelude.Maybe OutboundConnectionStatus
  }
  deriving (OutboundConnection -> OutboundConnection -> Bool
(OutboundConnection -> OutboundConnection -> Bool)
-> (OutboundConnection -> OutboundConnection -> Bool)
-> Eq OutboundConnection
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]
(Int -> ReadS OutboundConnection)
-> ReadS [OutboundConnection]
-> ReadPrec OutboundConnection
-> ReadPrec [OutboundConnection]
-> Read 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
(Int -> OutboundConnection -> ShowS)
-> (OutboundConnection -> String)
-> ([OutboundConnection] -> ShowS)
-> Show OutboundConnection
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. OutboundConnection -> Rep OutboundConnection x)
-> (forall x. Rep OutboundConnection x -> OutboundConnection)
-> Generic OutboundConnection
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:
--
-- 'remoteDomainInfo', 'outboundConnection_remoteDomainInfo' - The @ DomainInformation @ for the remote OpenSearch domain.
--
-- 'connectionAlias', 'outboundConnection_connectionAlias' - The connection alias for the outbound cross-cluster connection.
--
-- 'localDomainInfo', 'outboundConnection_localDomainInfo' - The @ DomainInformation @ for the local OpenSearch domain.
--
-- 'connectionId', 'outboundConnection_connectionId' - The connection ID for the outbound cross-cluster connection.
--
-- 'connectionStatus', 'outboundConnection_connectionStatus' - The @ OutboundConnectionStatus @ for the outbound connection.
newOutboundConnection ::
  OutboundConnection
newOutboundConnection :: OutboundConnection
newOutboundConnection =
  OutboundConnection' :: Maybe DomainInformationContainer
-> Maybe Text
-> Maybe DomainInformationContainer
-> Maybe Text
-> Maybe OutboundConnectionStatus
-> OutboundConnection
OutboundConnection'
    { $sel:remoteDomainInfo:OutboundConnection' :: Maybe DomainInformationContainer
remoteDomainInfo =
        Maybe DomainInformationContainer
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionAlias:OutboundConnection' :: Maybe Text
connectionAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:localDomainInfo:OutboundConnection' :: Maybe DomainInformationContainer
localDomainInfo = Maybe DomainInformationContainer
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionId:OutboundConnection' :: Maybe Text
connectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:OutboundConnection' :: Maybe OutboundConnectionStatus
connectionStatus = Maybe OutboundConnectionStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The @ DomainInformation @ for the remote OpenSearch domain.
outboundConnection_remoteDomainInfo :: Lens.Lens' OutboundConnection (Prelude.Maybe DomainInformationContainer)
outboundConnection_remoteDomainInfo :: (Maybe DomainInformationContainer
 -> f (Maybe DomainInformationContainer))
-> OutboundConnection -> f OutboundConnection
outboundConnection_remoteDomainInfo = (OutboundConnection -> Maybe DomainInformationContainer)
-> (OutboundConnection
    -> Maybe DomainInformationContainer -> OutboundConnection)
-> Lens
     OutboundConnection
     OutboundConnection
     (Maybe DomainInformationContainer)
     (Maybe DomainInformationContainer)
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)

-- | The connection alias for the outbound cross-cluster connection.
outboundConnection_connectionAlias :: Lens.Lens' OutboundConnection (Prelude.Maybe Prelude.Text)
outboundConnection_connectionAlias :: (Maybe Text -> f (Maybe Text))
-> OutboundConnection -> f OutboundConnection
outboundConnection_connectionAlias = (OutboundConnection -> Maybe Text)
-> (OutboundConnection -> Maybe Text -> OutboundConnection)
-> Lens
     OutboundConnection OutboundConnection (Maybe Text) (Maybe Text)
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)

-- | The @ DomainInformation @ for the local OpenSearch domain.
outboundConnection_localDomainInfo :: Lens.Lens' OutboundConnection (Prelude.Maybe DomainInformationContainer)
outboundConnection_localDomainInfo :: (Maybe DomainInformationContainer
 -> f (Maybe DomainInformationContainer))
-> OutboundConnection -> f OutboundConnection
outboundConnection_localDomainInfo = (OutboundConnection -> Maybe DomainInformationContainer)
-> (OutboundConnection
    -> Maybe DomainInformationContainer -> OutboundConnection)
-> Lens
     OutboundConnection
     OutboundConnection
     (Maybe DomainInformationContainer)
     (Maybe DomainInformationContainer)
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)

-- | The connection ID for the outbound cross-cluster connection.
outboundConnection_connectionId :: Lens.Lens' OutboundConnection (Prelude.Maybe Prelude.Text)
outboundConnection_connectionId :: (Maybe Text -> f (Maybe Text))
-> OutboundConnection -> f OutboundConnection
outboundConnection_connectionId = (OutboundConnection -> Maybe Text)
-> (OutboundConnection -> Maybe Text -> OutboundConnection)
-> Lens
     OutboundConnection OutboundConnection (Maybe Text) (Maybe Text)
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)

-- | The @ OutboundConnectionStatus @ for the outbound connection.
outboundConnection_connectionStatus :: Lens.Lens' OutboundConnection (Prelude.Maybe OutboundConnectionStatus)
outboundConnection_connectionStatus :: (Maybe OutboundConnectionStatus
 -> f (Maybe OutboundConnectionStatus))
-> OutboundConnection -> f OutboundConnection
outboundConnection_connectionStatus = (OutboundConnection -> Maybe OutboundConnectionStatus)
-> (OutboundConnection
    -> Maybe OutboundConnectionStatus -> OutboundConnection)
-> Lens
     OutboundConnection
     OutboundConnection
     (Maybe OutboundConnectionStatus)
     (Maybe OutboundConnectionStatus)
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)

instance Core.FromJSON OutboundConnection where
  parseJSON :: Value -> Parser OutboundConnection
parseJSON =
    String
-> (Object -> Parser OutboundConnection)
-> Value
-> Parser OutboundConnection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutboundConnection"
      ( \Object
x ->
          Maybe DomainInformationContainer
-> Maybe Text
-> Maybe DomainInformationContainer
-> Maybe Text
-> Maybe OutboundConnectionStatus
-> OutboundConnection
OutboundConnection'
            (Maybe DomainInformationContainer
 -> Maybe Text
 -> Maybe DomainInformationContainer
 -> Maybe Text
 -> Maybe OutboundConnectionStatus
 -> OutboundConnection)
-> Parser (Maybe DomainInformationContainer)
-> Parser
     (Maybe Text
      -> Maybe DomainInformationContainer
      -> Maybe Text
      -> Maybe OutboundConnectionStatus
      -> OutboundConnection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DomainInformationContainer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RemoteDomainInfo")
            Parser
  (Maybe Text
   -> Maybe DomainInformationContainer
   -> Maybe Text
   -> Maybe OutboundConnectionStatus
   -> OutboundConnection)
-> Parser (Maybe Text)
-> Parser
     (Maybe DomainInformationContainer
      -> Maybe Text
      -> Maybe OutboundConnectionStatus
      -> OutboundConnection)
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
"ConnectionAlias")
            Parser
  (Maybe DomainInformationContainer
   -> Maybe Text
   -> Maybe OutboundConnectionStatus
   -> OutboundConnection)
-> Parser (Maybe DomainInformationContainer)
-> Parser
     (Maybe Text
      -> Maybe OutboundConnectionStatus -> OutboundConnection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DomainInformationContainer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocalDomainInfo")
            Parser
  (Maybe Text
   -> Maybe OutboundConnectionStatus -> OutboundConnection)
-> Parser (Maybe Text)
-> Parser (Maybe OutboundConnectionStatus -> OutboundConnection)
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
"ConnectionId")
            Parser (Maybe OutboundConnectionStatus -> OutboundConnection)
-> Parser (Maybe OutboundConnectionStatus)
-> Parser OutboundConnection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OutboundConnectionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConnectionStatus")
      )

instance Prelude.Hashable OutboundConnection

instance Prelude.NFData OutboundConnection