{-# 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.GameLift.Types.VpcPeeringConnectionStatus
-- 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.GameLift.Types.VpcPeeringConnectionStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents status information for a VPC peering connection. Status is
-- associated with a VpcPeeringConnection object. Status codes and messages
-- are provided from EC2 (see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_VpcPeeringConnectionStateReason.html VpcPeeringConnectionStateReason>).
-- Connection status information is also communicated as a fleet Event.
--
-- /See:/ 'newVpcPeeringConnectionStatus' smart constructor.
data VpcPeeringConnectionStatus = VpcPeeringConnectionStatus'
  { -- | Code indicating the status of a VPC peering connection.
    VpcPeeringConnectionStatus -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | Additional messaging associated with the connection status.
    VpcPeeringConnectionStatus -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcPeeringConnectionStatus -> VpcPeeringConnectionStatus -> Bool
(VpcPeeringConnectionStatus -> VpcPeeringConnectionStatus -> Bool)
-> (VpcPeeringConnectionStatus
    -> VpcPeeringConnectionStatus -> Bool)
-> Eq VpcPeeringConnectionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcPeeringConnectionStatus -> VpcPeeringConnectionStatus -> Bool
$c/= :: VpcPeeringConnectionStatus -> VpcPeeringConnectionStatus -> Bool
== :: VpcPeeringConnectionStatus -> VpcPeeringConnectionStatus -> Bool
$c== :: VpcPeeringConnectionStatus -> VpcPeeringConnectionStatus -> Bool
Prelude.Eq, ReadPrec [VpcPeeringConnectionStatus]
ReadPrec VpcPeeringConnectionStatus
Int -> ReadS VpcPeeringConnectionStatus
ReadS [VpcPeeringConnectionStatus]
(Int -> ReadS VpcPeeringConnectionStatus)
-> ReadS [VpcPeeringConnectionStatus]
-> ReadPrec VpcPeeringConnectionStatus
-> ReadPrec [VpcPeeringConnectionStatus]
-> Read VpcPeeringConnectionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcPeeringConnectionStatus]
$creadListPrec :: ReadPrec [VpcPeeringConnectionStatus]
readPrec :: ReadPrec VpcPeeringConnectionStatus
$creadPrec :: ReadPrec VpcPeeringConnectionStatus
readList :: ReadS [VpcPeeringConnectionStatus]
$creadList :: ReadS [VpcPeeringConnectionStatus]
readsPrec :: Int -> ReadS VpcPeeringConnectionStatus
$creadsPrec :: Int -> ReadS VpcPeeringConnectionStatus
Prelude.Read, Int -> VpcPeeringConnectionStatus -> ShowS
[VpcPeeringConnectionStatus] -> ShowS
VpcPeeringConnectionStatus -> String
(Int -> VpcPeeringConnectionStatus -> ShowS)
-> (VpcPeeringConnectionStatus -> String)
-> ([VpcPeeringConnectionStatus] -> ShowS)
-> Show VpcPeeringConnectionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcPeeringConnectionStatus] -> ShowS
$cshowList :: [VpcPeeringConnectionStatus] -> ShowS
show :: VpcPeeringConnectionStatus -> String
$cshow :: VpcPeeringConnectionStatus -> String
showsPrec :: Int -> VpcPeeringConnectionStatus -> ShowS
$cshowsPrec :: Int -> VpcPeeringConnectionStatus -> ShowS
Prelude.Show, (forall x.
 VpcPeeringConnectionStatus -> Rep VpcPeeringConnectionStatus x)
-> (forall x.
    Rep VpcPeeringConnectionStatus x -> VpcPeeringConnectionStatus)
-> Generic VpcPeeringConnectionStatus
forall x.
Rep VpcPeeringConnectionStatus x -> VpcPeeringConnectionStatus
forall x.
VpcPeeringConnectionStatus -> Rep VpcPeeringConnectionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VpcPeeringConnectionStatus x -> VpcPeeringConnectionStatus
$cfrom :: forall x.
VpcPeeringConnectionStatus -> Rep VpcPeeringConnectionStatus x
Prelude.Generic)

-- |
-- Create a value of 'VpcPeeringConnectionStatus' 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:
--
-- 'code', 'vpcPeeringConnectionStatus_code' - Code indicating the status of a VPC peering connection.
--
-- 'message', 'vpcPeeringConnectionStatus_message' - Additional messaging associated with the connection status.
newVpcPeeringConnectionStatus ::
  VpcPeeringConnectionStatus
newVpcPeeringConnectionStatus :: VpcPeeringConnectionStatus
newVpcPeeringConnectionStatus =
  VpcPeeringConnectionStatus' :: Maybe Text -> Maybe Text -> VpcPeeringConnectionStatus
VpcPeeringConnectionStatus'
    { $sel:code:VpcPeeringConnectionStatus' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:VpcPeeringConnectionStatus' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Code indicating the status of a VPC peering connection.
vpcPeeringConnectionStatus_code :: Lens.Lens' VpcPeeringConnectionStatus (Prelude.Maybe Prelude.Text)
vpcPeeringConnectionStatus_code :: (Maybe Text -> f (Maybe Text))
-> VpcPeeringConnectionStatus -> f VpcPeeringConnectionStatus
vpcPeeringConnectionStatus_code = (VpcPeeringConnectionStatus -> Maybe Text)
-> (VpcPeeringConnectionStatus
    -> Maybe Text -> VpcPeeringConnectionStatus)
-> Lens
     VpcPeeringConnectionStatus
     VpcPeeringConnectionStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnectionStatus' {Maybe Text
code :: Maybe Text
$sel:code:VpcPeeringConnectionStatus' :: VpcPeeringConnectionStatus -> Maybe Text
code} -> Maybe Text
code) (\s :: VpcPeeringConnectionStatus
s@VpcPeeringConnectionStatus' {} Maybe Text
a -> VpcPeeringConnectionStatus
s {$sel:code:VpcPeeringConnectionStatus' :: Maybe Text
code = Maybe Text
a} :: VpcPeeringConnectionStatus)

-- | Additional messaging associated with the connection status.
vpcPeeringConnectionStatus_message :: Lens.Lens' VpcPeeringConnectionStatus (Prelude.Maybe Prelude.Text)
vpcPeeringConnectionStatus_message :: (Maybe Text -> f (Maybe Text))
-> VpcPeeringConnectionStatus -> f VpcPeeringConnectionStatus
vpcPeeringConnectionStatus_message = (VpcPeeringConnectionStatus -> Maybe Text)
-> (VpcPeeringConnectionStatus
    -> Maybe Text -> VpcPeeringConnectionStatus)
-> Lens
     VpcPeeringConnectionStatus
     VpcPeeringConnectionStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnectionStatus' {Maybe Text
message :: Maybe Text
$sel:message:VpcPeeringConnectionStatus' :: VpcPeeringConnectionStatus -> Maybe Text
message} -> Maybe Text
message) (\s :: VpcPeeringConnectionStatus
s@VpcPeeringConnectionStatus' {} Maybe Text
a -> VpcPeeringConnectionStatus
s {$sel:message:VpcPeeringConnectionStatus' :: Maybe Text
message = Maybe Text
a} :: VpcPeeringConnectionStatus)

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

instance Prelude.Hashable VpcPeeringConnectionStatus

instance Prelude.NFData VpcPeeringConnectionStatus