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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the MAC Security (MACsec) secret key.
--
-- /See:/ 'newMacSecKey' smart constructor.
data MacSecKey = 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 -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (MacSecKey -> MacSecKey -> Bool
(MacSecKey -> MacSecKey -> Bool)
-> (MacSecKey -> MacSecKey -> Bool) -> Eq MacSecKey
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]
(Int -> ReadS MacSecKey)
-> ReadS [MacSecKey]
-> ReadPrec MacSecKey
-> ReadPrec [MacSecKey]
-> Read 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
(Int -> MacSecKey -> ShowS)
-> (MacSecKey -> String)
-> ([MacSecKey] -> ShowS)
-> Show MacSecKey
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. MacSecKey -> Rep MacSecKey x)
-> (forall x. Rep MacSecKey x -> MacSecKey) -> Generic MacSecKey
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:
--
-- '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.
--
-- '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.
newMacSecKey ::
  MacSecKey
newMacSecKey :: MacSecKey
newMacSecKey =
  MacSecKey' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> MacSecKey
MacSecKey'
    { $sel:state:MacSecKey' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ckn:MacSecKey' :: Maybe Text
ckn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretARN:MacSecKey' :: Maybe Text
secretARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startOn:MacSecKey' :: Maybe Text
startOn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> MacSecKey -> f MacSecKey
macSecKey_state = (MacSecKey -> Maybe Text)
-> (MacSecKey -> Maybe Text -> MacSecKey)
-> Lens MacSecKey MacSecKey (Maybe Text) (Maybe Text)
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)

-- | The Connection Key Name (CKN) for the MAC Security secret key.
macSecKey_ckn :: Lens.Lens' MacSecKey (Prelude.Maybe Prelude.Text)
macSecKey_ckn :: (Maybe Text -> f (Maybe Text)) -> MacSecKey -> f MacSecKey
macSecKey_ckn = (MacSecKey -> Maybe Text)
-> (MacSecKey -> Maybe Text -> MacSecKey)
-> Lens MacSecKey MacSecKey (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> MacSecKey -> f MacSecKey
macSecKey_secretARN = (MacSecKey -> Maybe Text)
-> (MacSecKey -> Maybe Text -> MacSecKey)
-> Lens MacSecKey MacSecKey (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> MacSecKey -> f MacSecKey
macSecKey_startOn = (MacSecKey -> Maybe Text)
-> (MacSecKey -> Maybe Text -> MacSecKey)
-> Lens MacSecKey MacSecKey (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON MacSecKey where
  parseJSON :: Value -> Parser MacSecKey
parseJSON =
    String -> (Object -> Parser MacSecKey) -> Value -> Parser MacSecKey
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MacSecKey"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> MacSecKey
MacSecKey'
            (Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> MacSecKey)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> MacSecKey)
forall (f :: * -> *) a b. Functor 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
"state")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> MacSecKey)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> MacSecKey)
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
"ckn")
            Parser (Maybe Text -> Maybe Text -> MacSecKey)
-> Parser (Maybe Text) -> Parser (Maybe Text -> MacSecKey)
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
"secretARN")
            Parser (Maybe Text -> MacSecKey)
-> Parser (Maybe Text) -> Parser MacSecKey
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
"startOn")
      )

instance Prelude.Hashable MacSecKey

instance Prelude.NFData MacSecKey