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

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types.DirectConnectGatewayState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a Direct Connect gateway, which enables you to connect
-- virtual interfaces and virtual private gateway or transit gateways.
--
-- /See:/ 'newDirectConnectGateway' smart constructor.
data DirectConnectGateway = DirectConnectGateway'
  { -- | The ID of the Direct Connect gateway.
    DirectConnectGateway -> Maybe Text
directConnectGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The error message if the state of an object failed to advance.
    DirectConnectGateway -> Maybe Text
stateChangeError :: Prelude.Maybe Prelude.Text,
    -- | The autonomous system number (ASN) for the Amazon side of the
    -- connection.
    DirectConnectGateway -> Maybe Integer
amazonSideAsn :: Prelude.Maybe Prelude.Integer,
    -- | The name of the Direct Connect gateway.
    DirectConnectGateway -> Maybe Text
directConnectGatewayName :: Prelude.Maybe Prelude.Text,
    -- | The state of the Direct Connect gateway. The following are the possible
    -- values:
    --
    -- -   @pending@: The initial state after calling
    --     CreateDirectConnectGateway.
    --
    -- -   @available@: The Direct Connect gateway is ready for use.
    --
    -- -   @deleting@: The initial state after calling
    --     DeleteDirectConnectGateway.
    --
    -- -   @deleted@: The Direct Connect gateway is deleted and cannot pass
    --     traffic.
    DirectConnectGateway -> Maybe DirectConnectGatewayState
directConnectGatewayState :: Prelude.Maybe DirectConnectGatewayState,
    -- | The ID of the Amazon Web Services account that owns the Direct Connect
    -- gateway.
    DirectConnectGateway -> Maybe Text
ownerAccount :: Prelude.Maybe Prelude.Text
  }
  deriving (DirectConnectGateway -> DirectConnectGateway -> Bool
(DirectConnectGateway -> DirectConnectGateway -> Bool)
-> (DirectConnectGateway -> DirectConnectGateway -> Bool)
-> Eq DirectConnectGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DirectConnectGateway -> DirectConnectGateway -> Bool
$c/= :: DirectConnectGateway -> DirectConnectGateway -> Bool
== :: DirectConnectGateway -> DirectConnectGateway -> Bool
$c== :: DirectConnectGateway -> DirectConnectGateway -> Bool
Prelude.Eq, ReadPrec [DirectConnectGateway]
ReadPrec DirectConnectGateway
Int -> ReadS DirectConnectGateway
ReadS [DirectConnectGateway]
(Int -> ReadS DirectConnectGateway)
-> ReadS [DirectConnectGateway]
-> ReadPrec DirectConnectGateway
-> ReadPrec [DirectConnectGateway]
-> Read DirectConnectGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DirectConnectGateway]
$creadListPrec :: ReadPrec [DirectConnectGateway]
readPrec :: ReadPrec DirectConnectGateway
$creadPrec :: ReadPrec DirectConnectGateway
readList :: ReadS [DirectConnectGateway]
$creadList :: ReadS [DirectConnectGateway]
readsPrec :: Int -> ReadS DirectConnectGateway
$creadsPrec :: Int -> ReadS DirectConnectGateway
Prelude.Read, Int -> DirectConnectGateway -> ShowS
[DirectConnectGateway] -> ShowS
DirectConnectGateway -> String
(Int -> DirectConnectGateway -> ShowS)
-> (DirectConnectGateway -> String)
-> ([DirectConnectGateway] -> ShowS)
-> Show DirectConnectGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DirectConnectGateway] -> ShowS
$cshowList :: [DirectConnectGateway] -> ShowS
show :: DirectConnectGateway -> String
$cshow :: DirectConnectGateway -> String
showsPrec :: Int -> DirectConnectGateway -> ShowS
$cshowsPrec :: Int -> DirectConnectGateway -> ShowS
Prelude.Show, (forall x. DirectConnectGateway -> Rep DirectConnectGateway x)
-> (forall x. Rep DirectConnectGateway x -> DirectConnectGateway)
-> Generic DirectConnectGateway
forall x. Rep DirectConnectGateway x -> DirectConnectGateway
forall x. DirectConnectGateway -> Rep DirectConnectGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DirectConnectGateway x -> DirectConnectGateway
$cfrom :: forall x. DirectConnectGateway -> Rep DirectConnectGateway x
Prelude.Generic)

