{-# 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.ElasticSearch.Types.OutboundCrossClusterSearchConnection
-- 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.ElasticSearch.Types.OutboundCrossClusterSearchConnection where

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types.DomainInformation
import Amazonka.ElasticSearch.Types.OutboundCrossClusterSearchConnectionStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies details of an outbound connection.
--
-- /See:/ 'newOutboundCrossClusterSearchConnection' smart constructor.
data OutboundCrossClusterSearchConnection = OutboundCrossClusterSearchConnection'
  { -- | Specifies the @DomainInformation@ for the destination Elasticsearch
    -- domain.
    OutboundCrossClusterSearchConnection -> Maybe DomainInformation
destinationDomainInfo :: Prelude.Maybe DomainInformation,
    -- | Specifies the connection alias for the outbound cross-cluster search
    -- connection.
    OutboundCrossClusterSearchConnection -> Maybe Text
connectionAlias :: Prelude.Maybe Prelude.Text,
    -- | Specifies the connection id for the outbound cross-cluster search
    -- connection.
    OutboundCrossClusterSearchConnection -> Maybe Text
crossClusterSearchConnectionId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the @OutboundCrossClusterSearchConnectionStatus@ for the
    -- outbound connection.
    OutboundCrossClusterSearchConnection
-> Maybe OutboundCrossClusterSearchConnectionStatus
connectionStatus :: Prelude.Maybe OutboundCrossClusterSearchConnectionStatus,
    -- | Specifies the @DomainInformation@ for the source Elasticsearch domain.
    OutboundCrossClusterSearchConnection -> Maybe DomainInformation
sourceDomainInfo :: Prelude.Maybe DomainInformation
  }
  deriving (OutboundCrossClusterSearchConnection
-> OutboundCrossClusterSearchConnection -> Bool
(OutboundCrossClusterSearchConnection
 -> OutboundCrossClusterSearchConnection -> Bool)
-> (OutboundCrossClusterSearchConnection
    -> OutboundCrossClusterSearchConnection -> Bool)
-> Eq OutboundCrossClusterSearchConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutboundCrossClusterSearchConnection
-> OutboundCrossClusterSearchConnection -> Bool
$c/= :: OutboundCrossClusterSearchConnection
-> OutboundCrossClusterSearchConnection -> Bool
== :: OutboundCrossClusterSearchConnection
-> OutboundCrossClusterSearchConnection -> Bool
$c== :: OutboundCrossClusterSearchConnection
-> OutboundCrossClusterSearchConnection -> Bool
Prelude.Eq, ReadPrec [OutboundCrossClusterSearchConnection]
ReadPrec OutboundCrossClusterSearchConnection
Int -> ReadS OutboundCrossClusterSearchConnection
ReadS [OutboundCrossClusterSearchConnection]
(Int -> ReadS OutboundCrossClusterSearchConnection)
-> ReadS [OutboundCrossClusterSearchConnection]
-> ReadPrec OutboundCrossClusterSearchConnection
-> ReadPrec [OutboundCrossClusterSearchConnection]
-> Read OutboundCrossClusterSearchConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutboundCrossClusterSearchConnection]
$creadListPrec :: ReadPrec [OutboundCrossClusterSearchConnection]
readPrec :: ReadPrec OutboundCrossClusterSearchConnection
$creadPrec :: ReadPrec OutboundCrossClusterSearchConnection
readList :: ReadS [OutboundCrossClusterSearchConnection]
$creadList :: ReadS [OutboundCrossClusterSearchConnection]
readsPrec :: Int -> ReadS OutboundCrossClusterSearchConnection
$creadsPrec :: Int -> ReadS OutboundCrossClusterSearchConnection
Prelude.Read, Int -> OutboundCrossClusterSearchConnection -> ShowS
[OutboundCrossClusterSearchConnection] -> ShowS
OutboundCrossClusterSearchConnection -> String
(Int -> OutboundCrossClusterSearchConnection -> ShowS)
-> (OutboundCrossClusterSearchConnection -> String)
-> ([OutboundCrossClusterSearchConnection] -> ShowS)
-> Show OutboundCrossClusterSearchConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutboundCrossClusterSearchConnection] -> ShowS
$cshowList :: [OutboundCrossClusterSearchConnection] -> ShowS
show :: OutboundCrossClusterSearchConnection -> String
$cshow :: OutboundCrossClusterSearchConnection -> String
showsPrec :: Int -> OutboundCrossClusterSearchConnection -> ShowS
$cshowsPrec :: Int -> OutboundCrossClusterSearchConnection -> ShowS
Prelude.Show, (forall x.
 OutboundCrossClusterSearchConnection
 -> Rep OutboundCrossClusterSearchConnection x)
