{-# 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.WorkSpaces.Types.ConnectionAliasAssociation
-- 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.WorkSpaces.Types.ConnectionAliasAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.AssociationStatus

-- | Describes a connection alias association that is used for cross-Region
-- redirection. For more information, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/cross-region-redirection.html Cross-Region Redirection for Amazon WorkSpaces>.
--
-- /See:/ 'newConnectionAliasAssociation' smart constructor.
data ConnectionAliasAssociation = ConnectionAliasAssociation'
  { -- | The identifier of the Amazon Web Services account that associated the
    -- connection alias with a directory.
    ConnectionAliasAssociation -> Maybe Text
associatedAccountId :: Prelude.Maybe Prelude.Text,
    -- | The association status of the connection alias.
    ConnectionAliasAssociation -> Maybe AssociationStatus
associationStatus :: Prelude.Maybe AssociationStatus,
    -- | The identifier of the connection alias association. You use the
    -- connection identifier in the DNS TXT record when you\'re configuring
    -- your DNS routing policies.
    ConnectionAliasAssociation -> Maybe Text
connectionIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the directory associated with a connection alias.
    ConnectionAliasAssociation -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text
  }
  deriving (ConnectionAliasAssociation -> ConnectionAliasAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionAliasAssociation -> ConnectionAliasAssociation -> Bool
$c/= :: ConnectionAliasAssociation -> ConnectionAliasAssociation -> Bool
== :: ConnectionAliasAssociation -> ConnectionAliasAssociation -> Bool
$c== :: ConnectionAliasAssociation -> ConnectionAliasAssociation -> Bool
Prelude.Eq, ReadPrec [ConnectionAliasAssociation]
ReadPrec ConnectionAliasAssociation
Int -> ReadS ConnectionAliasAssociation
ReadS [ConnectionAliasAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionAliasAssociation]
$creadListPrec :: ReadPrec [ConnectionAliasAssociation]
readPrec :: ReadPrec ConnectionAliasAssociation
$creadPrec :: ReadPrec ConnectionAliasAssociation
readList :: ReadS [ConnectionAliasAssociation]
$creadList :: ReadS [ConnectionAliasAssociation]
readsPrec :: Int -> ReadS ConnectionAliasAssociation
$creadsPrec :: Int -> ReadS ConnectionAliasAssociation
Prelude.Read, Int -> ConnectionAliasAssociation -> ShowS
[ConnectionAliasAssociation] -> ShowS
ConnectionAliasAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionAliasAssociation] -> ShowS
$cshowList :: [ConnectionAliasAssociation] -> ShowS
show :: ConnectionAliasAssociation -> String
$cshow :: ConnectionAliasAssociation -> String
showsPrec :: Int -> ConnectionAliasAssociation -> ShowS
$cshowsPrec :: Int -> ConnectionAliasAssociation -> ShowS
Prelude.Show, forall x.
Rep ConnectionAliasAssociation x -> ConnectionAliasAssociation
forall x.
ConnectionAliasAssociation -> Rep ConnectionAliasAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectionAliasAssociation x -> ConnectionAliasAssociation
$cfrom :: forall x.
ConnectionAliasAssociation -> Rep ConnectionAliasAssociation x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionAliasAssociation' 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:
--
-- 'associatedAccountId', 'connectionAliasAssociation_associatedAccountId' - The identifier of the Amazon Web Services account that associated the
-- connection alias with a directory.
--
-- 'associationStatus', 'connectionAliasAssociation_associationStatus' - The association status of the connection alias.
--
-- 'connectionIdentifier', 'connectionAliasAssociation_connectionIdentifier' - The identifier of the connection alias association. You use the
-- connection identifier in the DNS TXT record when you\'re configuring
-- your DNS routing policies.
--
-- 'resourceId', 'connectionAliasAssociation_resourceId' - The identifier of the directory associated with a connection alias.
newConnectionAliasAssociation ::
  ConnectionAliasAssociation
newConnectionAliasAssociation :: ConnectionAliasAssociation
newConnectionAliasAssociation =
  ConnectionAliasAssociation'
    { $sel:associatedAccountId:ConnectionAliasAssociation' :: Maybe Text
associatedAccountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:associationStatus:ConnectionAliasAssociation' :: Maybe AssociationStatus
associationStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:connectionIdentifier:ConnectionAliasAssociation' :: Maybe Text
connectionIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:ConnectionAliasAssociation' :: Maybe Text
resourceId = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the Amazon Web Services account that associated the
-- connection alias with a directory.
connectionAliasAssociation_associatedAccountId :: Lens.Lens' ConnectionAliasAssociation (Prelude.Maybe Prelude.Text)
connectionAliasAssociation_associatedAccountId :: Lens' ConnectionAliasAssociation (Maybe Text)
connectionAliasAssociation_associatedAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAliasAssociation' {Maybe Text
associatedAccountId :: Maybe Text
$sel:associatedAccountId:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
associatedAccountId} -> Maybe Text
associatedAccountId) (\s :: ConnectionAliasAssociation
s@ConnectionAliasAssociation' {} Maybe Text
a -> ConnectionAliasAssociation
s {$sel:associatedAccountId:ConnectionAliasAssociation' :: Maybe Text
associatedAccountId = Maybe Text
a} :: ConnectionAliasAssociation)

