{-# 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.DirectConnect.Types.MacSecKey
-- 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.DirectConnect.Types.MacSecKey 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

-- | Information about the MAC Security (MACsec) secret key.
--
-- /See:/ 'newMacSecKey' smart constructor.
data MacSecKey = MacSecKey'
  { -- | The Connection Key Name (CKN) for the MAC Security secret key.
    MacSecKey -> Maybe Text
ckn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key.
    MacSecKey -> Maybe Text
secretARN :: Prelude.Maybe Prelude.Text,
    -- | The date that the MAC Security (MACsec) secret key takes effect. The
    -- value is displayed in UTC format.
    MacSecKey -> Maybe Text
startOn :: Prelude.Maybe Prelude.Text,
    -- | The state of the MAC Security (MACsec) secret key.
    --
    -- The possible values are:
    --
    -- -   @associating@: The MAC Security (MACsec) secret key is being
    --     validated and not yet associated with the connection or LAG.
    --
    -- -   @associated@: The MAC Security (MACsec) secret key is validated and
    --     associated with the connection or LAG.
    --
    -- -   @disassociating@: The MAC Security (MACsec) secret key is being
    --     disassociated from the connection or LAG
    --
    -- -   @disassociated@: The MAC Security (MACsec) secret key is no longer
    --     associated with the connection or LAG.
    MacSecKey -> Maybe Text
state :: Prelude.Maybe Prelude.Text
  }
  deriving (MacSecKey -> MacSecKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MacSecKey -> MacSecKey -> Bool
$c/= :: MacSecKey -> MacSecKey -> Bool
== :: MacSecKey -> MacSecKey -> Bool
$c== :: MacSecKey -> MacSecKey -> Bool
Prelude.Eq, ReadPrec [MacSecKey]
ReadPrec MacSecKey
Int -> ReadS MacSecKey
ReadS [MacSecKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MacSecKey]
$creadListPrec :: ReadPrec [MacSecKey]
readPrec :: ReadPrec MacSecKey
$creadPrec :: ReadPrec MacSecKey
readList :: ReadS [MacSecKey]
$creadList :: ReadS [MacSecKey]
readsPrec :: Int -> ReadS MacSecKey
$creadsPrec :: Int -> ReadS MacSecKey
Prelude.Read, Int -> MacSecKey -> ShowS
[MacSecKey] -> ShowS
MacSecKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MacSecKey] -> ShowS
$cshowList :: [MacSecKey] -> ShowS
show :: MacSecKey -> String
$cshow :: MacSecKey -> String
showsPrec :: Int -> MacSecKey -> ShowS
$cshowsPrec :: Int -> MacSecKey -> ShowS
Prelude.Show, forall x. Rep MacSecKey x -> MacSecKey
forall x. MacSecKey -> Rep MacSecKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MacSecKey x -> MacSecKey
$cfrom :: forall x. MacSecKey -> Rep MacSecKey x
Prelude.Generic)

-- |
-- Create a value of 'MacSecKey' 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:
--
-- 'ckn', 'macSecKey_ckn' - The Connection Key Name (CKN) for the MAC Security secret key.
--
-- 'secretARN', 'macSecKey_secretARN' - The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key.
--
-- 'startOn', 'macSecKey_startOn' - The date that the MAC Security (MACsec) secret key takes effect. The
-- value is displayed in UTC format.
--
-- 'state', 'macSecKey_state' - The state of the MAC Security (MACsec) secret key.
--
-- The possible values are:
--
-- -   @associating@: The MAC Security (MACsec) secret key is being
--     validated and not yet associated with the connection or LAG.
--
-- -   @associated@: The MAC Security (MACsec) secret key is validated and
--     associated with the connection or LAG.
--
-- -   @disassociating@: The MAC Security (MACsec) secret key is being
--     disassociated from the connection or LAG
--
-- -   @disassociated@: The MAC Security (MACsec) secret key is no longer
--     associated with the connection or LAG.
newMacSecKey ::
  MacSecKey