-> (forall x.
    Rep OutboundCrossClusterSearchConnection x
    -> OutboundCrossClusterSearchConnection)
-> Generic OutboundCrossClusterSearchConnection
forall x.
Rep OutboundCrossClusterSearchConnection x
-> OutboundCrossClusterSearchConnection
forall x.
OutboundCrossClusterSearchConnection
-> Rep OutboundCrossClusterSearchConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OutboundCrossClusterSearchConnection x
-> OutboundCrossClusterSearchConnection
$cfrom :: forall x.
OutboundCrossClusterSearchConnection
-> Rep OutboundCrossClusterSearchConnection x
Prelude.Generic)

-- |
-- Create a value of 'OutboundCrossClusterSearchConnection' 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:
--
-- 'destinationDomainInfo', 'outboundCrossClusterSearchConnection_destinationDomainInfo' - Specifies the @DomainInformation@ for the destination Elasticsearch
-- domain.
--
-- 'connectionAlias', 'outboundCrossClusterSearchConnection_connectionAlias' - Specifies the connection alias for the outbound cross-cluster search
-- connection.
--
-- 'crossClusterSearchConnectionId', 'outboundCrossClusterSearchConnection_crossClusterSearchConnectionId' - Specifies the connection id for the outbound cross-cluster search
-- connection.
--
-- 'connectionStatus', 'outboundCrossClusterSearchConnection_connectionStatus' - Specifies the @OutboundCrossClusterSearchConnectionStatus@ for the
-- outbound connection.
--
-- 'sourceDomainInfo', 'outboundCrossClusterSearchConnection_sourceDomainInfo' - Specifies the @DomainInformation@ for the source Elasticsearch domain.
newOutboundCrossClusterSearchConnection ::
  OutboundCrossClusterSearchConnection
newOutboundCrossClusterSearchConnection :: OutboundCrossClusterSearchConnection
newOutboundCrossClusterSearchConnection =
  OutboundCrossClusterSearchConnection' :: Maybe DomainInformation
-> Maybe Text
-> Maybe Text
-> Maybe OutboundCrossClusterSearchConnectionStatus
-> Maybe DomainInformation
-> OutboundCrossClusterSearchConnection
OutboundCrossClusterSearchConnection'
    { $sel:destinationDomainInfo:OutboundCrossClusterSearchConnection' :: Maybe DomainInformation
destinationDomainInfo =
        Maybe DomainInformation
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionAlias:OutboundCrossClusterSearchConnection' :: Maybe Text
connectionAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:crossClusterSearchConnectionId:OutboundCrossClusterSearchConnection' :: Maybe Text
crossClusterSearchConnectionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:OutboundCrossClusterSearchConnection' :: Maybe OutboundCrossClusterSearchConnectionStatus
connectionStatus = Maybe OutboundCrossClusterSearchConnectionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceDomainInfo:OutboundCrossClusterSearchConnection' :: Maybe DomainInformation
sourceDomainInfo = Maybe DomainInformation
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the @DomainInformation@ for the destination Elasticsearch
-- domain.
outboundCrossClusterSearchConnection_destinationDomainInfo :: Lens.Lens' OutboundCrossClusterSearchConnection (Prelude.Maybe DomainInformation)
outboundCrossClusterSearchConnection_destinationDomainInfo :: (Maybe DomainInformation -> f (Maybe DomainInformation))
-> OutboundCrossClusterSearchConnection
-> f OutboundCrossClusterSearchConnection
outboundCrossClusterSearchConnection_destinationDomainInfo = (OutboundCrossClusterSearchConnection -> Maybe DomainInformation)
-> (OutboundCrossClusterSearchConnection
    -> Maybe DomainInformation -> OutboundCrossClusterSearchConnection)
-> Lens
     OutboundCrossClusterSearchConnection
     OutboundCrossClusterSearchConnection
     (Maybe DomainInformation)
     (Maybe DomainInformation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCrossClusterSearchConnection' {Maybe DomainInformation
destinationDomainInfo :: Maybe DomainInformation
$sel:destinationDomainInfo:OutboundCrossClusterSearchConnection' :: OutboundCrossClusterSearchConnection -> Maybe DomainInformation
destinationDomainInfo} -> Maybe DomainInformation
destinationDomainInfo) (\s :: OutboundCrossClusterSearchConnection
s@OutboundCrossClusterSearchConnection' {} Maybe DomainInformation
a -> OutboundCrossClusterSearchConnection
s {$sel:destinationDomainInfo:OutboundCrossClusterSearchConnection' :: Maybe DomainInformation
destinationDomainInfo = Maybe DomainInformation
a} :: OutboundCrossClusterSearchConnection)

