{-# 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.CustomerGateway
-- 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.CustomerGateway 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.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a customer gateway.
--
-- /See:/ 'newCustomerGateway' smart constructor.
data CustomerGateway = CustomerGateway'
  { -- | The Amazon Resource Name (ARN) for the customer gateway certificate.
    CustomerGateway -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
    -- | The name of customer gateway device.
    CustomerGateway -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text,
    -- | Any tags assigned to the customer gateway.
    CustomerGateway -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The customer gateway\'s Border Gateway Protocol (BGP) Autonomous System
    -- Number (ASN).
    CustomerGateway -> Text
bgpAsn :: Prelude.Text,
    -- | The ID of the customer gateway.
    CustomerGateway -> Text
customerGatewayId :: Prelude.Text,
    -- | The IP address of the customer gateway device\'s outside interface.
    CustomerGateway -> Text
ipAddress :: Prelude.Text,
    -- | The current state of the customer gateway
    -- (@pending | available | deleting | deleted@).
    CustomerGateway -> Text
state :: Prelude.Text,
    -- | The type of VPN connection the customer gateway supports (@ipsec.1@).
    CustomerGateway -> Text
type' :: Prelude.Text
  }
  deriving (CustomerGateway -> CustomerGateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerGateway -> CustomerGateway -> Bool
$c/= :: CustomerGateway -> CustomerGateway -> Bool
== :: CustomerGateway -> CustomerGateway -> Bool
$c== :: CustomerGateway -> CustomerGateway -> Bool
Prelude.Eq, ReadPrec [CustomerGateway]
ReadPrec CustomerGateway
Int -> ReadS CustomerGateway
ReadS [CustomerGateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerGateway]
$creadListPrec :: ReadPrec [CustomerGateway]
readPrec :: ReadPrec CustomerGateway
$creadPrec :: ReadPrec CustomerGateway
readList :: ReadS [CustomerGateway]
$creadList :: ReadS [CustomerGateway]
readsPrec :: Int -> ReadS CustomerGateway
$creadsPrec :: Int -> ReadS CustomerGateway
Prelude.Read, Int -> CustomerGateway -> ShowS
[CustomerGateway] -> ShowS
CustomerGateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerGateway] -> ShowS
$cshowList :: [CustomerGateway] -> ShowS
show :: CustomerGateway -> String
$cshow :: CustomerGateway -> String
showsPrec :: Int -> CustomerGateway -> ShowS
$cshowsPrec :: Int -> CustomerGateway -> ShowS
Prelude.Show, forall x. Rep CustomerGateway x -> CustomerGateway
forall x. CustomerGateway -> Rep CustomerGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomerGateway x -> CustomerGateway
$cfrom :: forall x. CustomerGateway -> Rep CustomerGateway x
Prelude.Generic)

-- |
-- Create a value of 'CustomerGateway' 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:
--
-- 'certificateArn', 'customerGateway_certificateArn' - The Amazon Resource Name (ARN) for the customer gateway certificate.
--
-- 'deviceName', 'customerGateway_deviceName' - The name of customer gateway device.
--
-- 'tags', 'customerGateway_tags' - Any tags assigned to the customer gateway.
--
-- 'bgpAsn', 'customerGateway_bgpAsn' - The customer gateway\'s Border Gateway Protocol (BGP) Autonomous System
-- Number (ASN).
--
-- 'customerGatewayId', 'customerGateway_customerGatewayId' - The ID of the customer gateway.
--
-- 'ipAddress', 'customerGateway_ipAddress' - The IP address of the customer gateway device\'s outside interface.
--
-- 'state', 'customerGateway_state' - The current state of the customer gateway
-- (@pending | available | deleting | deleted@).
--
-- 'type'', 'customerGateway_type' - The type of VPN connection the customer gateway supports (@ipsec.1@).
newCustomerGateway ::
  -- | 'bgpAsn'
  Prelude.Text ->
  -- | 'customerGatewayId'
  Prelude.Text ->
  -- | 'ipAddress'
  Prelude.Text ->
  -- | 'state'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  CustomerGateway
