{-# 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.DirectConnect.Types.VirtualGateway
-- 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.DirectConnect.Types.VirtualGateway where

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

-- | Information about a virtual private gateway for a private virtual
-- interface.
--
-- /See:/ 'newVirtualGateway' smart constructor.
data VirtualGateway = VirtualGateway'
  { -- | The ID of the virtual private gateway.
    VirtualGateway -> Maybe Text
virtualGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The state of the virtual private gateway. The following are the possible
    -- values:
    --
    -- -   @pending@: Initial state after creating the virtual private gateway.
    --
    -- -   @available@: Ready for use by a private virtual interface.
    --
    -- -   @deleting@: Initial state after deleting the virtual private
    --     gateway.
    --
    -- -   @deleted@: The virtual private gateway is deleted. The private
    --     virtual interface is unable to send traffic over this gateway.
    VirtualGateway -> Maybe Text
virtualGatewayState :: Prelude.Maybe Prelude.Text
  }
  deriving (VirtualGateway -> VirtualGateway -> Bool
(VirtualGateway -> VirtualGateway -> Bool)
-> (VirtualGateway -> VirtualGateway -> Bool) -> Eq VirtualGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGateway -> VirtualGateway -> Bool
$c/= :: VirtualGateway -> VirtualGateway -> Bool
== :: VirtualGateway -> VirtualGateway -> Bool
$c== :: VirtualGateway -> VirtualGateway -> Bool
Prelude.Eq, ReadPrec [VirtualGateway]
ReadPrec VirtualGateway
Int -> ReadS VirtualGateway
ReadS [VirtualGateway]
(Int -> ReadS VirtualGateway)
-> ReadS [VirtualGateway]
-> ReadPrec VirtualGateway
-> ReadPrec [VirtualGateway]
-> Read VirtualGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGateway]
$creadListPrec :: ReadPrec [VirtualGateway]
readPrec :: ReadPrec VirtualGateway
$creadPrec :: ReadPrec VirtualGateway
readList :: ReadS [VirtualGateway]
$creadList :: ReadS [VirtualGateway]
readsPrec :: Int -> ReadS VirtualGateway
$creadsPrec :: Int -> ReadS VirtualGateway
Prelude.Read, Int -> VirtualGateway -> ShowS
[VirtualGateway] -> ShowS
VirtualGateway -> String
(Int -> VirtualGateway -> ShowS)
-> (VirtualGateway -> String)
-> ([VirtualGateway] -> ShowS)
-> Show VirtualGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGateway] -> ShowS
$cshowList :: [VirtualGateway] -> ShowS
show :: VirtualGateway -> String
$cshow :: VirtualGateway -> String
showsPrec :: Int -> VirtualGateway -> ShowS
$cshowsPrec :: Int -> VirtualGateway -> ShowS
Prelude.Show, (forall x. VirtualGateway -> Rep VirtualGateway x)
-> (forall x. Rep VirtualGateway x -> VirtualGateway)
-> Generic VirtualGateway
forall x. Rep VirtualGateway x -> VirtualGateway
forall x. VirtualGateway -> Rep VirtualGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualGateway x -> VirtualGateway
$cfrom :: forall x. VirtualGateway -> Rep VirtualGateway x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGateway' 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:
--
-- 'virtualGatewayId', 'virtualGateway_virtualGatewayId' - The ID of the virtual private gateway.
--
-- 'virtualGatewayState', 'virtualGateway_virtualGatewayState' - The state of the virtual private gateway. The following are the possible
-- values:
--
-- -   @pending@: Initial state after creating the virtual private gateway.
--
-- -   @available@: Ready for use by a private virtual interface.
--
-- -   @deleting@: Initial state after deleting the virtual private
--     gateway.
--
-- -   @deleted@: The virtual private gateway is deleted. The private
--     virtual interface is unable to send traffic over this gateway.
newVirtualGateway ::
  VirtualGateway
newVirtualGateway :: VirtualGateway
newVirtualGateway =
  VirtualGateway' :: Maybe Text -> Maybe Text -> VirtualGateway
VirtualGateway'
    { $sel:virtualGatewayId:VirtualGateway' :: Maybe Text
virtualGatewayId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:virtualGatewayState:VirtualGateway' :: Maybe Text
virtualGatewayState = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the virtual private gateway.
virtualGateway_virtualGatewayId :: Lens.Lens' VirtualGateway (Prelude.Maybe Prelude.Text)
virtualGateway_virtualGatewayId :: (Maybe Text -> f (Maybe Text))
-> VirtualGateway -> f VirtualGateway
virtualGateway_virtualGatewayId = (VirtualGateway -> Maybe Text)
-> (VirtualGateway -> Maybe Text -> VirtualGateway)
-> Lens VirtualGateway VirtualGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGateway' {Maybe Text
virtualGatewayId :: Maybe Text
$sel:virtualGatewayId:VirtualGateway' :: VirtualGateway -> Maybe Text
virtualGatewayId} -> Maybe Text
virtualGatewayId) (\s :: VirtualGateway
s@VirtualGateway' {} Maybe Text
a -> VirtualGateway
s {$sel:virtualGatewayId:VirtualGateway' :: Maybe Text
virtualGatewayId = Maybe Text
a} :: VirtualGateway)

-- | The state of the virtual private gateway. The following are the possible
-- values:
--
-- -   @pending@: Initial state after creating the virtual private gateway.
--
-- -   @available@: Ready for use by a private virtual interface.
--
-- -   @deleting@: Initial state after deleting the virtual private
--     gateway.
--
-- -   @deleted@: The virtual private gateway is deleted. The private
--     virtual interface is unable to send traffic over this gateway.
virtualGateway_virtualGatewayState :: Lens.Lens' VirtualGateway (Prelude.Maybe Prelude.Text)
virtualGateway_virtualGatewayState :: (Maybe Text -> f (Maybe Text))
-> VirtualGateway -> f VirtualGateway
virtualGateway_virtualGatewayState = (VirtualGateway -> Maybe Text)
-> (VirtualGateway -> Maybe Text -> VirtualGateway)
-> Lens VirtualGateway VirtualGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGateway' {Maybe Text
virtualGatewayState :: Maybe Text
$sel:virtualGatewayState:VirtualGateway' :: VirtualGateway -> Maybe Text
virtualGatewayState} -> Maybe Text
virtualGatewayState) (\s :: VirtualGateway
s@VirtualGateway' {} Maybe Text
a -> VirtualGateway
s {$sel:virtualGatewayState:VirtualGateway' :: Maybe Text
virtualGatewayState = Maybe Text
a} :: VirtualGateway)

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

instance Prelude.Hashable VirtualGateway

instance Prelude.NFData VirtualGateway