-- | Specifies the connection alias for the outbound cross-cluster search
-- connection.
outboundCrossClusterSearchConnection_connectionAlias :: Lens.Lens' OutboundCrossClusterSearchConnection (Prelude.Maybe Prelude.Text)
outboundCrossClusterSearchConnection_connectionAlias :: (Maybe Text -> f (Maybe Text))
-> OutboundCrossClusterSearchConnection
-> f OutboundCrossClusterSearchConnection
outboundCrossClusterSearchConnection_connectionAlias = (OutboundCrossClusterSearchConnection -> Maybe Text)
-> (OutboundCrossClusterSearchConnection
    -> Maybe Text -> OutboundCrossClusterSearchConnection)
-> Lens
     OutboundCrossClusterSearchConnection
     OutboundCrossClusterSearchConnection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCrossClusterSearchConnection' {Maybe Text
connectionAlias :: Maybe Text
$sel:connectionAlias:OutboundCrossClusterSearchConnection' :: OutboundCrossClusterSearchConnection -> Maybe Text
connectionAlias} -> Maybe Text
connectionAlias) (\s :: OutboundCrossClusterSearchConnection
s@OutboundCrossClusterSearchConnection' {} Maybe Text
a -> OutboundCrossClusterSearchConnection
s {$sel:connectionAlias:OutboundCrossClusterSearchConnection' :: Maybe Text
connectionAlias = Maybe Text
a} :: OutboundCrossClusterSearchConnection)

-- | Specifies the connection id for the outbound cross-cluster search
-- connection.
outboundCrossClusterSearchConnection_crossClusterSearchConnectionId :: Lens.Lens' OutboundCrossClusterSearchConnection (Prelude.Maybe Prelude.Text)
outboundCrossClusterSearchConnection_crossClusterSearchConnectionId :: (Maybe Text -> f (Maybe Text))
-> OutboundCrossClusterSearchConnection
-> f OutboundCrossClusterSearchConnection
outboundCrossClusterSearchConnection_crossClusterSearchConnectionId = (OutboundCrossClusterSearchConnection -> Maybe Text)
-> (OutboundCrossClusterSearchConnection
    -> Maybe Text -> OutboundCrossClusterSearchConnection)
-> Lens
     OutboundCrossClusterSearchConnection
     OutboundCrossClusterSearchConnection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCrossClusterSearchConnection' {Maybe Text
crossClusterSearchConnectionId :: Maybe Text
$sel:crossClusterSearchConnectionId:OutboundCrossClusterSearchConnection' :: OutboundCrossClusterSearchConnection -> Maybe Text
crossClusterSearchConnectionId} -> Maybe Text
crossClusterSearchConnectionId) (\s :: OutboundCrossClusterSearchConnection
s@OutboundCrossClusterSearchConnection' {} Maybe Text
a -> OutboundCrossClusterSearchConnection
s {$sel:crossClusterSearchConnectionId:OutboundCrossClusterSearchConnection' :: Maybe Text
crossClusterSearchConnectionId = Maybe Text
a} :: OutboundCrossClusterSearchConnection)

-- | Specifies the @OutboundCrossClusterSearchConnectionStatus@ for the
-- outbound connection.
outboundCrossClusterSearchConnection_connectionStatus :: Lens.Lens' OutboundCrossClusterSearchConnection (Prelude.Maybe OutboundCrossClusterSearchConnectionStatus)
outboundCrossClusterSearchConnection_connectionStatus :: (Maybe OutboundCrossClusterSearchConnectionStatus
 -> f (Maybe OutboundCrossClusterSearchConnectionStatus))
-> OutboundCrossClusterSearchConnection
-> f OutboundCrossClusterSearchConnection
outboundCrossClusterSearchConnection_connectionStatus = (OutboundCrossClusterSearchConnection
 -> Maybe OutboundCrossClusterSearchConnectionStatus)
-> (OutboundCrossClusterSearchConnection
    -> Maybe OutboundCrossClusterSearchConnectionStatus
    -> OutboundCrossClusterSearchConnection)
-> Lens
     OutboundCrossClusterSearchConnection
     OutboundCrossClusterSearchConnection
     (Maybe OutboundCrossClusterSearchConnectionStatus)
     (Maybe OutboundCrossClusterSearchConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCrossClusterSearchConnection' {Maybe OutboundCrossClusterSearchConnectionStatus
connectionStatus :: Maybe OutboundCrossClusterSearchConnectionStatus
$sel:connectionStatus:OutboundCrossClusterSearchConnection' :: OutboundCrossClusterSearchConnection
-> Maybe OutboundCrossClusterSearchConnectionStatus
connectionStatus} -> Maybe OutboundCrossClusterSearchConnectionStatus
connectionStatus) (\s :: OutboundCrossClusterSearchConnection
s@OutboundCrossClusterSearchConnection' {} Maybe OutboundCrossClusterSearchConnectionStatus
a -> OutboundCrossClusterSearchConnection
s {$sel:connectionStatus:OutboundCrossClusterSearchConnection' :: Maybe OutboundCrossClusterSearchConnectionStatus
connectionStatus = Maybe OutboundCrossClusterSearchConnectionStatus
a} :: OutboundCrossClusterSearchConnection)