newCustomerGateway :: Text -> Text -> Text -> Text -> Text -> CustomerGateway
newCustomerGateway
  Text
pBgpAsn_
  Text
pCustomerGatewayId_
  Text
pIpAddress_
  Text
pState_
  Text
pType_ =
    CustomerGateway'
      { $sel:certificateArn:CustomerGateway' :: Maybe Text
certificateArn = forall a. Maybe a
Prelude.Nothing,
        $sel:deviceName:CustomerGateway' :: Maybe Text
deviceName = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CustomerGateway' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:bgpAsn:CustomerGateway' :: Text
bgpAsn = Text
pBgpAsn_,
        $sel:customerGatewayId:CustomerGateway' :: Text
customerGatewayId = Text
pCustomerGatewayId_,
        $sel:ipAddress:CustomerGateway' :: Text
ipAddress = Text
pIpAddress_,
        $sel:state:CustomerGateway' :: Text
state = Text
pState_,
        $sel:type':CustomerGateway' :: Text
type' = Text
pType_
      }

-- | The Amazon Resource Name (ARN) for the customer gateway certificate.
customerGateway_certificateArn :: Lens.Lens' CustomerGateway (Prelude.Maybe Prelude.Text)
customerGateway_certificateArn :: Lens' CustomerGateway (Maybe Text)
customerGateway_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:CustomerGateway' :: CustomerGateway -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: CustomerGateway
s@CustomerGateway' {} Maybe Text
a -> CustomerGateway
s {$sel:certificateArn:CustomerGateway' :: Maybe Text
certificateArn = Maybe Text
a} :: CustomerGateway)

-- | The name of customer gateway device.
customerGateway_deviceName :: Lens.Lens' CustomerGateway (Prelude.Maybe Prelude.Text)
customerGateway_deviceName :: Lens' CustomerGateway (Maybe Text)
customerGateway_deviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:CustomerGateway' :: CustomerGateway -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: CustomerGateway
s@CustomerGateway' {} Maybe Text
a -> CustomerGateway
s {$sel:deviceName:CustomerGateway' :: Maybe Text
deviceName = Maybe Text
a} :: CustomerGateway)

-- | Any tags assigned to the customer gateway.
customerGateway_tags :: Lens.Lens' CustomerGateway (Prelude.Maybe [Tag])
customerGateway_tags :: Lens' CustomerGateway (Maybe [Tag])
customerGateway_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CustomerGateway' :: CustomerGateway -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CustomerGateway
s@CustomerGateway' {} Maybe [Tag]
a -> CustomerGateway
s {$sel:tags:CustomerGateway' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CustomerGateway) 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 customer gateway\'s Border Gateway Protocol (BGP) Autonomous System
-- Number (ASN).
customerGateway_bgpAsn :: Lens.Lens' CustomerGateway Prelude.Text
customerGateway_bgpAsn :: Lens' CustomerGateway Text
customerGateway_bgpAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Text
bgpAsn :: Text
$sel:bgpAsn:CustomerGateway' :: CustomerGateway -> Text
bgpAsn} -> Text
bgpAsn) (\s :: CustomerGateway
s@CustomerGateway' {} Text
a -> CustomerGateway
s {$sel:bgpAsn:CustomerGateway' :: Text
bgpAsn = Text
a} :: CustomerGateway)

-- | The ID of the customer gateway.
customerGateway_customerGatewayId :: Lens.Lens' CustomerGateway Prelude.Text
customerGateway_customerGatewayId :: Lens' CustomerGateway Text
customerGateway_customerGatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Text
customerGatewayId :: Text
$sel:customerGatewayId:CustomerGateway' :: CustomerGateway -> Text
customerGatewayId} -> Text
customerGatewayId) (\s :: CustomerGateway
s@CustomerGateway' {} Text
a -> CustomerGateway
s {$sel:customerGatewayId:CustomerGateway' :: Text
customerGatewayId = Text
a} :: CustomerGateway)