-- |
-- Create a value of 'DirectConnectGateway' 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:
--
-- 'directConnectGatewayId', 'directConnectGateway_directConnectGatewayId' - The ID of the Direct Connect gateway.
--
-- 'stateChangeError', 'directConnectGateway_stateChangeError' - The error message if the state of an object failed to advance.
--
-- 'amazonSideAsn', 'directConnectGateway_amazonSideAsn' - The autonomous system number (ASN) for the Amazon side of the
-- connection.
--
-- 'directConnectGatewayName', 'directConnectGateway_directConnectGatewayName' - The name of the Direct Connect gateway.
--
-- 'directConnectGatewayState', 'directConnectGateway_directConnectGatewayState' - The state of the Direct Connect gateway. The following are the possible
-- values:
--
-- -   @pending@: The initial state after calling
--     CreateDirectConnectGateway.
--
-- -   @available@: The Direct Connect gateway is ready for use.
--
-- -   @deleting@: The initial state after calling
--     DeleteDirectConnectGateway.
--
-- -   @deleted@: The Direct Connect gateway is deleted and cannot pass
--     traffic.
--
-- 'ownerAccount', 'directConnectGateway_ownerAccount' - The ID of the Amazon Web Services account that owns the Direct Connect
-- gateway.
newDirectConnectGateway ::
  DirectConnectGateway
newDirectConnectGateway :: DirectConnectGateway
newDirectConnectGateway =
  DirectConnectGateway' :: Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe DirectConnectGatewayState
-> Maybe Text
-> DirectConnectGateway
DirectConnectGateway'
    { $sel:directConnectGatewayId:DirectConnectGateway' :: Maybe Text
directConnectGatewayId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateChangeError:DirectConnectGateway' :: Maybe Text
stateChangeError = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amazonSideAsn:DirectConnectGateway' :: Maybe Integer
amazonSideAsn = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:directConnectGatewayName:DirectConnectGateway' :: Maybe Text
directConnectGatewayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:directConnectGatewayState:DirectConnectGateway' :: Maybe DirectConnectGatewayState
directConnectGatewayState = Maybe DirectConnectGatewayState
forall a. Maybe a
Prelude.Nothing,
      $sel:ownerAccount:DirectConnectGateway' :: Maybe Text
ownerAccount = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the Direct Connect gateway.
directConnectGateway_directConnectGatewayId :: Lens.Lens' DirectConnectGateway (Prelude.Maybe Prelude.Text)
directConnectGateway_directConnectGatewayId :: (Maybe Text -> f (Maybe Text))
-> DirectConnectGateway -> f DirectConnectGateway
directConnectGateway_directConnectGatewayId = (DirectConnectGateway -> Maybe Text)
-> (DirectConnectGateway -> Maybe Text -> DirectConnectGateway)
-> Lens
     DirectConnectGateway DirectConnectGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectConnectGateway' {Maybe Text
directConnectGatewayId :: Maybe Text
$sel:directConnectGatewayId:DirectConnectGateway' :: DirectConnectGateway -> Maybe Text
directConnectGatewayId} -> Maybe Text
directConnectGatewayId) (\s :: DirectConnectGateway
s@DirectConnectGateway' {} Maybe Text
a -> DirectConnectGateway
s {$sel:directConnectGatewayId:DirectConnectGateway' :: Maybe Text
directConnectGatewayId = Maybe Text
a} :: DirectConnectGateway)

-- | The error message if the state of an object failed to advance.
directConnectGateway_stateChangeError :: Lens.Lens' DirectConnectGateway (Prelude.Maybe Prelude.Text)
directConnectGateway_stateChangeError :: (Maybe Text -> f (Maybe Text))
-> DirectConnectGateway -> f DirectConnectGateway
directConnectGateway_stateChangeError = (DirectConnectGateway -> Maybe Text)
-> (DirectConnectGateway -> Maybe Text -> DirectConnectGateway)
-> Lens
     DirectConnectGateway DirectConnectGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectConnectGateway' {Maybe Text
