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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.InboundConnectionStatusCode
import qualified Amazonka.Prelude as Prelude

-- | The connection status of an inbound cross-cluster connection.
--
-- /See:/ 'newInboundConnectionStatus' smart constructor.
data InboundConnectionStatus = InboundConnectionStatus'
  { -- | Verbose information for the inbound connection status.
    InboundConnectionStatus -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The state code for the inbound 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 provisioning is in progress.
    -- -   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
(InboundConnectionStatus -> InboundConnectionStatus -> Bool)
-> (InboundConnectionStatus -> InboundConnectionStatus -> Bool)
-> Eq InboundConnectionStatus
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]
(Int -> ReadS InboundConnectionStatus)
-> ReadS [InboundConnectionStatus]
-> ReadPrec InboundConnectionStatus
-> ReadPrec [InboundConnectionStatus]
-> Read 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
(Int -> InboundConnectionStatus -> ShowS)
-> (InboundConnectionStatus -> String)
-> ([InboundConnectionStatus] -> ShowS)
-> Show InboundConnectionStatus
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.
 InboundConnectionStatus -> Rep InboundConnectionStatus x)
-> (forall x.
    Rep InboundConnectionStatus x -> InboundConnectionStatus)
-> Generic InboundConnectionStatus
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' - Verbose information for the inbound connection status.
--
-- 'statusCode', 'inboundConnectionStatus_statusCode' - The state code for the inbound 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 provisioning is in progress.
-- -   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' :: Maybe Text
-> Maybe InboundConnectionStatusCode -> InboundConnectionStatus
InboundConnectionStatus'
    { $sel:message:InboundConnectionStatus' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:InboundConnectionStatus' :: Maybe InboundConnectionStatusCode
statusCode = Maybe InboundConnectionStatusCode
forall a. Maybe a
Prelude.Nothing
    }

-- | Verbose information for the inbound connection status.
inboundConnectionStatus_message :: Lens.Lens' InboundConnectionStatus (Prelude.Maybe Prelude.Text)
inboundConnectionStatus_message :: (Maybe Text -> f (Maybe Text))
-> InboundConnectionStatus -> f InboundConnectionStatus
inboundConnectionStatus_message = (InboundConnectionStatus -> Maybe Text)
-> (InboundConnectionStatus
    -> Maybe Text -> InboundConnectionStatus)
-> Lens
     InboundConnectionStatus
     InboundConnectionStatus
     (Maybe Text)
     (Maybe Text)
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 state code for the inbound 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 provisioning is in progress.
-- -   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 :: (Maybe InboundConnectionStatusCode
 -> f (Maybe InboundConnectionStatusCode))
-> InboundConnectionStatus -> f InboundConnectionStatus
inboundConnectionStatus_statusCode = (InboundConnectionStatus -> Maybe InboundConnectionStatusCode)
-> (InboundConnectionStatus
    -> Maybe InboundConnectionStatusCode -> InboundConnectionStatus)
-> Lens
     InboundConnectionStatus
     InboundConnectionStatus
     (Maybe InboundConnectionStatusCode)
     (Maybe InboundConnectionStatusCode)
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 Core.FromJSON InboundConnectionStatus where
  parseJSON :: Value -> Parser InboundConnectionStatus
parseJSON =
    String
-> (Object -> Parser InboundConnectionStatus)
-> Value
-> Parser InboundConnectionStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InboundConnectionStatus"
      ( \Object
x ->
          Maybe Text
-> Maybe InboundConnectionStatusCode -> InboundConnectionStatus
InboundConnectionStatus'
            (Maybe Text
 -> Maybe InboundConnectionStatusCode -> InboundConnectionStatus)
-> Parser (Maybe Text)
-> Parser
     (Maybe InboundConnectionStatusCode -> InboundConnectionStatus)
forall (f :: * -> *) a b. Functor 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
"Message")
            Parser
  (Maybe InboundConnectionStatusCode -> InboundConnectionStatus)
-> Parser (Maybe InboundConnectionStatusCode)
-> Parser InboundConnectionStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InboundConnectionStatusCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusCode")
      )

instance Prelude.Hashable InboundConnectionStatus

instance Prelude.NFData InboundConnectionStatus