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

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

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

-- |
-- Create a value of 'InboundCrossClusterSearchConnection' 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', 'inboundCrossClusterSearchConnection_destinationDomainInfo' - Specifies the @DomainInformation@ for the destination Elasticsearch
-- domain.
--
-- 'crossClusterSearchConnectionId', 'inboundCrossClusterSearchConnection_crossClusterSearchConnectionId' - Specifies the connection id for the inbound cross-cluster search
-- connection.
--
-- 'connectionStatus', 'inboundCrossClusterSearchConnection_connectionStatus' - Specifies the @InboundCrossClusterSearchConnectionStatus@ for the
-- outbound connection.
--
-- 'sourceDomainInfo', 'inboundCrossClusterSearchConnection_sourceDomainInfo' - Specifies the @DomainInformation@ for the source Elasticsearch domain.
newInboundCrossClusterSearchConnection ::
  InboundCrossClusterSearchConnection
newInboundCrossClusterSearchConnection :: InboundCrossClusterSearchConnection
newInboundCrossClusterSearchConnection =
  InboundCrossClusterSearchConnection' :: Maybe DomainInformation
-> Maybe Text
-> Maybe InboundCrossClusterSearchConnectionStatus
-> Maybe DomainInformation
-> InboundCrossClusterSearchConnection
InboundCrossClusterSearchConnection'
    { $sel:destinationDomainInfo:InboundCrossClusterSearchConnection' :: Maybe DomainInformation
destinationDomainInfo =
        Maybe DomainInformation
forall a. Maybe a
Prelude.Nothing,
      $sel:crossClusterSearchConnectionId:InboundCrossClusterSearchConnection' :: Maybe Text
crossClusterSearchConnectionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:InboundCrossClusterSearchConnection' :: Maybe InboundCrossClusterSearchConnectionStatus
connectionStatus = Maybe InboundCrossClusterSearchConnectionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceDomainInfo:InboundCrossClusterSearchConnection' :: Maybe DomainInformation
sourceDomainInfo = Maybe DomainInformation
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

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

instance
  Prelude.NFData
    InboundCrossClusterSearchConnection