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

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

-- | The connection status of an outbound cross-cluster connection.
--
-- /See:/ 'newOutboundConnectionStatus' smart constructor.
data OutboundConnectionStatus = OutboundConnectionStatus'
  { -- | Verbose information for the outbound connection status.
    OutboundConnectionStatus -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The state code for the outbound connection. Can be one of the following:
    --
    -- -   VALIDATING: The outbound connection request is being validated.
    -- -   VALIDATION_FAILED: Validation failed for the connection request.
    -- -   PENDING_ACCEPTANCE: Outbound connection request is validated and is
    --     not yet accepted by the remote domain owner.
    -- -   APPROVED: Outbound connection has been approved by the remote domain
    --     owner for getting provisioned.
    -- -   PROVISIONING: Outbound connection request is in process.
    -- -   ACTIVE: Outbound connection is active and ready to use.
    -- -   REJECTING: Outbound connection rejection by remote domain owner is
    --     in progress.
    -- -   REJECTED: Outbound connection request is rejected by remote domain
    --     owner.
    -- -   DELETING: Outbound connection deletion is in progress.
    -- -   DELETED: Outbound connection is deleted and can no longer be used.
    OutboundConnectionStatus -> Maybe OutboundConnectionStatusCode
statusCode :: Prelude.Maybe OutboundConnectionStatusCode
  }
  deriving (OutboundConnectionStatus -> OutboundConnectionStatus -> Bool
(OutboundConnectionStatus -> OutboundConnectionStatus -> Bool)
-> (OutboundConnectionStatus -> OutboundConnectionStatus -> Bool)
-> Eq OutboundConnectionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutboundConnectionStatus -> OutboundConnectionStatus -> Bool
$c/= :: OutboundConnectionStatus -> OutboundConnectionStatus -> Bool
== :: OutboundConnectionStatus -> OutboundConnectionStatus -> Bool
$c== :: OutboundConnectionStatus -> OutboundConnectionStatus -> Bool
Prelude.Eq, ReadPrec [OutboundConnectionStatus]
ReadPrec OutboundConnectionStatus
Int -> ReadS OutboundConnectionStatus
ReadS [OutboundConnectionStatus]
(Int -> ReadS OutboundConnectionStatus)
-> ReadS [OutboundConnectionStatus]
-> ReadPrec OutboundConnectionStatus
-> ReadPrec [OutboundConnectionStatus]
-> Read OutboundConnectionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutboundConnectionStatus]
$creadListPrec :: ReadPrec [OutboundConnectionStatus]
readPrec :: ReadPrec OutboundConnectionStatus
$creadPrec :: ReadPrec OutboundConnectionStatus
readList :: ReadS [OutboundConnectionStatus]
$creadList :: ReadS [OutboundConnectionStatus]
readsPrec :: Int -> ReadS OutboundConnectionStatus
$creadsPrec :: Int -> ReadS OutboundConnectionStatus
Prelude.Read, Int -> OutboundConnectionStatus -> ShowS
[OutboundConnectionStatus] -> ShowS
OutboundConnectionStatus -> String
(Int -> OutboundConnectionStatus -> ShowS)
-> (OutboundConnectionStatus -> String)
-> ([OutboundConnectionStatus] -> ShowS)
-> Show OutboundConnectionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutboundConnectionStatus] -> ShowS
$cshowList :: [OutboundConnectionStatus] -> ShowS
show :: OutboundConnectionStatus -> String
$cshow :: OutboundConnectionStatus -> String
showsPrec :: Int -> OutboundConnectionStatus -> ShowS
$cshowsPrec :: Int -> OutboundConnectionStatus -> ShowS
Prelude.Show, (forall x.
 OutboundConnectionStatus -> Rep OutboundConnectionStatus x)
-> (forall x.
    Rep OutboundConnectionStatus x -> OutboundConnectionStatus)
-> Generic OutboundConnectionStatus
forall x.
Rep OutboundConnectionStatus x -> OutboundConnectionStatus
forall x.
OutboundConnectionStatus -> Rep OutboundConnectionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OutboundConnectionStatus x -> OutboundConnectionStatus
$cfrom :: forall x.
OutboundConnectionStatus -> Rep OutboundConnectionStatus x
Prelude.Generic)