-- | Specifies the @DomainInformation@ for the source Elasticsearch domain.
outboundCrossClusterSearchConnection_sourceDomainInfo :: Lens.Lens' OutboundCrossClusterSearchConnection (Prelude.Maybe DomainInformation)
outboundCrossClusterSearchConnection_sourceDomainInfo :: (Maybe DomainInformation -> f (Maybe DomainInformation))
-> OutboundCrossClusterSearchConnection
-> f OutboundCrossClusterSearchConnection
outboundCrossClusterSearchConnection_sourceDomainInfo = (OutboundCrossClusterSearchConnection -> Maybe DomainInformation)
-> (OutboundCrossClusterSearchConnection
    -> Maybe DomainInformation -> OutboundCrossClusterSearchConnection)
-> Lens
     OutboundCrossClusterSearchConnection
     OutboundCrossClusterSearchConnection
     (Maybe DomainInformation)
     (Maybe DomainInformation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundCrossClusterSearchConnection' {Maybe DomainInformation
sourceDomainInfo :: Maybe DomainInformation
$sel:sourceDomainInfo:OutboundCrossClusterSearchConnection' :: OutboundCrossClusterSearchConnection -> Maybe DomainInformation
sourceDomainInfo} -> Maybe DomainInformation
sourceDomainInfo) (\s :: OutboundCrossClusterSearchConnection
s@OutboundCrossClusterSearchConnection' {} Maybe DomainInformation
a -> OutboundCrossClusterSearchConnection
s {$sel:sourceDomainInfo:OutboundCrossClusterSearchConnection' :: Maybe DomainInformation
sourceDomainInfo = Maybe DomainInformation
a} :: OutboundCrossClusterSearchConnection)

instance
  Core.FromJSON
    OutboundCrossClusterSearchConnection
  where
  parseJSON :: Value -> Parser OutboundCrossClusterSearchConnection
parseJSON =
    String
-> (Object -> Parser OutboundCrossClusterSearchConnection)
-> Value
-> Parser OutboundCrossClusterSearchConnection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutboundCrossClusterSearchConnection"
      ( \Object
x ->
          Maybe DomainInformation
-> Maybe Text
-> Maybe Text
-> Maybe OutboundCrossClusterSearchConnectionStatus
-> Maybe DomainInformation
-> OutboundCrossClusterSearchConnection
OutboundCrossClusterSearchConnection'
            (Maybe DomainInformation
 -> Maybe Text
 -> Maybe Text
 -> Maybe OutboundCrossClusterSearchConnectionStatus
 -> Maybe DomainInformation
 -> OutboundCrossClusterSearchConnection)
-> Parser (Maybe DomainInformation)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe OutboundCrossClusterSearchConnectionStatus
      -> Maybe DomainInformation
      -> OutboundCrossClusterSearchConnection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DomainInformation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationDomainInfo")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe OutboundCrossClusterSearchConnectionStatus
   -> Maybe DomainInformation
   -> OutboundCrossClusterSearchConnection)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe OutboundCrossClusterSearchConnectionStatus
      -> Maybe DomainInformation
      -> OutboundCrossClusterSearchConnection)
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 Text
   -> Maybe OutboundCrossClusterSearchConnectionStatus
   -> Maybe DomainInformation
   -> OutboundCrossClusterSearchConnection)
-> Parser (Maybe Text)
-> Parser
     (Maybe OutboundCrossClusterSearchConnectionStatus
      -> Maybe DomainInformation -> OutboundCrossClusterSearchConnection)
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
"CrossClusterSearchConnectionId")
            Parser
  (Maybe OutboundCrossClusterSearchConnectionStatus
   -> Maybe DomainInformation -> OutboundCrossClusterSearchConnection)
-> Parser (Maybe OutboundCrossClusterSearchConnectionStatus)
-> Parser
     (Maybe DomainInformation -> OutboundCrossClusterSearchConnection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe OutboundCrossClusterSearchConnectionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConnectionStatus")
            Parser
  (Maybe DomainInformation -> OutboundCrossClusterSearchConnection)
-> Parser (Maybe DomainInformation)
-> Parser OutboundCrossClusterSearchConnection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DomainInformation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceDomainInfo")
      )

instance
  Prelude.Hashable
    OutboundCrossClusterSearchConnection

instance
  Prelude.NFData
    OutboundCrossClusterSearchConnection