{-# 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.NetworkManager.Types.CustomerGatewayAssociation
-- 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.NetworkManager.Types.CustomerGatewayAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types.CustomerGatewayAssociationState
import qualified Amazonka.Prelude as Prelude

-- | Describes the association between a customer gateway, a device, and a
-- link.
--
-- /See:/ 'newCustomerGatewayAssociation' smart constructor.
data CustomerGatewayAssociation = CustomerGatewayAssociation'
  { -- | The Amazon Resource Name (ARN) of the customer gateway.
    CustomerGatewayAssociation -> Maybe Text
customerGatewayArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the device.
    CustomerGatewayAssociation -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the global network.
    CustomerGatewayAssociation -> Maybe Text
globalNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the link.
    CustomerGatewayAssociation -> Maybe Text
linkId :: Prelude.Maybe Prelude.Text,
    -- | The association state.
    CustomerGatewayAssociation -> Maybe CustomerGatewayAssociationState
state :: Prelude.Maybe CustomerGatewayAssociationState
  }
  deriving (CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool
$c/= :: CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool
== :: CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool
$c== :: CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool
Prelude.Eq, ReadPrec [CustomerGatewayAssociation]
ReadPrec CustomerGatewayAssociation
Int -> ReadS CustomerGatewayAssociation
ReadS [CustomerGatewayAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerGatewayAssociation]
$creadListPrec :: ReadPrec [CustomerGatewayAssociation]
readPrec :: ReadPrec CustomerGatewayAssociation
$creadPrec :: ReadPrec CustomerGatewayAssociation
readList :: ReadS [CustomerGatewayAssociation]
$creadList :: ReadS [CustomerGatewayAssociation]
readsPrec :: Int -> ReadS CustomerGatewayAssociation
$creadsPrec :: Int -> ReadS CustomerGatewayAssociation
Prelude.Read, Int -> CustomerGatewayAssociation -> ShowS
[CustomerGatewayAssociation] -> ShowS
CustomerGatewayAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerGatewayAssociation] -> ShowS
$cshowList :: [CustomerGatewayAssociation] -> ShowS
show :: CustomerGatewayAssociation -> String
$cshow :: CustomerGatewayAssociation -> String
showsPrec :: Int -> CustomerGatewayAssociation -> ShowS
$cshowsPrec :: Int -> CustomerGatewayAssociation -> ShowS
Prelude.Show, forall x.
Rep CustomerGatewayAssociation x -> CustomerGatewayAssociation
forall x.
CustomerGatewayAssociation -> Rep CustomerGatewayAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomerGatewayAssociation x -> CustomerGatewayAssociation
$cfrom :: forall x.
CustomerGatewayAssociation -> Rep CustomerGatewayAssociation x
Prelude.Generic)

-- |
-- Create a value of 'CustomerGatewayAssociation' 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:
--
-- 'customerGatewayArn', 'customerGatewayAssociation_customerGatewayArn' - The Amazon Resource Name (ARN) of the customer gateway.
--
-- 'deviceId', 'customerGatewayAssociation_deviceId' - The ID of the device.
--
-- 'globalNetworkId', 'customerGatewayAssociation_globalNetworkId' - The ID of the global network.
--
-- 'linkId', 'customerGatewayAssociation_linkId' - The ID of the link.
--
-- 'state', 'customerGatewayAssociation_state' - The association state.
newCustomerGatewayAssociation ::
  CustomerGatewayAssociation
newCustomerGatewayAssociation :: CustomerGatewayAssociation
newCustomerGatewayAssociation =
  CustomerGatewayAssociation'
    { $sel:customerGatewayArn:CustomerGatewayAssociation' :: Maybe Text
customerGatewayArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:CustomerGatewayAssociation' :: Maybe Text
deviceId = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:CustomerGatewayAssociation' :: Maybe Text
globalNetworkId = forall a. Maybe a
Prelude.Nothing,
      $sel:linkId:CustomerGatewayAssociation' :: Maybe Text
linkId = forall a. Maybe a
Prelude.Nothing,
      $sel:state:CustomerGatewayAssociation' :: Maybe CustomerGatewayAssociationState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the customer gateway.
customerGatewayAssociation_customerGatewayArn :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_customerGatewayArn :: Lens' CustomerGatewayAssociation (Maybe Text)
customerGatewayAssociation_customerGatewayArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGatewayAssociation' {Maybe Text
customerGatewayArn :: Maybe Text
$sel:customerGatewayArn:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
customerGatewayArn} -> Maybe Text
customerGatewayArn) (\s :: CustomerGatewayAssociation
s@CustomerGatewayAssociation' {} Maybe Text
a -> CustomerGatewayAssociation
s {$sel:customerGatewayArn:CustomerGatewayAssociation' :: Maybe Text
customerGatewayArn = Maybe Text
a} :: CustomerGatewayAssociation)

