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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 association state.
    CustomerGatewayAssociation -> Maybe CustomerGatewayAssociationState
state :: Prelude.Maybe CustomerGatewayAssociationState,
    -- | 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 ID of the device.
    CustomerGatewayAssociation -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the customer gateway.
    CustomerGatewayAssociation -> Maybe Text
customerGatewayArn :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool
(CustomerGatewayAssociation -> CustomerGatewayAssociation -> Bool)
-> (CustomerGatewayAssociation
    -> CustomerGatewayAssociation -> Bool)
-> Eq CustomerGatewayAssociation
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]
(Int -> ReadS CustomerGatewayAssociation)
-> ReadS [CustomerGatewayAssociation]
-> ReadPrec CustomerGatewayAssociation
-> ReadPrec [CustomerGatewayAssociation]
-> Read 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
(Int -> CustomerGatewayAssociation -> ShowS)
-> (CustomerGatewayAssociation -> String)
-> ([CustomerGatewayAssociation] -> ShowS)
-> Show CustomerGatewayAssociation
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.
 CustomerGatewayAssociation -> Rep CustomerGatewayAssociation x)
-> (forall x.
    Rep CustomerGatewayAssociation x -> CustomerGatewayAssociation)
-> Generic CustomerGatewayAssociation
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:
--
-- 'state', 'customerGatewayAssociation_state' - The association state.
--
-- 'globalNetworkId', 'customerGatewayAssociation_globalNetworkId' - The ID of the global network.
--
-- 'linkId', 'customerGatewayAssociation_linkId' - The ID of the link.
--
-- 'deviceId', 'customerGatewayAssociation_deviceId' - The ID of the device.
--
-- 'customerGatewayArn', 'customerGatewayAssociation_customerGatewayArn' - The Amazon Resource Name (ARN) of the customer gateway.
newCustomerGatewayAssociation ::
  CustomerGatewayAssociation
newCustomerGatewayAssociation :: CustomerGatewayAssociation
newCustomerGatewayAssociation =
  CustomerGatewayAssociation' :: Maybe CustomerGatewayAssociationState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CustomerGatewayAssociation
CustomerGatewayAssociation'
    { $sel:state:CustomerGatewayAssociation' :: Maybe CustomerGatewayAssociationState
state =
        Maybe CustomerGatewayAssociationState
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:CustomerGatewayAssociation' :: Maybe Text
globalNetworkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:linkId:CustomerGatewayAssociation' :: Maybe Text
linkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:CustomerGatewayAssociation' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:customerGatewayArn:CustomerGatewayAssociation' :: Maybe Text
customerGatewayArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The association state.
customerGatewayAssociation_state :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe CustomerGatewayAssociationState)
customerGatewayAssociation_state :: (Maybe CustomerGatewayAssociationState
 -> f (Maybe CustomerGatewayAssociationState))
-> CustomerGatewayAssociation -> f CustomerGatewayAssociation
customerGatewayAssociation_state = (CustomerGatewayAssociation
 -> Maybe CustomerGatewayAssociationState)
-> (CustomerGatewayAssociation
    -> Maybe CustomerGatewayAssociationState
    -> CustomerGatewayAssociation)
-> Lens
     CustomerGatewayAssociation
     CustomerGatewayAssociation
     (Maybe CustomerGatewayAssociationState)
     (Maybe CustomerGatewayAssociationState)
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)

-- | The ID of the global network.
customerGatewayAssociation_globalNetworkId :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_globalNetworkId :: (Maybe Text -> f (Maybe Text))
-> CustomerGatewayAssociation -> f CustomerGatewayAssociation
customerGatewayAssociation_globalNetworkId = (CustomerGatewayAssociation -> Maybe Text)
-> (CustomerGatewayAssociation
    -> Maybe Text -> CustomerGatewayAssociation)
-> Lens
     CustomerGatewayAssociation
     CustomerGatewayAssociation
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> CustomerGatewayAssociation -> f CustomerGatewayAssociation
customerGatewayAssociation_linkId = (CustomerGatewayAssociation -> Maybe Text)
-> (CustomerGatewayAssociation
    -> Maybe Text -> CustomerGatewayAssociation)
-> Lens
     CustomerGatewayAssociation
     CustomerGatewayAssociation
     (Maybe Text)
     (Maybe Text)
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 ID of the device.
customerGatewayAssociation_deviceId :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_deviceId :: (Maybe Text -> f (Maybe Text))
-> CustomerGatewayAssociation -> f CustomerGatewayAssociation
customerGatewayAssociation_deviceId = (CustomerGatewayAssociation -> Maybe Text)
-> (CustomerGatewayAssociation
    -> Maybe Text -> CustomerGatewayAssociation)
-> Lens
     CustomerGatewayAssociation
     CustomerGatewayAssociation
     (Maybe Text)
     (Maybe Text)
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 Amazon Resource Name (ARN) of the customer gateway.
customerGatewayAssociation_customerGatewayArn :: Lens.Lens' CustomerGatewayAssociation (Prelude.Maybe Prelude.Text)
customerGatewayAssociation_customerGatewayArn :: (Maybe Text -> f (Maybe Text))
-> CustomerGatewayAssociation -> f CustomerGatewayAssociation
customerGatewayAssociation_customerGatewayArn = (CustomerGatewayAssociation -> Maybe Text)
-> (CustomerGatewayAssociation
    -> Maybe Text -> CustomerGatewayAssociation)
-> Lens
     CustomerGatewayAssociation
     CustomerGatewayAssociation
     (Maybe Text)
     (Maybe Text)
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)

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

instance Prelude.Hashable CustomerGatewayAssociation

instance Prelude.NFData CustomerGatewayAssociation