-- |
-- Create a value of 'OutboundConnectionStatus' 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', 'outboundConnectionStatus_message' - Verbose information for the outbound connection status.
--
-- 'statusCode', 'outboundConnectionStatus_statusCode' - The state code for the outbound connection. Can be one of the following:
--
-- -   VALIDATING: The outbound connection request is being validated.
-- -   VALIDATION_FAILED: Validation failed for the connection request.
-- -   PENDING_ACCEPTANCE: Outbound connection request is validated and is
--     not yet accepted by the remote domain owner.
-- -   APPROVED: Outbound connection has been approved by the remote domain
--     owner for getting provisioned.
-- -   PROVISIONING: Outbound connection request is in process.
-- -   ACTIVE: Outbound connection is active and ready to use.
-- -   REJECTING: Outbound connection rejection by remote domain owner is
--     in progress.
-- -   REJECTED: Outbound connection request is rejected by remote domain
--     owner.
-- -   DELETING: Outbound connection deletion is in progress.
-- -   DELETED: Outbound connection is deleted and can no longer be used.
newOutboundConnectionStatus ::
  OutboundConnectionStatus
newOutboundConnectionStatus :: OutboundConnectionStatus
newOutboundConnectionStatus =
  OutboundConnectionStatus' :: Maybe Text
-> Maybe OutboundConnectionStatusCode -> OutboundConnectionStatus
OutboundConnectionStatus'
    { $sel:message:OutboundConnectionStatus' :: Maybe Text
message =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:OutboundConnectionStatus' :: Maybe OutboundConnectionStatusCode
statusCode = Maybe OutboundConnectionStatusCode
forall a. Maybe a
Prelude.Nothing
    }

-- | Verbose information for the outbound connection status.
outboundConnectionStatus_message :: Lens.Lens' OutboundConnectionStatus (Prelude.Maybe Prelude.Text)
outboundConnectionStatus_message :: (Maybe Text -> f (Maybe Text))
-> OutboundConnectionStatus -> f OutboundConnectionStatus
outboundConnectionStatus_message = (OutboundConnectionStatus -> Maybe Text)
-> (OutboundConnectionStatus
    -> Maybe Text -> OutboundConnectionStatus)
-> Lens
     OutboundConnectionStatus
     OutboundConnectionStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnectionStatus' {Maybe Text
message :: Maybe Text
$sel:message:OutboundConnectionStatus' :: OutboundConnectionStatus -> Maybe Text
message} -> Maybe Text
message) (\s :: OutboundConnectionStatus
s@OutboundConnectionStatus' {} Maybe Text
a -> OutboundConnectionStatus
s {$sel:message:OutboundConnectionStatus' :: Maybe Text
message = Maybe Text
a} :: OutboundConnectionStatus)

-- | The state code for the outbound connection. Can be one of the following:
--
-- -   VALIDATING: The outbound connection request is being validated.
-- -   VALIDATION_FAILED: Validation failed for the connection request.
-- -   PENDING_ACCEPTANCE: Outbound connection request is validated and is
--     not yet accepted by the remote domain owner.
-- -   APPROVED: Outbound connection has been approved by the remote domain
--     owner for getting provisioned.
-- -   PROVISIONING: Outbound connection request is in process.
-- -   ACTIVE: Outbound connection is active and ready to use.
-- -   REJECTING: Outbound connection rejection by remote domain owner is
--     in progress.
-- -   REJECTED: Outbound connection request is rejected by remote domain
--     owner.
-- -   DELETING: Outbound connection deletion is in progress.
-- -   DELETED: Outbound connection is deleted and can no longer be used.
outboundConnectionStatus_statusCode :: Lens.Lens' OutboundConnectionStatus (Prelude.Maybe OutboundConnectionStatusCode)
outboundConnectionStatus_statusCode :: (Maybe OutboundConnectionStatusCode
 -> f (Maybe OutboundConnectionStatusCode))
-> OutboundConnectionStatus -> f OutboundConnectionStatus
outboundConnectionStatus_statusCode = (OutboundConnectionStatus -> Maybe OutboundConnectionStatusCode)
-> (OutboundConnectionStatus
    -> Maybe OutboundConnectionStatusCode -> OutboundConnectionStatus)
-> Lens
     OutboundConnectionStatus
     OutboundConnectionStatus
     (Maybe OutboundConnectionStatusCode)
     (Maybe OutboundConnectionStatusCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutboundConnectionStatus' {Maybe OutboundConnectionStatusCode
statusCode :: Maybe OutboundConnectionStatusCode
$sel:statusCode:OutboundConnectionStatus' :: OutboundConnectionStatus -> Maybe OutboundConnectionStatusCode
statusCode} -> Maybe OutboundConnectionStatusCode
statusCode) (\s :: OutboundConnectionStatus
s@OutboundConnectionStatus' {} Maybe OutboundConnectionStatusCode
a -> OutboundConnectionStatus
s {$sel:statusCode:OutboundConnectionStatus' :: Maybe OutboundConnectionStatusCode
statusCode = Maybe OutboundConnectionStatusCode
a} :: OutboundConnectionStatus)

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

instance Prelude.Hashable OutboundConnectionStatus

instance Prelude.NFData OutboundConnectionStatus