newMacSecKey :: MacSecKey
newMacSecKey =
  MacSecKey'
    { $sel:ckn:MacSecKey' :: Maybe Text
ckn = forall a. Maybe a
Prelude.Nothing,
      $sel:secretARN:MacSecKey' :: Maybe Text
secretARN = forall a. Maybe a
Prelude.Nothing,
      $sel:startOn:MacSecKey' :: Maybe Text
startOn = forall a. Maybe a
Prelude.Nothing,
      $sel:state:MacSecKey' :: Maybe Text
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The Connection Key Name (CKN) for the MAC Security secret key.
macSecKey_ckn :: Lens.Lens' MacSecKey (Prelude.Maybe Prelude.Text)
macSecKey_ckn :: Lens' MacSecKey (Maybe Text)
macSecKey_ckn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MacSecKey' {Maybe Text
ckn :: Maybe Text
$sel:ckn:MacSecKey' :: MacSecKey -> Maybe Text
ckn} -> Maybe Text
ckn) (\s :: MacSecKey
s@MacSecKey' {} Maybe Text
a -> MacSecKey
s {$sel:ckn:MacSecKey' :: Maybe Text
ckn = Maybe Text
a} :: MacSecKey)

-- | The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key.
macSecKey_secretARN :: Lens.Lens' MacSecKey (Prelude.Maybe Prelude.Text)
macSecKey_secretARN :: Lens' MacSecKey (Maybe Text)
macSecKey_secretARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MacSecKey' {Maybe Text
secretARN :: Maybe Text
$sel:secretARN:MacSecKey' :: MacSecKey -> Maybe Text
secretARN} -> Maybe Text
secretARN) (\s :: MacSecKey
s@MacSecKey' {} Maybe Text
a -> MacSecKey
s {$sel:secretARN:MacSecKey' :: Maybe Text
secretARN = Maybe Text
a} :: MacSecKey)

-- | The date that the MAC Security (MACsec) secret key takes effect. The
-- value is displayed in UTC format.
macSecKey_startOn :: Lens.Lens' MacSecKey (Prelude.Maybe Prelude.Text)
macSecKey_startOn :: Lens' MacSecKey (Maybe Text)
macSecKey_startOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MacSecKey' {Maybe Text
startOn :: Maybe Text
$sel:startOn:MacSecKey' :: MacSecKey -> Maybe Text
startOn} -> Maybe Text
startOn) (\s :: MacSecKey
s@MacSecKey' {} Maybe Text
a -> MacSecKey
s {$sel:startOn:MacSecKey' :: Maybe Text
startOn = Maybe Text
a} :: MacSecKey)

-- | The state of the MAC Security (MACsec) secret key.
--
-- The possible values are:
--
-- -   @associating@: The MAC Security (MACsec) secret key is being
--     validated and not yet associated with the connection or LAG.
--
-- -   @associated@: The MAC Security (MACsec) secret key is validated and
--     associated with the connection or LAG.
--
-- -   @disassociating@: The MAC Security (MACsec) secret key is being
--     disassociated from the connection or LAG
--
-- -   @disassociated@: The MAC Security (MACsec) secret key is no longer
--     associated with the connection or LAG.
macSecKey_state :: Lens.Lens' MacSecKey (Prelude.Maybe Prelude.Text)
macSecKey_state :: Lens' MacSecKey (Maybe Text)
macSecKey_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MacSecKey' {Maybe Text
state :: Maybe Text
$sel:state:MacSecKey' :: MacSecKey -> Maybe Text
state} -> Maybe Text
state) (\s :: MacSecKey
s@MacSecKey' {} Maybe Text
a -> MacSecKey
s {$sel:state:MacSecKey' :: Maybe Text
state = Maybe Text
a} :: MacSecKey)

instance Data.FromJSON MacSecKey where
  parseJSON :: Value -> Parser MacSecKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MacSecKey"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> MacSecKey
MacSecKey'
            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
"ckn")
            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
"secretARN")
            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
"startOn")
            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 MacSecKey where
  hashWithSalt :: Int -> MacSecKey -> Int
hashWithSalt Int
_salt MacSecKey' {Maybe Text
state :: Maybe Text
startOn :: Maybe Text
secretARN :: Maybe Text
ckn :: Maybe Text
$sel:state:MacSecKey' :: MacSecKey -> Maybe Text
$sel:startOn:MacSecKey' :: MacSecKey -> Maybe Text
$sel:secretARN:MacSecKey' :: MacSecKey -> Maybe Text
$sel:ckn:MacSecKey' :: MacSecKey -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ckn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
secretARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
startOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
state

instance Prelude.NFData MacSecKey where
  rnf :: MacSecKey -> ()
rnf MacSecKey' {Maybe Text
state :: Maybe Text
startOn :: Maybe Text
secretARN :: Maybe Text
ckn :: Maybe Text
$sel:state:MacSecKey' :: MacSecKey -> Maybe Text
$sel:startOn:MacSecKey' :: MacSecKey -> Maybe Text
$sel:secretARN:MacSecKey' :: MacSecKey -> Maybe Text
$sel:ckn:MacSecKey' :: MacSecKey -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ckn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
secretARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
startOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
state