stateChangeError :: Maybe Text
$sel:stateChangeError:DirectConnectGateway' :: DirectConnectGateway -> Maybe Text
stateChangeError} -> Maybe Text
stateChangeError) (\s :: DirectConnectGateway
s@DirectConnectGateway' {} Maybe Text
a -> DirectConnectGateway
s {$sel:stateChangeError:DirectConnectGateway' :: Maybe Text
stateChangeError = Maybe Text
a} :: DirectConnectGateway)

-- | The autonomous system number (ASN) for the Amazon side of the
-- connection.
directConnectGateway_amazonSideAsn :: Lens.Lens' DirectConnectGateway (Prelude.Maybe Prelude.Integer)
directConnectGateway_amazonSideAsn :: (Maybe Integer -> f (Maybe Integer))
-> DirectConnectGateway -> f DirectConnectGateway
directConnectGateway_amazonSideAsn = (DirectConnectGateway -> Maybe Integer)
-> (DirectConnectGateway -> Maybe Integer -> DirectConnectGateway)
-> Lens
     DirectConnectGateway
     DirectConnectGateway
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectConnectGateway' {Maybe Integer
amazonSideAsn :: Maybe Integer
$sel:amazonSideAsn:DirectConnectGateway' :: DirectConnectGateway -> Maybe Integer
amazonSideAsn} -> Maybe Integer
amazonSideAsn) (\s :: DirectConnectGateway
s@DirectConnectGateway' {} Maybe Integer
a -> DirectConnectGateway
s {$sel:amazonSideAsn:DirectConnectGateway' :: Maybe Integer
amazonSideAsn = Maybe Integer
a} :: DirectConnectGateway)

-- | The name of the Direct Connect gateway.
directConnectGateway_directConnectGatewayName :: Lens.Lens' DirectConnectGateway (Prelude.Maybe Prelude.Text)
directConnectGateway_directConnectGatewayName :: (Maybe Text -> f (Maybe Text))
-> DirectConnectGateway -> f DirectConnectGateway
directConnectGateway_directConnectGatewayName = (DirectConnectGateway -> Maybe Text)
-> (DirectConnectGateway -> Maybe Text -> DirectConnectGateway)
-> Lens
     DirectConnectGateway DirectConnectGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectConnectGateway' {Maybe Text
directConnectGatewayName :: Maybe Text
$sel:directConnectGatewayName:DirectConnectGateway' :: DirectConnectGateway -> Maybe Text
directConnectGatewayName} -> Maybe Text
directConnectGatewayName) (\s :: DirectConnectGateway
s@DirectConnectGateway' {} Maybe Text
a -> DirectConnectGateway
s {$sel:directConnectGatewayName:DirectConnectGateway' :: Maybe Text
directConnectGatewayName = Maybe Text
a} :: DirectConnectGateway)

-- | The state of the Direct Connect gateway. The following are the possible
-- values:
--
-- -   @pending@: The initial state after calling
--     CreateDirectConnectGateway.
--
-- -   @available@: The Direct Connect gateway is ready for use.
--
-- -   @deleting@: The initial state after calling
--     DeleteDirectConnectGateway.
--
-- -   @deleted@: The Direct Connect gateway is deleted and cannot pass
--     traffic.
directConnectGateway_directConnectGatewayState :: Lens.Lens' DirectConnectGateway (Prelude.Maybe DirectConnectGatewayState)
directConnectGateway_directConnectGatewayState :: (Maybe DirectConnectGatewayState
 -> f (Maybe DirectConnectGatewayState))
-> DirectConnectGateway -> f DirectConnectGateway
directConnectGateway_directConnectGatewayState = (DirectConnectGateway -> Maybe DirectConnectGatewayState)
-> (DirectConnectGateway
    -> Maybe DirectConnectGatewayState -> DirectConnectGateway)