-- | The IP address of the customer gateway device\'s outside interface.
customerGateway_ipAddress :: Lens.Lens' CustomerGateway Prelude.Text
customerGateway_ipAddress :: Lens' CustomerGateway Text
customerGateway_ipAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Text
ipAddress :: Text
$sel:ipAddress:CustomerGateway' :: CustomerGateway -> Text
ipAddress} -> Text
ipAddress) (\s :: CustomerGateway
s@CustomerGateway' {} Text
a -> CustomerGateway
s {$sel:ipAddress:CustomerGateway' :: Text
ipAddress = Text
a} :: CustomerGateway)

-- | The current state of the customer gateway
-- (@pending | available | deleting | deleted@).
customerGateway_state :: Lens.Lens' CustomerGateway Prelude.Text
customerGateway_state :: Lens' CustomerGateway Text
customerGateway_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Text
state :: Text
$sel:state:CustomerGateway' :: CustomerGateway -> Text
state} -> Text
state) (\s :: CustomerGateway
s@CustomerGateway' {} Text
a -> CustomerGateway
s {$sel:state:CustomerGateway' :: Text
state = Text
a} :: CustomerGateway)

-- | The type of VPN connection the customer gateway supports (@ipsec.1@).
customerGateway_type :: Lens.Lens' CustomerGateway Prelude.Text
customerGateway_type :: Lens' CustomerGateway Text
customerGateway_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGateway' {Text
type' :: Text
$sel:type':CustomerGateway' :: CustomerGateway -> Text
type'} -> Text
type') (\s :: CustomerGateway
s@CustomerGateway' {} Text
a -> CustomerGateway
s {$sel:type':CustomerGateway' :: Text
type' = Text
a} :: CustomerGateway)

instance Data.FromXML CustomerGateway where
  parseXML :: [Node] -> Either String CustomerGateway
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> Text
-> CustomerGateway
CustomerGateway'
      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
"certificateArn")
      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
"deviceName")
      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 a
Data..@ Text
"bgpAsn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"customerGatewayId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"ipAddress")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String 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 a
Data..@ Text
"type")

instance Prelude.Hashable CustomerGateway where
  hashWithSalt :: Int -> CustomerGateway -> Int
hashWithSalt Int
_salt CustomerGateway' {Maybe [Tag]
Maybe Text
Text
type' :: Text
state :: Text
ipAddress :: Text
customerGatewayId :: Text
bgpAsn :: Text
tags :: Maybe [Tag]
deviceName :: Maybe Text
certificateArn :: Maybe Text
$sel:type':CustomerGateway' :: CustomerGateway -> Text
$sel:state:CustomerGateway' :: CustomerGateway -> Text
$sel:ipAddress:CustomerGateway' :: CustomerGateway -> Text
$sel:customerGatewayId:CustomerGateway' :: CustomerGateway -> Text
$sel:bgpAsn:CustomerGateway' :: CustomerGateway -> Text
$sel:tags:CustomerGateway' :: CustomerGateway -> Maybe [Tag]
$sel:deviceName:CustomerGateway' :: CustomerGateway -> Maybe Text
$sel:certificateArn:CustomerGateway' :: CustomerGateway -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bgpAsn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
customerGatewayId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ipAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'

instance Prelude.NFData CustomerGateway where
  rnf :: CustomerGateway -> ()
rnf CustomerGateway' {Maybe [Tag]
Maybe Text
Text
type' :: Text
state :: Text
ipAddress :: Text
customerGatewayId :: Text
bgpAsn :: Text
tags :: Maybe [Tag]
deviceName :: Maybe Text
certificateArn :: Maybe Text
$sel:type':CustomerGateway' :: CustomerGateway -> Text
$sel:state:CustomerGateway' :: CustomerGateway -> Text
$sel:ipAddress:CustomerGateway' :: CustomerGateway -> Text
$sel:customerGatewayId:CustomerGateway' :: CustomerGateway -> Text
$sel:bgpAsn:CustomerGateway' :: CustomerGateway -> Text
$sel:tags:CustomerGateway' :: CustomerGateway -> Maybe [Tag]
$sel:deviceName:CustomerGateway' :: CustomerGateway -> Maybe Text
$sel:certificateArn:CustomerGateway' :: CustomerGateway -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceName
      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 Text
bgpAsn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
customerGatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ipAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
type'