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

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

-- |
-- Create a value of 'LinkAssociation' 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:
--
-- 'deviceId', 'linkAssociation_deviceId' - The device ID for the link association.
--
-- 'globalNetworkId', 'linkAssociation_globalNetworkId' - The ID of the global network.
--
-- 'linkAssociationState', 'linkAssociation_linkAssociationState' - The state of the association.
--
-- 'linkId', 'linkAssociation_linkId' - The ID of the link.
newLinkAssociation ::
  LinkAssociation
newLinkAssociation :: LinkAssociation
newLinkAssociation =
  LinkAssociation'
    { $sel:deviceId:LinkAssociation' :: Maybe Text
deviceId = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:LinkAssociation' :: Maybe Text
globalNetworkId = forall a. Maybe a
Prelude.Nothing,
      $sel:linkAssociationState:LinkAssociation' :: Maybe LinkAssociationState
linkAssociationState = forall a. Maybe a
Prelude.Nothing,
      $sel:linkId:LinkAssociation' :: Maybe Text
linkId = forall a. Maybe a
Prelude.Nothing
    }

-- | The device ID for the link association.
linkAssociation_deviceId :: Lens.Lens' LinkAssociation (Prelude.Maybe Prelude.Text)
linkAssociation_deviceId :: Lens' LinkAssociation (Maybe Text)
linkAssociation_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinkAssociation' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:LinkAssociation' :: LinkAssociation -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: LinkAssociation
s@LinkAssociation' {} Maybe Text
a -> LinkAssociation
s {$sel:deviceId:LinkAssociation' :: Maybe Text
deviceId = Maybe Text
a} :: LinkAssociation)

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

-- | The state of the association.
linkAssociation_linkAssociationState :: Lens.Lens' LinkAssociation (Prelude.Maybe LinkAssociationState)
linkAssociation_linkAssociationState :: Lens' LinkAssociation (Maybe LinkAssociationState)
linkAssociation_linkAssociationState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinkAssociation' {Maybe LinkAssociationState
linkAssociationState :: Maybe LinkAssociationState
$sel:linkAssociationState:LinkAssociation' :: LinkAssociation -> Maybe LinkAssociationState
linkAssociationState} -> Maybe LinkAssociationState
linkAssociationState) (\s :: LinkAssociation
s@LinkAssociation' {} Maybe LinkAssociationState
a -> LinkAssociation
s {$sel:linkAssociationState:LinkAssociation' :: Maybe LinkAssociationState
linkAssociationState = Maybe LinkAssociationState
a} :: LinkAssociation)

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

instance Data.FromJSON LinkAssociation where
  parseJSON :: Value -> Parser LinkAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LinkAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe LinkAssociationState
-> Maybe Text
-> LinkAssociation
LinkAssociation'
            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
"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
"LinkAssociationState")
            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")
      )

instance Prelude.Hashable LinkAssociation where
  hashWithSalt :: Int -> LinkAssociation -> Int
hashWithSalt Int
_salt LinkAssociation' {Maybe Text
Maybe LinkAssociationState
linkId :: Maybe Text
linkAssociationState :: Maybe LinkAssociationState
globalNetworkId :: Maybe Text
deviceId :: Maybe Text
$sel:linkId:LinkAssociation' :: LinkAssociation -> Maybe Text
$sel:linkAssociationState:LinkAssociation' :: LinkAssociation -> Maybe LinkAssociationState
$sel:globalNetworkId:LinkAssociation' :: LinkAssociation -> Maybe Text
$sel:deviceId:LinkAssociation' :: LinkAssociation -> Maybe Text
..} =
    Int
_salt
      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 LinkAssociationState
linkAssociationState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linkId

instance Prelude.NFData LinkAssociation where
  rnf :: LinkAssociation -> ()
rnf LinkAssociation' {Maybe Text
Maybe LinkAssociationState
linkId :: Maybe Text
linkAssociationState :: Maybe LinkAssociationState
globalNetworkId :: Maybe Text
deviceId :: Maybe Text
$sel:linkId:LinkAssociation' :: LinkAssociation -> Maybe Text
$sel:linkAssociationState:LinkAssociation' :: LinkAssociation -> Maybe LinkAssociationState
$sel:globalNetworkId:LinkAssociation' :: LinkAssociation -> Maybe Text
$sel:deviceId:LinkAssociation' :: LinkAssociation -> Maybe Text
..} =
    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 LinkAssociationState
linkAssociationState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linkId