-> Lens
     DirectConnectGateway
     DirectConnectGateway
     (Maybe DirectConnectGatewayState)
     (Maybe DirectConnectGatewayState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectConnectGateway' {Maybe DirectConnectGatewayState
directConnectGatewayState :: Maybe DirectConnectGatewayState
$sel:directConnectGatewayState:DirectConnectGateway' :: DirectConnectGateway -> Maybe DirectConnectGatewayState
directConnectGatewayState} -> Maybe DirectConnectGatewayState
directConnectGatewayState) (\s :: DirectConnectGateway
s@DirectConnectGateway' {} Maybe DirectConnectGatewayState
a -> DirectConnectGateway
s {$sel:directConnectGatewayState:DirectConnectGateway' :: Maybe DirectConnectGatewayState
directConnectGatewayState = Maybe DirectConnectGatewayState
a} :: DirectConnectGateway)

-- | The ID of the Amazon Web Services account that owns the Direct Connect
-- gateway.
directConnectGateway_ownerAccount :: Lens.Lens' DirectConnectGateway (Prelude.Maybe Prelude.Text)
directConnectGateway_ownerAccount :: (Maybe Text -> f (Maybe Text))
-> DirectConnectGateway -> f DirectConnectGateway
directConnectGateway_ownerAccount = (DirectConnectGateway -> Maybe Text)
-> (DirectConnectGateway -> Maybe Text -> DirectConnectGateway)
-> Lens
     DirectConnectGateway DirectConnectGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectConnectGateway' {Maybe Text
ownerAccount :: Maybe Text
$sel:ownerAccount:DirectConnectGateway' :: DirectConnectGateway -> Maybe Text
ownerAccount} -> Maybe Text
ownerAccount) (\s :: DirectConnectGateway
s@DirectConnectGateway' {} Maybe Text
a -> DirectConnectGateway
s {$sel:ownerAccount:DirectConnectGateway' :: Maybe Text
ownerAccount = Maybe Text
a} :: DirectConnectGateway)

instance Core.FromJSON DirectConnectGateway where
  parseJSON :: Value -> Parser DirectConnectGateway
parseJSON =
    String
-> (Object -> Parser DirectConnectGateway)
-> Value
-> Parser DirectConnectGateway
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DirectConnectGateway"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe DirectConnectGatewayState
-> Maybe Text
-> DirectConnectGateway
DirectConnectGateway'
            (Maybe Text
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> Maybe DirectConnectGatewayState
 -> Maybe Text
 -> DirectConnectGateway)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> Maybe DirectConnectGatewayState
      -> Maybe Text
      -> DirectConnectGateway)
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
"directConnectGatewayId")
            Parser
  (Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> Maybe DirectConnectGatewayState
   -> Maybe Text
   -> DirectConnectGateway)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer
      -> Maybe Text
      -> Maybe DirectConnectGatewayState
      -> Maybe Text
      -> DirectConnectGateway)
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
"stateChangeError")
            Parser
  (Maybe Integer
   -> Maybe Text
   -> Maybe DirectConnectGatewayState
   -> Maybe Text
   -> DirectConnectGateway)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text
      -> Maybe DirectConnectGatewayState
      -> Maybe Text
      -> DirectConnectGateway)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"amazonSideAsn")
            Parser
  (Maybe Text
   -> Maybe DirectConnectGatewayState
   -> Maybe Text
   -> DirectConnectGateway)
-> Parser (Maybe Text)
-> Parser
     (Maybe DirectConnectGatewayState
      -> Maybe Text -> DirectConnectGateway)
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
"directConnectGatewayName")
            Parser
  (Maybe DirectConnectGatewayState
   -> Maybe Text -> DirectConnectGateway)
-> Parser (Maybe DirectConnectGatewayState)
-> Parser (Maybe Text -> DirectConnectGateway)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DirectConnectGatewayState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"directConnectGatewayState")
            Parser (Maybe Text -> DirectConnectGateway)
-> Parser (Maybe Text) -> Parser DirectConnectGateway
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
"ownerAccount")
      )

instance Prelude.Hashable DirectConnectGateway

instance Prelude.NFData DirectConnectGateway