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

-- | The status of an inbound cross-cluster connection for OpenSearch
-- Service.
--
-- /See:/ 'newInboundConnectionStatus' smart constructor.
data InboundConnectionStatus = InboundConnectionStatus'
  { -- | Information about the connection.
    InboundConnectionStatus -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The status code for the connection. Can be one of the following:
    --
    -- -   __PENDING_ACCEPTANCE__ - Inbound connection is not yet accepted by
    --     the remote domain owner.
    --
    -- -   __APPROVED__: Inbound connection is pending acceptance by the remote
    --     domain owner.
    --
    -- -   __PROVISIONING__: Inbound connection is being provisioned.
    --
    -- -   __ACTIVE__: Inbound connection is active and ready to use.
    --
    -- -   __REJECTING__: Inbound connection rejection is in process.
    --
    -- -   __REJECTED__: Inbound connection is rejected.
    --
    -- -   __DELETING__: Inbound connection deletion is in progress.
    --
    -- -   __DELETED__: Inbound connection is deleted and can no longer be
    --     used.
    InboundConnectionStatus -> Maybe InboundConnectionStatusCode
statusCode :: Prelude.Maybe InboundConnectionStatusCode
  }
  deriving (InboundConnectionStatus -> InboundConnectionStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InboundConnectionStatus -> InboundConnectionStatus -> Bool
$c/= :: InboundConnectionStatus -> InboundConnectionStatus -> Bool
== :: InboundConnectionStatus -> InboundConnectionStatus -> Bool
$c== :: InboundConnectionStatus -> InboundConnectionStatus -> Bool
Prelude.Eq, ReadPrec [InboundConnectionStatus]
ReadPrec InboundConnectionStatus
Int -> ReadS InboundConnectionStatus
ReadS [InboundConnectionStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InboundConnectionStatus]
$creadListPrec :: ReadPrec [InboundConnectionStatus]
readPrec :: ReadPrec InboundConnectionStatus
$creadPrec :: ReadPrec InboundConnectionStatus
readList :: ReadS [InboundConnectionStatus]
$creadList :: ReadS [InboundConnectionStatus]
readsPrec :: Int -> ReadS InboundConnectionStatus
$creadsPrec :: Int -> ReadS InboundConnectionStatus
Prelude.Read, Int -> InboundConnectionStatus -> ShowS
[InboundConnectionStatus] -> ShowS
InboundConnectionStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InboundConnectionStatus] -> ShowS
$cshowList :: [InboundConnectionStatus] -> ShowS
show :: InboundConnectionStatus -> String
$cshow :: InboundConnectionStatus -> String
showsPrec :: Int -> InboundConnectionStatus -> ShowS
$cshowsPrec :: Int -> InboundConnectionStatus -> ShowS
Prelude.Show, forall x. Rep InboundConnectionStatus x -> InboundConnectionStatus
forall x. InboundConnectionStatus -> Rep InboundConnectionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InboundConnectionStatus x -> InboundConnectionStatus
$cfrom :: forall x. InboundConnectionStatus -> Rep InboundConnectionStatus x
Prelude.Generic)

-- |
-- Create a value of 'InboundConnectionStatus' 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:
--
-- 'message', 'inboundConnectionStatus_message' - Information about the connection.
--
-- 'statusCode', 'inboundConnectionStatus_statusCode' - The status code for the connection. Can be one of the following:
--
-- -   __PENDING_ACCEPTANCE__ - Inbound connection is not yet accepted by
--     the remote domain owner.
--
-- -   __APPROVED__: Inbound connection is pending acceptance by the remote
--     domain owner.
--
-- -   __PROVISIONING__: Inbound connection is being provisioned.
--
-- -   __ACTIVE__: Inbound connection is active and ready to use.
--
-- -   __REJECTING__: Inbound connection rejection is in process.
--
-- -   __REJECTED__: Inbound connection is rejected.
--
-- -   __DELETING__: Inbound connection deletion is in progress.
--
-- -   __DELETED__: Inbound connection is deleted and can no longer be
--     used.
newInboundConnectionStatus ::
  InboundConnectionStatus
