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

-- | Describes a core network Connect peer association.
--
-- /See:/ 'newConnectPeerAssociation' smart constructor.
data ConnectPeerAssociation = ConnectPeerAssociation'
  { -- | The ID of the Connect peer.
    ConnectPeerAssociation -> Maybe Text
connectPeerId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the device to connect to.
    ConnectPeerAssociation -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the global network.
    ConnectPeerAssociation -> Maybe Text
globalNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the link.
    ConnectPeerAssociation -> Maybe Text
linkId :: Prelude.Maybe Prelude.Text,
    -- | The state of the Connect peer association.
    ConnectPeerAssociation -> Maybe ConnectPeerAssociationState
state :: Prelude.Maybe ConnectPeerAssociationState
  }
  deriving (ConnectPeerAssociation -> ConnectPeerAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectPeerAssociation -> ConnectPeerAssociation -> Bool
$c/= :: ConnectPeerAssociation -> ConnectPeerAssociation -> Bool
== :: ConnectPeerAssociation -> ConnectPeerAssociation -> Bool
$c== :: ConnectPeerAssociation -> ConnectPeerAssociation -> Bool
Prelude.Eq, ReadPrec [ConnectPeerAssociation]
ReadPrec ConnectPeerAssociation
Int -> ReadS ConnectPeerAssociation
ReadS [ConnectPeerAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectPeerAssociation]
$creadListPrec :: ReadPrec [ConnectPeerAssociation]
readPrec :: ReadPrec ConnectPeerAssociation
$creadPrec :: ReadPrec ConnectPeerAssociation
readList :: ReadS [ConnectPeerAssociation]
$creadList :: ReadS [ConnectPeerAssociation]
readsPrec :: Int -> ReadS ConnectPeerAssociation
$creadsPrec :: Int -> ReadS ConnectPeerAssociation
Prelude.Read, Int -> ConnectPeerAssociation -> ShowS
[ConnectPeerAssociation] -> ShowS
ConnectPeerAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectPeerAssociation] -> ShowS
$cshowList :: [ConnectPeerAssociation] -> ShowS
show :: ConnectPeerAssociation -> String
$cshow :: ConnectPeerAssociation -> String
showsPrec :: Int -> ConnectPeerAssociation -> ShowS
$cshowsPrec :: Int -> ConnectPeerAssociation -> ShowS
Prelude.Show, forall x. Rep ConnectPeerAssociation x -> ConnectPeerAssociation
forall x. ConnectPeerAssociation -> Rep ConnectPeerAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectPeerAssociation x -> ConnectPeerAssociation
$cfrom :: forall x. ConnectPeerAssociation -> Rep ConnectPeerAssociation x
Prelude.Generic)

-- |
-- Create a value of 'ConnectPeerAssociation' 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:
--
-- 'connectPeerId', 'connectPeerAssociation_connectPeerId' - The ID of the Connect peer.
--
-- 'deviceId', 'connectPeerAssociation_deviceId' - The ID of the device to connect to.
--
-- 'globalNetworkId', 'connectPeerAssociation_globalNetworkId' - The ID of the global network.
--
-- 'linkId', 'connectPeerAssociation_linkId' - The ID of the link.
--
-- 'state', 'connectPeerAssociation_state' - The state of the Connect peer association.
newConnectPeerAssociation ::
  ConnectPeerAssociation
newConnectPeerAssociation :: ConnectPeerAssociation
newConnectPeerAssociation =
  ConnectPeerAssociation'
    { $sel:connectPeerId:ConnectPeerAssociation' :: Maybe Text
connectPeerId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:ConnectPeerAssociation' :: Maybe Text
deviceId = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:ConnectPeerAssociation' :: Maybe Text
globalNetworkId = forall a. Maybe a
Prelude.Nothing,
      $sel:linkId:ConnectPeerAssociation' :: Maybe Text
linkId = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ConnectPeerAssociation' :: Maybe ConnectPeerAssociationState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the Connect peer.
connectPeerAssociation_connectPeerId :: Lens.Lens' ConnectPeerAssociation (Prelude.Maybe Prelude.Text)
connectPeerAssociation_connectPeerId :: Lens' ConnectPeerAssociation (Maybe Text)
connectPeerAssociation_connectPeerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectPeerAssociation' {Maybe Text
connectPeerId :: Maybe Text
$sel:connectPeerId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
connectPeerId} -> Maybe Text
connectPeerId) (\s :: ConnectPeerAssociation
s@ConnectPeerAssociation' {} Maybe Text
a -> ConnectPeerAssociation
s {$sel:connectPeerId:ConnectPeerAssociation' :: Maybe Text
connectPeerId = Maybe Text
a} :: ConnectPeerAssociation)

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

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

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

-- | The state of the Connect peer association.
connectPeerAssociation_state :: Lens.Lens' ConnectPeerAssociation (Prelude.Maybe ConnectPeerAssociationState)
connectPeerAssociation_state :: Lens' ConnectPeerAssociation (Maybe ConnectPeerAssociationState)
connectPeerAssociation_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectPeerAssociation' {Maybe ConnectPeerAssociationState
state :: Maybe ConnectPeerAssociationState
$sel:state:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe ConnectPeerAssociationState
state} -> Maybe ConnectPeerAssociationState
state) (\s :: ConnectPeerAssociation
s@ConnectPeerAssociation' {} Maybe ConnectPeerAssociationState
a -> ConnectPeerAssociation
s {$sel:state:ConnectPeerAssociation' :: Maybe ConnectPeerAssociationState
state = Maybe ConnectPeerAssociationState
a} :: ConnectPeerAssociation)

instance Data.FromJSON ConnectPeerAssociation where
  parseJSON :: Value -> Parser ConnectPeerAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectPeerAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConnectPeerAssociationState
-> ConnectPeerAssociation
ConnectPeerAssociation'
            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
"ConnectPeerId")
            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 ConnectPeerAssociation where
  hashWithSalt :: Int -> ConnectPeerAssociation -> Int
hashWithSalt Int
_salt ConnectPeerAssociation' {Maybe Text
Maybe ConnectPeerAssociationState
state :: Maybe ConnectPeerAssociationState
linkId :: Maybe Text
globalNetworkId :: Maybe Text
deviceId :: Maybe Text
connectPeerId :: Maybe Text
$sel:state:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe ConnectPeerAssociationState
$sel:linkId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
$sel:globalNetworkId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
$sel:deviceId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
$sel:connectPeerId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectPeerId
      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 ConnectPeerAssociationState
state

instance Prelude.NFData ConnectPeerAssociation where
  rnf :: ConnectPeerAssociation -> ()
rnf ConnectPeerAssociation' {Maybe Text
Maybe ConnectPeerAssociationState
state :: Maybe ConnectPeerAssociationState
linkId :: Maybe Text
globalNetworkId :: Maybe Text
deviceId :: Maybe Text
connectPeerId :: Maybe Text
$sel:state:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe ConnectPeerAssociationState
$sel:linkId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
$sel:globalNetworkId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
$sel:deviceId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
$sel:connectPeerId:ConnectPeerAssociation' :: ConnectPeerAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectPeerId
      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 ConnectPeerAssociationState
state