{-# 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.EC2.Types.VpnGateway
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EC2.Types.VpnGateway where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.GatewayType
import Amazonka.EC2.Types.Tag
import Amazonka.EC2.Types.VpcAttachment
import Amazonka.EC2.Types.VpnState
import qualified Amazonka.Prelude as Prelude

-- | Describes a virtual private gateway.
--
-- /See:/ 'newVpnGateway' smart constructor.
data VpnGateway = VpnGateway'
  { -- | The private Autonomous System Number (ASN) for the Amazon side of a BGP
    -- session.
    VpnGateway -> Maybe Integer
amazonSideAsn :: Prelude.Maybe Prelude.Integer,
    -- | The Availability Zone where the virtual private gateway was created, if
    -- applicable. This field may be empty or not returned.
    VpnGateway -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The current state of the virtual private gateway.
    VpnGateway -> Maybe VpnState
state :: Prelude.Maybe VpnState,
    -- | Any tags assigned to the virtual private gateway.
    VpnGateway -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The type of VPN connection the virtual private gateway supports.
    VpnGateway -> Maybe GatewayType
type' :: Prelude.Maybe GatewayType,
    -- | Any VPCs attached to the virtual private gateway.
    VpnGateway -> Maybe [VpcAttachment]
vpcAttachments :: Prelude.Maybe [VpcAttachment],
    -- | The ID of the virtual private gateway.
    VpnGateway -> Maybe Text
vpnGatewayId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpnGateway -> VpnGateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpnGateway -> VpnGateway -> Bool
$c/= :: VpnGateway -> VpnGateway -> Bool
== :: VpnGateway -> VpnGateway -> Bool
$c== :: VpnGateway -> VpnGateway -> Bool
Prelude.Eq, ReadPrec [VpnGateway]
ReadPrec VpnGateway
Int -> ReadS VpnGateway
ReadS [VpnGateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpnGateway]
$creadListPrec :: ReadPrec [VpnGateway]
readPrec :: ReadPrec VpnGateway
$creadPrec :: ReadPrec VpnGateway
readList :: ReadS [VpnGateway]
$creadList :: ReadS [VpnGateway]
readsPrec :: Int -> ReadS VpnGateway
$creadsPrec :: Int -> ReadS VpnGateway
Prelude.Read, Int -> VpnGateway -> ShowS
[VpnGateway] -> ShowS
VpnGateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpnGateway] -> ShowS
$cshowList :: [VpnGateway] -> ShowS
show :: VpnGateway -> String
$cshow :: VpnGateway -> String
showsPrec :: Int -> VpnGateway -> ShowS
$cshowsPrec :: Int -> VpnGateway -> ShowS
Prelude.Show, forall x. Rep VpnGateway x -> VpnGateway
forall x. VpnGateway -> Rep VpnGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpnGateway x -> VpnGateway
$cfrom :: forall x. VpnGateway -> Rep VpnGateway x
Prelude.Generic)

-- |
-- Create a value of 'VpnGateway' 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:
--
-- 'amazonSideAsn', 'vpnGateway_amazonSideAsn' - The private Autonomous System Number (ASN) for the Amazon side of a BGP
-- session.
--
-- 'availabilityZone', 'vpnGateway_availabilityZone' - The Availability Zone where the virtual private gateway was created, if
-- applicable. This field may be empty or not returned.
--
-- 'state', 'vpnGateway_state' - The current state of the virtual private gateway.
--
-- 'tags', 'vpnGateway_tags' - Any tags assigned to the virtual private gateway.
--
-- 'type'', 'vpnGateway_type' - The type of VPN connection the virtual private gateway supports.
--
-- 'vpcAttachments', 'vpnGateway_vpcAttachments' - Any VPCs attached to the virtual private gateway.
--
-- 'vpnGatewayId', 'vpnGateway_vpnGatewayId' - The ID of the virtual private gateway.
newVpnGateway ::
  VpnGateway
