{-# 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-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.InboundConnection 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.InboundConnectionStatus
import qualified Amazonka.Prelude as Prelude

-- | Describes an inbound cross-cluster connection for Amazon OpenSearch
-- Service. For more information, see
-- <https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cross-cluster-search.html Cross-cluster search for Amazon OpenSearch Service>.
--
-- /See:/ 'newInboundConnection' smart constructor.
data InboundConnection = InboundConnection'
  { -- | The unique identifier of the connection.
    InboundConnection -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
    -- | The current status of the connection.
    InboundConnection -> Maybe InboundConnectionStatus
connectionStatus :: Prelude.Maybe InboundConnectionStatus,
    -- | Information about the source (local) domain.
    InboundConnection -> Maybe DomainInformationContainer
localDomainInfo :: Prelude.Maybe DomainInformationContainer,
    -- | Information about the destination (remote) domain.
    InboundConnection -> Maybe DomainInformationContainer
remoteDomainInfo :: Prelude.Maybe DomainInformationContainer
  }
  deriving (InboundConnection -> InboundConnection -> Bool
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]
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
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. 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:
--
-- 'connectionId', 'inboundConnection_connectionId' - The unique identifier of the connection.
--
-- 'connectionStatus', 'inboundConnection_connectionStatus' - The current status of the connection.
--
-- 'localDomainInfo', 'inboundConnection_localDomainInfo' - Information about the source (local) domain.
--
-- 'remoteDomainInfo', 'inboundConnection_remoteDomainInfo' - Information about the destination (remote) domain.
newInboundConnection ::
  InboundConnection
newInboundConnection :: InboundConnection
newInboundConnection =
  InboundConnection'
    { $sel:connectionId:InboundConnection' :: Maybe Text
connectionId = forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:InboundConnection' :: Maybe InboundConnectionStatus
connectionStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:localDomainInfo:InboundConnection' :: Maybe DomainInformationContainer
localDomainInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:remoteDomainInfo:InboundConnection' :: Maybe DomainInformationContainer
remoteDomainInfo = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier of the connection.
inboundConnection_connectionId :: Lens.Lens' InboundConnection (Prelude.Maybe Prelude.Text)
inboundConnection_connectionId :: Lens' InboundConnection (Maybe Text)
inboundConnection_connectionId = 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 current status of the connection.
inboundConnection_connectionStatus :: Lens.Lens' InboundConnection (Prelude.Maybe InboundConnectionStatus)
inboundConnection_connectionStatus :: Lens' InboundConnection (Maybe InboundConnectionStatus)
inboundConnection_connectionStatus = 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)

-- | Information about the source (local) domain.
inboundConnection_localDomainInfo :: Lens.Lens' InboundConnection (Prelude.Maybe DomainInformationContainer)
inboundConnection_localDomainInfo :: Lens' InboundConnection (Maybe DomainInformationContainer)
inboundConnection_localDomainInfo = 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)

-- | Information about the destination (remote) domain.
inboundConnection_remoteDomainInfo :: Lens.Lens' InboundConnection (Prelude.Maybe DomainInformationContainer)
inboundConnection_remoteDomainInfo :: Lens' InboundConnection (Maybe DomainInformationContainer)
inboundConnection_remoteDomainInfo = 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)

instance Data.FromJSON InboundConnection where
  parseJSON :: Value -> Parser InboundConnection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InboundConnection"
      ( \Object
x ->
          Maybe Text
-> Maybe InboundConnectionStatus
-> Maybe DomainInformationContainer
-> Maybe DomainInformationContainer
-> InboundConnection
InboundConnection'
            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
"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 InboundConnection where
  hashWithSalt :: Int -> InboundConnection -> Int
hashWithSalt Int
_salt InboundConnection' {Maybe Text
Maybe DomainInformationContainer
Maybe InboundConnectionStatus
remoteDomainInfo :: Maybe DomainInformationContainer
localDomainInfo :: Maybe DomainInformationContainer
connectionStatus :: Maybe InboundConnectionStatus
connectionId :: Maybe Text
$sel:remoteDomainInfo:InboundConnection' :: InboundConnection -> Maybe DomainInformationContainer
$sel:localDomainInfo:InboundConnection' :: InboundConnection -> Maybe DomainInformationContainer
$sel:connectionStatus:InboundConnection' :: InboundConnection -> Maybe InboundConnectionStatus
$sel:connectionId:InboundConnection' :: InboundConnection -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InboundConnectionStatus
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 InboundConnection where
  rnf :: InboundConnection -> ()
rnf InboundConnection' {Maybe Text
Maybe DomainInformationContainer
Maybe InboundConnectionStatus
remoteDomainInfo :: Maybe DomainInformationContainer
localDomainInfo :: Maybe DomainInformationContainer
connectionStatus :: Maybe InboundConnectionStatus
connectionId :: Maybe Text
$sel:remoteDomainInfo:InboundConnection' :: InboundConnection -> Maybe DomainInformationContainer
$sel:localDomainInfo:InboundConnection' :: InboundConnection -> Maybe DomainInformationContainer
$sel:connectionStatus:InboundConnection' :: InboundConnection -> Maybe InboundConnectionStatus
$sel:connectionId:InboundConnection' :: InboundConnection -> Maybe Text
..} =
    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 InboundConnectionStatus
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