-- | The association status of the connection alias.
connectionAliasAssociation_associationStatus :: Lens.Lens' ConnectionAliasAssociation (Prelude.Maybe AssociationStatus)
connectionAliasAssociation_associationStatus :: Lens' ConnectionAliasAssociation (Maybe AssociationStatus)
connectionAliasAssociation_associationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAliasAssociation' {Maybe AssociationStatus
associationStatus :: Maybe AssociationStatus
$sel:associationStatus:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe AssociationStatus
associationStatus} -> Maybe AssociationStatus
associationStatus) (\s :: ConnectionAliasAssociation
s@ConnectionAliasAssociation' {} Maybe AssociationStatus
a -> ConnectionAliasAssociation
s {$sel:associationStatus:ConnectionAliasAssociation' :: Maybe AssociationStatus
associationStatus = Maybe AssociationStatus
a} :: ConnectionAliasAssociation)

-- | The identifier of the connection alias association. You use the
-- connection identifier in the DNS TXT record when you\'re configuring
-- your DNS routing policies.
connectionAliasAssociation_connectionIdentifier :: Lens.Lens' ConnectionAliasAssociation (Prelude.Maybe Prelude.Text)
connectionAliasAssociation_connectionIdentifier :: Lens' ConnectionAliasAssociation (Maybe Text)
connectionAliasAssociation_connectionIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAliasAssociation' {Maybe Text
connectionIdentifier :: Maybe Text
$sel:connectionIdentifier:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
connectionIdentifier} -> Maybe Text
connectionIdentifier) (\s :: ConnectionAliasAssociation
s@ConnectionAliasAssociation' {} Maybe Text
a -> ConnectionAliasAssociation
s {$sel:connectionIdentifier:ConnectionAliasAssociation' :: Maybe Text
connectionIdentifier = Maybe Text
a} :: ConnectionAliasAssociation)

-- | The identifier of the directory associated with a connection alias.
connectionAliasAssociation_resourceId :: Lens.Lens' ConnectionAliasAssociation (Prelude.Maybe Prelude.Text)
connectionAliasAssociation_resourceId :: Lens' ConnectionAliasAssociation (Maybe Text)
connectionAliasAssociation_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAliasAssociation' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: ConnectionAliasAssociation
s@ConnectionAliasAssociation' {} Maybe Text
a -> ConnectionAliasAssociation
s {$sel:resourceId:ConnectionAliasAssociation' :: Maybe Text
resourceId = Maybe Text
a} :: ConnectionAliasAssociation)

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

instance Prelude.Hashable ConnectionAliasAssociation where
  hashWithSalt :: Int -> ConnectionAliasAssociation -> Int
hashWithSalt Int
_salt ConnectionAliasAssociation' {Maybe Text
Maybe AssociationStatus
resourceId :: Maybe Text
connectionIdentifier :: Maybe Text
associationStatus :: Maybe AssociationStatus
associatedAccountId :: Maybe Text
$sel:resourceId:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
$sel:connectionIdentifier:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
$sel:associationStatus:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe AssociationStatus
$sel:associatedAccountId:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
associatedAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssociationStatus
associationStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceId

instance Prelude.NFData ConnectionAliasAssociation where
  rnf :: ConnectionAliasAssociation -> ()
rnf ConnectionAliasAssociation' {Maybe Text
Maybe AssociationStatus
resourceId :: Maybe Text
connectionIdentifier :: Maybe Text
associationStatus :: Maybe AssociationStatus
associatedAccountId :: Maybe Text
$sel:resourceId:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
$sel:connectionIdentifier:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
$sel:associationStatus:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe AssociationStatus
$sel:associatedAccountId:ConnectionAliasAssociation' :: ConnectionAliasAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associatedAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AssociationStatus
associationStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId