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

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

-- | Details of an inbound connection.
--
-- /See:/ 'newInboundConnection' smart constructor.
data InboundConnection = InboundConnection'
  { -- | The @ AWSDomainInformation @ for the remote OpenSearch domain.
    InboundConnection -> Maybe DomainInformationContainer
remoteDomainInfo :: Prelude.Maybe DomainInformationContainer,
    -- | The @ AWSDomainInformation @ for the local OpenSearch domain.
    InboundConnection -> Maybe DomainInformationContainer
localDomainInfo :: Prelude.Maybe DomainInformationContainer,
    -- | The connection ID for the inbound cross-cluster connection.
    InboundConnection -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
    -- | The @ InboundConnectionStatus @ for the outbound connection.
    InboundConnection -> Maybe InboundConnectionStatus
connectionStatus :: Prelude.Maybe InboundConnectionStatus
  }
  deriving (InboundConnection -> InboundConnection -> Bool
(InboundConnection -> InboundConnection -> Bool)
-> (InboundConnection -> InboundConnection -> Bool)
-> Eq InboundConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InboundConnection -> InboundConnection -> Bool
$c/= :: InboundConnection -> InboundConnection -> Bool
== :: InboundConnection -> InboundConnection -> Bool
$c== :: InboundConnection -> InboundConnection -> Bool
Prelude.Eq, ReadPrec [InboundConnection]
ReadPrec InboundConnection
Int -> ReadS InboundConnection
ReadS [InboundConnection]
(Int -> ReadS InboundConnection)
-> ReadS [InboundConnection]
-> ReadPrec InboundConnection
-> ReadPrec [InboundConnection]
-> Read InboundConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InboundConnection]
$creadListPrec :: ReadPrec [InboundConnection]
readPrec :: ReadPrec InboundConnection
$creadPrec :: ReadPrec InboundConnection
readList :: ReadS [InboundConnection]
$creadList :: ReadS [InboundConnection]
readsPrec :: Int -> ReadS InboundConnection
$creadsPrec :: Int -> ReadS InboundConnection
Prelude.Read, Int -> InboundConnection -> ShowS
[InboundConnection] -> ShowS
InboundConnection -> String
(Int -> InboundConnection -> ShowS)
-> (InboundConnection -> String)
-> ([InboundConnection] -> ShowS)
-> Show InboundConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InboundConnection] -> ShowS
$cshowList :: [InboundConnection] -> ShowS
show :: InboundConnection -> String
$cshow :: InboundConnection -> String
showsPrec :: Int -> InboundConnection -> ShowS
$cshowsPrec :: Int -> InboundConnection -> ShowS
Prelude.Show, (forall x. InboundConnection -> Rep InboundConnection x)
-> (forall x. Rep InboundConnection x -> InboundConnection)
-> Generic InboundConnection
forall x. Rep InboundConnection x -> InboundConnection
forall x. InboundConnection -> Rep InboundConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InboundConnection x -> InboundConnection
$cfrom :: forall x. InboundConnection -> Rep InboundConnection x
Prelude.Generic)

-- |
-- Create a value of 'InboundConnection' 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', 'inboundConnection_remoteDomainInfo' - The @ AWSDomainInformation @ for the remote OpenSearch domain.
--
-- 'localDomainInfo', 'inboundConnection_localDomainInfo' - The @ AWSDomainInformation @ for the local OpenSearch domain.
--
-- 'connectionId', 'inboundConnection_connectionId' - The connection ID for the inbound cross-cluster connection.
--
-- 'connectionStatus', 'inboundConnection_connectionStatus' - The @ InboundConnectionStatus @ for the outbound connection.
newInboundConnection ::
  InboundConnection
newInboundConnection :: InboundConnection
newInboundConnection =
  InboundConnection' :: Maybe DomainInformationContainer