-- | The ID of the device.
customerGatewayAssociation_deviceId :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_deviceId :: Lens' CustomerGatewayAssociation (Maybe Text)
customerGatewayAssociation_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGatewayAssociation' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: CustomerGatewayAssociation
s@CustomerGatewayAssociation' {} Maybe Text
a -> CustomerGatewayAssociation
s {$sel:deviceId:CustomerGatewayAssociation' :: Maybe Text
deviceId = Maybe Text
a} :: CustomerGatewayAssociation)

-- | The ID of the global network.
customerGatewayAssociation_globalNetworkId :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_globalNetworkId :: Lens' CustomerGatewayAssociation (Maybe Text)
customerGatewayAssociation_globalNetworkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGatewayAssociation' {Maybe Text
globalNetworkId :: Maybe Text
$sel:globalNetworkId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
globalNetworkId} -> Maybe Text
globalNetworkId) (\s :: CustomerGatewayAssociation
s@CustomerGatewayAssociation' {} Maybe Text
a -> CustomerGatewayAssociation
s {$sel:globalNetworkId:CustomerGatewayAssociation' :: Maybe Text
globalNetworkId = Maybe Text
a} :: CustomerGatewayAssociation)

-- | The ID of the link.
customerGatewayAssociation_linkId :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_linkId :: Lens' CustomerGatewayAssociation (Maybe Text)
customerGatewayAssociation_linkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGatewayAssociation' {Maybe Text
linkId :: Maybe Text
$sel:linkId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
linkId} -> Maybe Text
linkId) (\s :: CustomerGatewayAssociation
s@CustomerGatewayAssociation' {} Maybe Text
a -> CustomerGatewayAssociation
s {$sel:linkId:CustomerGatewayAssociation' :: Maybe Text
linkId = Maybe Text
a} :: CustomerGatewayAssociation)

-- | The association state.
customerGatewayAssociation_state :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe CustomerGatewayAssociationState)
customerGatewayAssociation_state :: Lens'
  CustomerGatewayAssociation (Maybe CustomerGatewayAssociationState)
customerGatewayAssociation_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerGatewayAssociation' {Maybe CustomerGatewayAssociationState
state :: Maybe CustomerGatewayAssociationState
$sel:state:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe CustomerGatewayAssociationState
state} -> Maybe CustomerGatewayAssociationState
state) (\s :: CustomerGatewayAssociation
s@CustomerGatewayAssociation' {} Maybe CustomerGatewayAssociationState
a -> CustomerGatewayAssociation
s {$sel:state:CustomerGatewayAssociation' :: Maybe CustomerGatewayAssociationState
state = Maybe CustomerGatewayAssociationState
a} :: CustomerGatewayAssociation)

instance Data.FromJSON CustomerGatewayAssociation where
  parseJSON :: Value -> Parser CustomerGatewayAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomerGatewayAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe CustomerGatewayAssociationState
-> CustomerGatewayAssociation
CustomerGatewayAssociation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CustomerGatewayArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeviceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GlobalNetworkId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LinkId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
      )

instance Prelude.Hashable CustomerGatewayAssociation where
  hashWithSalt :: Int -> CustomerGatewayAssociation -> Int
hashWithSalt Int
_salt CustomerGatewayAssociation' {Maybe Text
Maybe CustomerGatewayAssociationState
state :: Maybe CustomerGatewayAssociationState
linkId :: Maybe Text
globalNetworkId :: Maybe Text
deviceId :: Maybe Text
customerGatewayArn :: Maybe Text
$sel:state:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe CustomerGatewayAssociationState
$sel:linkId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
$sel:globalNetworkId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
$sel:deviceId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
$sel:customerGatewayArn:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customerGatewayArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
globalNetworkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomerGatewayAssociationState
state

instance Prelude.NFData CustomerGatewayAssociation where
  rnf :: CustomerGatewayAssociation -> ()
rnf CustomerGatewayAssociation' {Maybe Text
Maybe CustomerGatewayAssociationState
state :: Maybe CustomerGatewayAssociationState
linkId :: Maybe Text
globalNetworkId :: Maybe Text
deviceId :: Maybe Text
customerGatewayArn :: Maybe Text
$sel:state:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe CustomerGatewayAssociationState
$sel:linkId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
$sel:globalNetworkId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
$sel:deviceId:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
$sel:customerGatewayArn:CustomerGatewayAssociation' :: CustomerGatewayAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customerGatewayArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
globalNetworkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomerGatewayAssociationState
state