newVpnGateway :: VpnGateway
newVpnGateway =
  VpnGateway'
    { $sel:amazonSideAsn:VpnGateway' :: Maybe Integer
amazonSideAsn = forall a. Maybe a
Prelude.Nothing,
      $sel:availabilityZone:VpnGateway' :: Maybe Text
availabilityZone = forall a. Maybe a
Prelude.Nothing,
      $sel:state:VpnGateway' :: Maybe VpnState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:VpnGateway' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:type':VpnGateway' :: Maybe GatewayType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcAttachments:VpnGateway' :: Maybe [VpcAttachment]
vpcAttachments = forall a. Maybe a
Prelude.Nothing,
      $sel:vpnGatewayId:VpnGateway' :: Maybe Text
vpnGatewayId = forall a. Maybe a
Prelude.Nothing
    }

-- | The private Autonomous System Number (ASN) for the Amazon side of a BGP
-- session.
vpnGateway_amazonSideAsn :: Lens.Lens' VpnGateway (Prelude.Maybe Prelude.Integer)
vpnGateway_amazonSideAsn :: Lens' VpnGateway (Maybe Integer)
vpnGateway_amazonSideAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnGateway' {Maybe Integer
amazonSideAsn :: Maybe Integer
$sel:amazonSideAsn:VpnGateway' :: VpnGateway -> Maybe Integer
amazonSideAsn} -> Maybe Integer
amazonSideAsn) (\s :: VpnGateway
s@VpnGateway' {} Maybe Integer
a -> VpnGateway
s {$sel:amazonSideAsn:VpnGateway' :: Maybe Integer
amazonSideAsn = Maybe Integer
a} :: VpnGateway)

-- | The Availability Zone where the virtual private gateway was created, if
-- applicable. This field may be empty or not returned.
vpnGateway_availabilityZone :: Lens.Lens' VpnGateway (Prelude.Maybe Prelude.Text)
vpnGateway_availabilityZone :: Lens' VpnGateway (Maybe Text)
vpnGateway_availabilityZone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnGateway' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:VpnGateway' :: VpnGateway -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: VpnGateway
s@VpnGateway' {} Maybe Text
a -> VpnGateway
s {$sel:availabilityZone:VpnGateway' :: Maybe Text
availabilityZone = Maybe Text
a} :: VpnGateway)

-- | The current state of the virtual private gateway.
vpnGateway_state :: Lens.Lens' VpnGateway (Prelude.Maybe VpnState)
vpnGateway_state :: Lens' VpnGateway (Maybe VpnState)
vpnGateway_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnGateway' {Maybe VpnState
state :: Maybe VpnState
$sel:state:VpnGateway' :: VpnGateway -> Maybe VpnState
state} -> Maybe VpnState
state) (\s :: VpnGateway
s@VpnGateway' {} Maybe VpnState
a -> VpnGateway
s {$sel:state:VpnGateway' :: Maybe VpnState
state = Maybe VpnState
a} :: VpnGateway)

-- | Any tags assigned to the virtual private gateway.
vpnGateway_tags :: Lens.Lens' VpnGateway (Prelude.Maybe [Tag])
vpnGateway_tags :: Lens' VpnGateway (Maybe [Tag])
vpnGateway_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnGateway' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:VpnGateway' :: VpnGateway -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: VpnGateway
s@VpnGateway' {} Maybe [Tag]
a -> VpnGateway
s {$sel:tags:VpnGateway' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: VpnGateway) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of VPN connection the virtual private gateway supports.
vpnGateway_type :: Lens.Lens' VpnGateway (Prelude.Maybe GatewayType)
vpnGateway_type :: Lens' VpnGateway (Maybe GatewayType)
vpnGateway_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnGateway' {Maybe GatewayType
type' :: Maybe GatewayType
$sel:type':VpnGateway' :: VpnGateway -> Maybe GatewayType
type'} -> Maybe GatewayType
type') (\s :: VpnGateway
s@VpnGateway' {} Maybe GatewayType
a -> VpnGateway
s {$sel:type':VpnGateway' :: Maybe GatewayType
type' = Maybe GatewayType
a} :: VpnGateway)