newInboundConnectionStatus :: InboundConnectionStatus
newInboundConnectionStatus =
  InboundConnectionStatus'
    { $sel:message:InboundConnectionStatus' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:InboundConnectionStatus' :: Maybe InboundConnectionStatusCode
statusCode = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the connection.
inboundConnectionStatus_message :: Lens.Lens' InboundConnectionStatus (Prelude.Maybe Prelude.Text)
inboundConnectionStatus_message :: Lens' InboundConnectionStatus (Maybe Text)
inboundConnectionStatus_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboundConnectionStatus' {Maybe Text
message :: Maybe Text
$sel:message:InboundConnectionStatus' :: InboundConnectionStatus -> Maybe Text
message} -> Maybe Text
message) (\s :: InboundConnectionStatus
s@InboundConnectionStatus' {} Maybe Text
a -> InboundConnectionStatus
s {$sel:message:InboundConnectionStatus' :: Maybe Text
message = Maybe Text
a} :: InboundConnectionStatus)

-- | The status code for the connection. Can be one of the following:
--
-- -   __PENDING_ACCEPTANCE__ - Inbound connection is not yet accepted by
--     the remote domain owner.
--
-- -   __APPROVED__: Inbound connection is pending acceptance by the remote
--     domain owner.
--
-- -   __PROVISIONING__: Inbound connection is being provisioned.
--
-- -   __ACTIVE__: Inbound connection is active and ready to use.
--
-- -   __REJECTING__: Inbound connection rejection is in process.
--
-- -   __REJECTED__: Inbound connection is rejected.
--
-- -   __DELETING__: Inbound connection deletion is in progress.
--
-- -   __DELETED__: Inbound connection is deleted and can no longer be
--     used.
inboundConnectionStatus_statusCode :: Lens.Lens' InboundConnectionStatus (Prelude.Maybe InboundConnectionStatusCode)
inboundConnectionStatus_statusCode :: Lens' InboundConnectionStatus (Maybe InboundConnectionStatusCode)
inboundConnectionStatus_statusCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InboundConnectionStatus' {Maybe InboundConnectionStatusCode
statusCode :: Maybe InboundConnectionStatusCode
$sel:statusCode:InboundConnectionStatus' :: InboundConnectionStatus -> Maybe InboundConnectionStatusCode
statusCode} -> Maybe InboundConnectionStatusCode
statusCode) (\s :: InboundConnectionStatus
s@InboundConnectionStatus' {} Maybe InboundConnectionStatusCode
a -> InboundConnectionStatus
s {$sel:statusCode:InboundConnectionStatus' :: Maybe InboundConnectionStatusCode
statusCode = Maybe InboundConnectionStatusCode
a} :: InboundConnectionStatus)

instance Data.FromJSON InboundConnectionStatus where
  parseJSON :: Value -> Parser InboundConnectionStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InboundConnectionStatus"
      ( \Object
x ->
          Maybe Text
-> Maybe InboundConnectionStatusCode -> InboundConnectionStatus
InboundConnectionStatus'
            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
"Message")
            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
"StatusCode")
      )

instance Prelude.Hashable InboundConnectionStatus where
  hashWithSalt :: Int -> InboundConnectionStatus -> Int
hashWithSalt Int
_salt InboundConnectionStatus' {Maybe Text
Maybe InboundConnectionStatusCode
statusCode :: Maybe InboundConnectionStatusCode
message :: Maybe Text
$sel:statusCode:InboundConnectionStatus' :: InboundConnectionStatus -> Maybe InboundConnectionStatusCode
$sel:message:InboundConnectionStatus' :: InboundConnectionStatus -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InboundConnectionStatusCode
statusCode

instance Prelude.NFData InboundConnectionStatus where
  rnf :: InboundConnectionStatus -> ()
rnf InboundConnectionStatus' {Maybe Text
Maybe InboundConnectionStatusCode
statusCode :: Maybe InboundConnectionStatusCode
message :: Maybe Text
$sel:statusCode:InboundConnectionStatus' :: InboundConnectionStatus -> Maybe InboundConnectionStatusCode
$sel:message:InboundConnectionStatus' :: InboundConnectionStatus -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InboundConnectionStatusCode
statusCode