-> Maybe DomainInformationContainer
-> Maybe Text
-> Maybe InboundConnectionStatus
-> InboundConnection
InboundConnection'
    { $sel:remoteDomainInfo:InboundConnection' :: Maybe DomainInformationContainer
remoteDomainInfo =
        Maybe DomainInformationContainer
forall a. Maybe a
Prelude.Nothing,
      $sel:localDomainInfo:InboundConnection' :: Maybe DomainInformationContainer
localDomainInfo = Maybe DomainInformationContainer
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionId:InboundConnection' :: Maybe Text
connectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:InboundConnection' :: Maybe InboundConnectionStatus
connectionStatus = Maybe InboundConnectionStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The @ AWSDomainInformation @ for the remote OpenSearch domain.
inboundConnection_remoteDomainInfo :: Lens.Lens' InboundConnection (Prelude.Maybe DomainInformationContainer)
inboundConnection_remoteDomainInfo :: (Maybe DomainInformationContainer
 -> f (Maybe DomainInformationContainer))
-> InboundConnection -> f InboundConnection
inboundConnection_remoteDomainInfo = (InboundConnection -> Maybe DomainInformationContainer)
-> (InboundConnection
    -> Maybe DomainInformationContainer -> InboundConnection)
-> Lens
     InboundConnection
     InboundConnection
     (Maybe DomainInformationContainer)
     (Maybe DomainInformationContainer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboundConnection' {Maybe DomainInformationContainer
remoteDomainInfo :: Maybe DomainInformationContainer
$sel:remoteDomainInfo:InboundConnection' :: InboundConnection -> Maybe DomainInformationContainer
remoteDomainInfo} -> Maybe DomainInformationContainer
remoteDomainInfo) (\s :: InboundConnection
s@InboundConnection' {} Maybe DomainInformationContainer
a -> InboundConnection
s {$sel:remoteDomainInfo:InboundConnection' :: Maybe DomainInformationContainer
remoteDomainInfo = Maybe DomainInformationContainer
a} :: InboundConnection)

-- | The @ AWSDomainInformation @ for the local OpenSearch domain.
inboundConnection_localDomainInfo :: Lens.Lens' InboundConnection (Prelude.Maybe DomainInformationContainer)
inboundConnection_localDomainInfo :: (Maybe DomainInformationContainer
 -> f (Maybe DomainInformationContainer))
-> InboundConnection -> f InboundConnection
inboundConnection_localDomainInfo = (InboundConnection -> Maybe DomainInformationContainer)
-> (InboundConnection
    -> Maybe DomainInformationContainer -> InboundConnection)
-> Lens
     InboundConnection
     InboundConnection
     (Maybe DomainInformationContainer)
     (Maybe DomainInformationContainer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboundConnection' {Maybe DomainInformationContainer
localDomainInfo :: Maybe DomainInformationContainer
$sel:localDomainInfo:InboundConnection' :: InboundConnection -> Maybe DomainInformationContainer
localDomainInfo} -> Maybe DomainInformationContainer
localDomainInfo) (\s :: InboundConnection
s@InboundConnection' {} Maybe DomainInformationContainer
a -> InboundConnection
s {$sel:localDomainInfo:InboundConnection' :: Maybe DomainInformationContainer
localDomainInfo = Maybe DomainInformationContainer
a} :: InboundConnection)

-- | The connection ID for the inbound cross-cluster connection.
inboundConnection_connectionId :: Lens.Lens' InboundConnection (Prelude.Maybe Prelude.Text)
inboundConnection_connectionId :: (Maybe Text -> f (Maybe Text))
-> InboundConnection -> f InboundConnection
inboundConnection_connectionId = (InboundConnection -> Maybe Text)
-> (InboundConnection -> Maybe Text -> InboundConnection)
-> Lens
     InboundConnection InboundConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboundConnection' {Maybe Text
connectionId :: Maybe Text
$sel:connectionId:InboundConnection' :: InboundConnection -> Maybe Text
connectionId} -> Maybe Text
connectionId) (\s :: InboundConnection
s@InboundConnection' {} Maybe Text
a -> InboundConnection
s {$sel:connectionId:InboundConnection' :: Maybe Text
connectionId = Maybe Text
a} :: InboundConnection)

-- | The @ InboundConnectionStatus @ for the outbound connection.
inboundConnection_connectionStatus :: Lens.Lens' InboundConnection (Prelude.Maybe InboundConnectionStatus)
inboundConnection_connectionStatus :: (Maybe InboundConnectionStatus
 -> f (Maybe InboundConnectionStatus))
-> InboundConnection -> f InboundConnection
inboundConnection_connectionStatus = (InboundConnection -> Maybe InboundConnectionStatus)
-> (InboundConnection
    -> Maybe InboundConnectionStatus -> InboundConnection)
-> Lens
     InboundConnection
     InboundConnection
     (Maybe InboundConnectionStatus)
     (Maybe InboundConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboundConnection' {Maybe InboundConnectionStatus
connectionStatus :: Maybe InboundConnectionStatus
$sel:connectionStatus:InboundConnection' :: InboundConnection -> Maybe InboundConnectionStatus
connectionStatus} -> Maybe InboundConnectionStatus
connectionStatus) (\s :: InboundConnection
s@InboundConnection' {} Maybe InboundConnectionStatus
a -> InboundConnection
s {$sel:connectionStatus:InboundConnection' :: Maybe InboundConnectionStatus
connectionStatus = Maybe InboundConnectionStatus
a} :: InboundConnection)

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

instance Prelude.Hashable InboundConnection

instance Prelude.NFData InboundConnection