-- | Any VPCs attached to the virtual private gateway.
vpnGateway_vpcAttachments :: Lens.Lens' VpnGateway (Prelude.Maybe [VpcAttachment])
vpnGateway_vpcAttachments :: Lens' VpnGateway (Maybe [VpcAttachment])
vpnGateway_vpcAttachments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpnGateway' {Maybe [VpcAttachment]
vpcAttachments :: Maybe [VpcAttachment]
$sel:vpcAttachments:VpnGateway' :: VpnGateway -> Maybe [VpcAttachment]
vpcAttachments} -> Maybe [VpcAttachment]
vpcAttachments) (\s :: VpnGateway
s@VpnGateway' {} Maybe [VpcAttachment]
a -> VpnGateway
s {$sel:vpcAttachments:VpnGateway' :: Maybe [VpcAttachment]
vpcAttachments = Maybe [VpcAttachment]
a} :: VpnGateway) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Data.FromXML VpnGateway where
  parseXML :: [Node] -> Either String VpnGateway
parseXML [Node]
x =
    Maybe Integer
-> Maybe Text
-> Maybe VpnState
-> Maybe [Tag]
-> Maybe GatewayType
-> Maybe [VpcAttachment]
-> Maybe Text
-> VpnGateway
VpnGateway'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"amazonSideAsn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"availabilityZone")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"state")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"tagSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"type")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"attachments"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"vpnGatewayId")

instance Prelude.Hashable VpnGateway where
  hashWithSalt :: Int -> VpnGateway -> Int
hashWithSalt Int
_salt VpnGateway' {Maybe Integer
Maybe [Tag]
Maybe [VpcAttachment]
Maybe Text
Maybe GatewayType
Maybe VpnState
vpnGatewayId :: Maybe Text
vpcAttachments :: Maybe [VpcAttachment]
type' :: Maybe GatewayType
tags :: Maybe [Tag]
state :: Maybe VpnState
availabilityZone :: Maybe Text
amazonSideAsn :: Maybe Integer
$sel:vpnGatewayId:VpnGateway' :: VpnGateway -> Maybe Text
$sel:vpcAttachments:VpnGateway' :: VpnGateway -> Maybe [VpcAttachment]
$sel:type':VpnGateway' :: VpnGateway -> Maybe GatewayType
$sel:tags:VpnGateway' :: VpnGateway -> Maybe [Tag]
$sel:state:VpnGateway' :: VpnGateway -> Maybe VpnState
$sel:availabilityZone:VpnGateway' :: VpnGateway -> Maybe Text
$sel:amazonSideAsn:VpnGateway' :: VpnGateway -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
amazonSideAsn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availabilityZone
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpnState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GatewayType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [VpcAttachment]
vpcAttachments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpnGatewayId

instance Prelude.NFData VpnGateway where
  rnf :: VpnGateway -> ()
rnf VpnGateway' {Maybe Integer
Maybe [Tag]
Maybe [VpcAttachment]
Maybe Text
Maybe GatewayType
Maybe VpnState
vpnGatewayId :: Maybe Text
vpcAttachments :: Maybe [VpcAttachment]
type' :: Maybe GatewayType
tags :: Maybe [Tag]
state :: Maybe VpnState
availabilityZone :: Maybe Text
amazonSideAsn :: Maybe Integer
$sel:vpnGatewayId:VpnGateway' :: VpnGateway -> Maybe Text
$sel:vpcAttachments:VpnGateway' :: VpnGateway -> Maybe [VpcAttachment]
$sel:type':VpnGateway' :: VpnGateway -> Maybe GatewayType
$sel:tags:VpnGateway' :: VpnGateway -> Maybe [Tag]
$sel:state:VpnGateway' :: VpnGateway -> Maybe VpnState
$sel:availabilityZone:VpnGateway' :: VpnGateway -> Maybe Text
$sel:amazonSideAsn:VpnGateway' :: VpnGateway -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
amazonSideAsn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availabilityZone
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpnState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GatewayType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [VpcAttachment]
vpcAttachments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpnGatewayId