{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.AssociateMacSecKey
-- 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)
--
-- Associates a MAC Security (MACsec) Connection Key Name (CKN)\/
-- Connectivity Association Key (CAK) pair with an Direct Connect dedicated
-- connection.
--
-- You must supply either the @secretARN,@ or the CKN\/CAK (@ckn@ and
-- @cak@) pair in the request.
--
-- For information about MAC Security (MACsec) key considerations, see
-- <https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-mac-sec-getting-started.html#mac-sec-key-consideration MACsec pre-shared CKN\/CAK key considerations>
-- in the /Direct Connect User Guide/.
module Amazonka.DirectConnect.AssociateMacSecKey
  ( -- * Creating a Request
    AssociateMacSecKey (..),
    newAssociateMacSecKey,

    -- * Request Lenses
    associateMacSecKey_ckn,
    associateMacSecKey_cak,
    associateMacSecKey_secretARN,
    associateMacSecKey_connectionId,

    -- * Destructuring the Response
    AssociateMacSecKeyResponse (..),
    newAssociateMacSecKeyResponse,

    -- * Response Lenses
    associateMacSecKeyResponse_connectionId,
    associateMacSecKeyResponse_macSecKeys,
    associateMacSecKeyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newAssociateMacSecKey' smart constructor.
data AssociateMacSecKey = AssociateMacSecKey'
  { -- | The MAC Security (MACsec) CKN to associate with the dedicated
    -- connection.
    --
    -- You can create the CKN\/CAK pair using an industry standard tool.
    --
    -- The valid values are 64 hexadecimal characters (0-9, A-E).
    --
    -- If you use this request parameter, you must use the @cak@ request
    -- parameter and not use the @secretARN@ request parameter.
    AssociateMacSecKey -> Maybe Text
ckn :: Prelude.Maybe Prelude.Text,
    -- | The MAC Security (MACsec) CAK to associate with the dedicated
    -- connection.
    --
    -- You can create the CKN\/CAK pair using an industry standard tool.
    --
    -- The valid values are 64 hexadecimal characters (0-9, A-E).
    --
    -- If you use this request parameter, you must use the @ckn@ request
    -- parameter and not use the @secretARN@ request parameter.
    AssociateMacSecKey -> Maybe Text
cak :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key
    -- to associate with the dedicated connection.
    --
    -- You can use DescribeConnections or DescribeLags to retrieve the MAC
    -- Security (MACsec) secret key.
    --
    -- If you use this request parameter, you do not use the @ckn@ and @cak@
    -- request parameters.
    AssociateMacSecKey -> Maybe Text
secretARN :: Prelude.Maybe Prelude.Text,
    -- | The ID of the dedicated connection (dxcon-xxxx), or the ID of the LAG
    -- (dxlag-xxxx).
    --
    -- You can use DescribeConnections or DescribeLags to retrieve connection
    -- ID.
    AssociateMacSecKey -> Text
connectionId :: Prelude.Text
  }
  deriving (AssociateMacSecKey -> AssociateMacSecKey -> Bool
(AssociateMacSecKey -> AssociateMacSecKey -> Bool)
-> (AssociateMacSecKey -> AssociateMacSecKey -> Bool)
-> Eq AssociateMacSecKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateMacSecKey -> AssociateMacSecKey -> Bool
$c/= :: AssociateMacSecKey -> AssociateMacSecKey -> Bool
== :: AssociateMacSecKey -> AssociateMacSecKey -> Bool
$c== :: AssociateMacSecKey -> AssociateMacSecKey -> Bool
Prelude.Eq, ReadPrec [AssociateMacSecKey]
ReadPrec AssociateMacSecKey
Int -> ReadS AssociateMacSecKey
ReadS [AssociateMacSecKey]
(Int -> ReadS AssociateMacSecKey)
-> ReadS [AssociateMacSecKey]
-> ReadPrec AssociateMacSecKey
-> ReadPrec [AssociateMacSecKey]
-> Read AssociateMacSecKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateMacSecKey]
$creadListPrec :: ReadPrec [AssociateMacSecKey]
readPrec :: ReadPrec AssociateMacSecKey
$creadPrec :: ReadPrec AssociateMacSecKey
readList :: ReadS [AssociateMacSecKey]
$creadList :: ReadS [AssociateMacSecKey]
readsPrec :: Int -> ReadS AssociateMacSecKey
$creadsPrec :: Int -> ReadS AssociateMacSecKey
Prelude.Read, Int -> AssociateMacSecKey -> ShowS
[AssociateMacSecKey] -> ShowS
AssociateMacSecKey -> String
(Int -> AssociateMacSecKey -> ShowS)
-> (AssociateMacSecKey -> String)
-> ([AssociateMacSecKey] -> ShowS)
-> Show AssociateMacSecKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateMacSecKey] -> ShowS
$cshowList :: [AssociateMacSecKey] -> ShowS
show :: AssociateMacSecKey -> String
$cshow :: AssociateMacSecKey -> String
showsPrec :: Int -> AssociateMacSecKey -> ShowS
$cshowsPrec :: Int -> AssociateMacSecKey -> ShowS
Prelude.Show, (forall x. AssociateMacSecKey -> Rep AssociateMacSecKey x)
-> (forall x. Rep AssociateMacSecKey x -> AssociateMacSecKey)
-> Generic AssociateMacSecKey
forall x. Rep AssociateMacSecKey x -> AssociateMacSecKey
forall x. AssociateMacSecKey -> Rep AssociateMacSecKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateMacSecKey x -> AssociateMacSecKey
$cfrom :: forall x. AssociateMacSecKey -> Rep AssociateMacSecKey x
Prelude.Generic)

-- |
-- Create a value of 'AssociateMacSecKey' 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', 'associateMacSecKey_ckn' - The MAC Security (MACsec) CKN to associate with the dedicated
-- connection.
--
-- You can create the CKN\/CAK pair using an industry standard tool.
--
-- The valid values are 64 hexadecimal characters (0-9, A-E).
--
-- If you use this request parameter, you must use the @cak@ request
-- parameter and not use the @secretARN@ request parameter.
--
-- 'cak', 'associateMacSecKey_cak' - The MAC Security (MACsec) CAK to associate with the dedicated
-- connection.
--
-- You can create the CKN\/CAK pair using an industry standard tool.
--
-- The valid values are 64 hexadecimal characters (0-9, A-E).
--
-- If you use this request parameter, you must use the @ckn@ request
-- parameter and not use the @secretARN@ request parameter.
--
-- 'secretARN', 'associateMacSecKey_secretARN' - The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key
-- to associate with the dedicated connection.
--
-- You can use DescribeConnections or DescribeLags to retrieve the MAC
-- Security (MACsec) secret key.
--
-- If you use this request parameter, you do not use the @ckn@ and @cak@
-- request parameters.
--
-- 'connectionId', 'associateMacSecKey_connectionId' - The ID of the dedicated connection (dxcon-xxxx), or the ID of the LAG
-- (dxlag-xxxx).
--
-- You can use DescribeConnections or DescribeLags to retrieve connection
-- ID.
newAssociateMacSecKey ::
  -- | 'connectionId'
  Prelude.Text ->
  AssociateMacSecKey
newAssociateMacSecKey :: Text -> AssociateMacSecKey
newAssociateMacSecKey Text
pConnectionId_ =
  AssociateMacSecKey' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> AssociateMacSecKey
AssociateMacSecKey'
    { $sel:ckn:AssociateMacSecKey' :: Maybe Text
ckn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cak:AssociateMacSecKey' :: Maybe Text
cak = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretARN:AssociateMacSecKey' :: Maybe Text
secretARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionId:AssociateMacSecKey' :: Text
connectionId = Text
pConnectionId_
    }

-- | The MAC Security (MACsec) CKN to associate with the dedicated
-- connection.
--
-- You can create the CKN\/CAK pair using an industry standard tool.
--
-- The valid values are 64 hexadecimal characters (0-9, A-E).
--
-- If you use this request parameter, you must use the @cak@ request
-- parameter and not use the @secretARN@ request parameter.
associateMacSecKey_ckn :: Lens.Lens' AssociateMacSecKey (Prelude.Maybe Prelude.Text)
associateMacSecKey_ckn :: (Maybe Text -> f (Maybe Text))
-> AssociateMacSecKey -> f AssociateMacSecKey
associateMacSecKey_ckn = (AssociateMacSecKey -> Maybe Text)
-> (AssociateMacSecKey -> Maybe Text -> AssociateMacSecKey)
-> Lens
     AssociateMacSecKey AssociateMacSecKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKey' {Maybe Text
ckn :: Maybe Text
$sel:ckn:AssociateMacSecKey' :: AssociateMacSecKey -> Maybe Text
ckn} -> Maybe Text
ckn) (\s :: AssociateMacSecKey
s@AssociateMacSecKey' {} Maybe Text
a -> AssociateMacSecKey
s {$sel:ckn:AssociateMacSecKey' :: Maybe Text
ckn = Maybe Text
a} :: AssociateMacSecKey)

-- | The MAC Security (MACsec) CAK to associate with the dedicated
-- connection.
--
-- You can create the CKN\/CAK pair using an industry standard tool.
--
-- The valid values are 64 hexadecimal characters (0-9, A-E).
--
-- If you use this request parameter, you must use the @ckn@ request
-- parameter and not use the @secretARN@ request parameter.
associateMacSecKey_cak :: Lens.Lens' AssociateMacSecKey (Prelude.Maybe Prelude.Text)
associateMacSecKey_cak :: (Maybe Text -> f (Maybe Text))
-> AssociateMacSecKey -> f AssociateMacSecKey
associateMacSecKey_cak = (AssociateMacSecKey -> Maybe Text)
-> (AssociateMacSecKey -> Maybe Text -> AssociateMacSecKey)
-> Lens
     AssociateMacSecKey AssociateMacSecKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKey' {Maybe Text
cak :: Maybe Text
$sel:cak:AssociateMacSecKey' :: AssociateMacSecKey -> Maybe Text
cak} -> Maybe Text
cak) (\s :: AssociateMacSecKey
s@AssociateMacSecKey' {} Maybe Text
a -> AssociateMacSecKey
s {$sel:cak:AssociateMacSecKey' :: Maybe Text
cak = Maybe Text
a} :: AssociateMacSecKey)

-- | The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key
-- to associate with the dedicated connection.
--
-- You can use DescribeConnections or DescribeLags to retrieve the MAC
-- Security (MACsec) secret key.
--
-- If you use this request parameter, you do not use the @ckn@ and @cak@
-- request parameters.
associateMacSecKey_secretARN :: Lens.Lens' AssociateMacSecKey (Prelude.Maybe Prelude.Text)
associateMacSecKey_secretARN :: (Maybe Text -> f (Maybe Text))
-> AssociateMacSecKey -> f AssociateMacSecKey
associateMacSecKey_secretARN = (AssociateMacSecKey -> Maybe Text)
-> (AssociateMacSecKey -> Maybe Text -> AssociateMacSecKey)
-> Lens
     AssociateMacSecKey AssociateMacSecKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKey' {Maybe Text
secretARN :: Maybe Text
$sel:secretARN:AssociateMacSecKey' :: AssociateMacSecKey -> Maybe Text
secretARN} -> Maybe Text
secretARN) (\s :: AssociateMacSecKey
s@AssociateMacSecKey' {} Maybe Text
a -> AssociateMacSecKey
s {$sel:secretARN:AssociateMacSecKey' :: Maybe Text
secretARN = Maybe Text
a} :: AssociateMacSecKey)

-- | The ID of the dedicated connection (dxcon-xxxx), or the ID of the LAG
-- (dxlag-xxxx).
--
-- You can use DescribeConnections or DescribeLags to retrieve connection
-- ID.
associateMacSecKey_connectionId :: Lens.Lens' AssociateMacSecKey Prelude.Text
associateMacSecKey_connectionId :: (Text -> f Text) -> AssociateMacSecKey -> f AssociateMacSecKey
associateMacSecKey_connectionId = (AssociateMacSecKey -> Text)
-> (AssociateMacSecKey -> Text -> AssociateMacSecKey)
-> Lens AssociateMacSecKey AssociateMacSecKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKey' {Text
connectionId :: Text
$sel:connectionId:AssociateMacSecKey' :: AssociateMacSecKey -> Text
connectionId} -> Text
connectionId) (\s :: AssociateMacSecKey
s@AssociateMacSecKey' {} Text
a -> AssociateMacSecKey
s {$sel:connectionId:AssociateMacSecKey' :: Text
connectionId = Text
a} :: AssociateMacSecKey)

instance Core.AWSRequest AssociateMacSecKey where
  type
    AWSResponse AssociateMacSecKey =
      AssociateMacSecKeyResponse
  request :: AssociateMacSecKey -> Request AssociateMacSecKey
request = Service -> AssociateMacSecKey -> Request AssociateMacSecKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AssociateMacSecKey
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateMacSecKey)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse AssociateMacSecKey))
-> Logger
-> Service
-> Proxy AssociateMacSecKey
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateMacSecKey)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [MacSecKey] -> Int -> AssociateMacSecKeyResponse
AssociateMacSecKeyResponse'
            (Maybe Text
 -> Maybe [MacSecKey] -> Int -> AssociateMacSecKeyResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [MacSecKey] -> Int -> AssociateMacSecKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"connectionId")
            Either
  String (Maybe [MacSecKey] -> Int -> AssociateMacSecKeyResponse)
-> Either String (Maybe [MacSecKey])
-> Either String (Int -> AssociateMacSecKeyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [MacSecKey]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"macSecKeys" Either String (Maybe (Maybe [MacSecKey]))
-> Maybe [MacSecKey] -> Either String (Maybe [MacSecKey])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MacSecKey]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> AssociateMacSecKeyResponse)
-> Either String Int -> Either String AssociateMacSecKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable AssociateMacSecKey

instance Prelude.NFData AssociateMacSecKey

instance Core.ToHeaders AssociateMacSecKey where
  toHeaders :: AssociateMacSecKey -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateMacSecKey -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.AssociateMacSecKey" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON AssociateMacSecKey where
  toJSON :: AssociateMacSecKey -> Value
toJSON AssociateMacSecKey' {Maybe Text
Text
connectionId :: Text
secretARN :: Maybe Text
cak :: Maybe Text
ckn :: Maybe Text
$sel:connectionId:AssociateMacSecKey' :: AssociateMacSecKey -> Text
$sel:secretARN:AssociateMacSecKey' :: AssociateMacSecKey -> Maybe Text
$sel:cak:AssociateMacSecKey' :: AssociateMacSecKey -> Maybe Text
$sel:ckn:AssociateMacSecKey' :: AssociateMacSecKey -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ckn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ckn,
            (Text
"cak" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cak,
            (Text
"secretARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
secretARN,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"connectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionId)
          ]
      )

instance Core.ToPath AssociateMacSecKey where
  toPath :: AssociateMacSecKey -> ByteString
toPath = ByteString -> AssociateMacSecKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery AssociateMacSecKey where
  toQuery :: AssociateMacSecKey -> QueryString
toQuery = QueryString -> AssociateMacSecKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newAssociateMacSecKeyResponse' smart constructor.
data AssociateMacSecKeyResponse = AssociateMacSecKeyResponse'
  { -- | The ID of the dedicated connection (dxcon-xxxx), or the ID of the LAG
    -- (dxlag-xxxx).
    AssociateMacSecKeyResponse -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
    -- | The MAC Security (MACsec) security keys associated with the dedicated
    -- connection.
    AssociateMacSecKeyResponse -> Maybe [MacSecKey]
macSecKeys :: Prelude.Maybe [MacSecKey],
    -- | The response's http status code.
    AssociateMacSecKeyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateMacSecKeyResponse -> AssociateMacSecKeyResponse -> Bool
(AssociateMacSecKeyResponse -> AssociateMacSecKeyResponse -> Bool)
-> (AssociateMacSecKeyResponse
    -> AssociateMacSecKeyResponse -> Bool)
-> Eq AssociateMacSecKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateMacSecKeyResponse -> AssociateMacSecKeyResponse -> Bool
$c/= :: AssociateMacSecKeyResponse -> AssociateMacSecKeyResponse -> Bool
== :: AssociateMacSecKeyResponse -> AssociateMacSecKeyResponse -> Bool
$c== :: AssociateMacSecKeyResponse -> AssociateMacSecKeyResponse -> Bool
Prelude.Eq, ReadPrec [AssociateMacSecKeyResponse]
ReadPrec AssociateMacSecKeyResponse
Int -> ReadS AssociateMacSecKeyResponse
ReadS [AssociateMacSecKeyResponse]
(Int -> ReadS AssociateMacSecKeyResponse)
-> ReadS [AssociateMacSecKeyResponse]
-> ReadPrec AssociateMacSecKeyResponse
-> ReadPrec [AssociateMacSecKeyResponse]
-> Read AssociateMacSecKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateMacSecKeyResponse]
$creadListPrec :: ReadPrec [AssociateMacSecKeyResponse]
readPrec :: ReadPrec AssociateMacSecKeyResponse
$creadPrec :: ReadPrec AssociateMacSecKeyResponse
readList :: ReadS [AssociateMacSecKeyResponse]
$creadList :: ReadS [AssociateMacSecKeyResponse]
readsPrec :: Int -> ReadS AssociateMacSecKeyResponse
$creadsPrec :: Int -> ReadS AssociateMacSecKeyResponse
Prelude.Read, Int -> AssociateMacSecKeyResponse -> ShowS
[AssociateMacSecKeyResponse] -> ShowS
AssociateMacSecKeyResponse -> String
(Int -> AssociateMacSecKeyResponse -> ShowS)
-> (AssociateMacSecKeyResponse -> String)
-> ([AssociateMacSecKeyResponse] -> ShowS)
-> Show AssociateMacSecKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateMacSecKeyResponse] -> ShowS
$cshowList :: [AssociateMacSecKeyResponse] -> ShowS
show :: AssociateMacSecKeyResponse -> String
$cshow :: AssociateMacSecKeyResponse -> String
showsPrec :: Int -> AssociateMacSecKeyResponse -> ShowS
$cshowsPrec :: Int -> AssociateMacSecKeyResponse -> ShowS
Prelude.Show, (forall x.
 AssociateMacSecKeyResponse -> Rep AssociateMacSecKeyResponse x)
-> (forall x.
    Rep AssociateMacSecKeyResponse x -> AssociateMacSecKeyResponse)
-> Generic AssociateMacSecKeyResponse
forall x.
Rep AssociateMacSecKeyResponse x -> AssociateMacSecKeyResponse
forall x.
AssociateMacSecKeyResponse -> Rep AssociateMacSecKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateMacSecKeyResponse x -> AssociateMacSecKeyResponse
$cfrom :: forall x.
AssociateMacSecKeyResponse -> Rep AssociateMacSecKeyResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateMacSecKeyResponse' 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:
--
-- 'connectionId', 'associateMacSecKeyResponse_connectionId' - The ID of the dedicated connection (dxcon-xxxx), or the ID of the LAG
-- (dxlag-xxxx).
--
-- 'macSecKeys', 'associateMacSecKeyResponse_macSecKeys' - The MAC Security (MACsec) security keys associated with the dedicated
-- connection.
--
-- 'httpStatus', 'associateMacSecKeyResponse_httpStatus' - The response's http status code.
newAssociateMacSecKeyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateMacSecKeyResponse
newAssociateMacSecKeyResponse :: Int -> AssociateMacSecKeyResponse
newAssociateMacSecKeyResponse Int
pHttpStatus_ =
  AssociateMacSecKeyResponse' :: Maybe Text
-> Maybe [MacSecKey] -> Int -> AssociateMacSecKeyResponse
AssociateMacSecKeyResponse'
    { $sel:connectionId:AssociateMacSecKeyResponse' :: Maybe Text
connectionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:macSecKeys:AssociateMacSecKeyResponse' :: Maybe [MacSecKey]
macSecKeys = Maybe [MacSecKey]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateMacSecKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the dedicated connection (dxcon-xxxx), or the ID of the LAG
-- (dxlag-xxxx).
associateMacSecKeyResponse_connectionId :: Lens.Lens' AssociateMacSecKeyResponse (Prelude.Maybe Prelude.Text)
associateMacSecKeyResponse_connectionId :: (Maybe Text -> f (Maybe Text))
-> AssociateMacSecKeyResponse -> f AssociateMacSecKeyResponse
associateMacSecKeyResponse_connectionId = (AssociateMacSecKeyResponse -> Maybe Text)
-> (AssociateMacSecKeyResponse
    -> Maybe Text -> AssociateMacSecKeyResponse)
-> Lens
     AssociateMacSecKeyResponse
     AssociateMacSecKeyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKeyResponse' {Maybe Text
connectionId :: Maybe Text
$sel:connectionId:AssociateMacSecKeyResponse' :: AssociateMacSecKeyResponse -> Maybe Text
connectionId} -> Maybe Text
connectionId) (\s :: AssociateMacSecKeyResponse
s@AssociateMacSecKeyResponse' {} Maybe Text
a -> AssociateMacSecKeyResponse
s {$sel:connectionId:AssociateMacSecKeyResponse' :: Maybe Text
connectionId = Maybe Text
a} :: AssociateMacSecKeyResponse)

-- | The MAC Security (MACsec) security keys associated with the dedicated
-- connection.
associateMacSecKeyResponse_macSecKeys :: Lens.Lens' AssociateMacSecKeyResponse (Prelude.Maybe [MacSecKey])
associateMacSecKeyResponse_macSecKeys :: (Maybe [MacSecKey] -> f (Maybe [MacSecKey]))
-> AssociateMacSecKeyResponse -> f AssociateMacSecKeyResponse
associateMacSecKeyResponse_macSecKeys = (AssociateMacSecKeyResponse -> Maybe [MacSecKey])
-> (AssociateMacSecKeyResponse
    -> Maybe [MacSecKey] -> AssociateMacSecKeyResponse)
-> Lens
     AssociateMacSecKeyResponse
     AssociateMacSecKeyResponse
     (Maybe [MacSecKey])
     (Maybe [MacSecKey])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKeyResponse' {Maybe [MacSecKey]
macSecKeys :: Maybe [MacSecKey]
$sel:macSecKeys:AssociateMacSecKeyResponse' :: AssociateMacSecKeyResponse -> Maybe [MacSecKey]
macSecKeys} -> Maybe [MacSecKey]
macSecKeys) (\s :: AssociateMacSecKeyResponse
s@AssociateMacSecKeyResponse' {} Maybe [MacSecKey]
a -> AssociateMacSecKeyResponse
s {$sel:macSecKeys:AssociateMacSecKeyResponse' :: Maybe [MacSecKey]
macSecKeys = Maybe [MacSecKey]
a} :: AssociateMacSecKeyResponse) ((Maybe [MacSecKey] -> f (Maybe [MacSecKey]))
 -> AssociateMacSecKeyResponse -> f AssociateMacSecKeyResponse)
-> ((Maybe [MacSecKey] -> f (Maybe [MacSecKey]))
    -> Maybe [MacSecKey] -> f (Maybe [MacSecKey]))
-> (Maybe [MacSecKey] -> f (Maybe [MacSecKey]))
-> AssociateMacSecKeyResponse
-> f AssociateMacSecKeyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MacSecKey] [MacSecKey] [MacSecKey] [MacSecKey]
-> Iso
     (Maybe [MacSecKey])
     (Maybe [MacSecKey])
     (Maybe [MacSecKey])
     (Maybe [MacSecKey])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [MacSecKey] [MacSecKey] [MacSecKey] [MacSecKey]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
associateMacSecKeyResponse_httpStatus :: Lens.Lens' AssociateMacSecKeyResponse Prelude.Int
associateMacSecKeyResponse_httpStatus :: (Int -> f Int)
-> AssociateMacSecKeyResponse -> f AssociateMacSecKeyResponse
associateMacSecKeyResponse_httpStatus = (AssociateMacSecKeyResponse -> Int)
-> (AssociateMacSecKeyResponse
    -> Int -> AssociateMacSecKeyResponse)
-> Lens
     AssociateMacSecKeyResponse AssociateMacSecKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateMacSecKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateMacSecKeyResponse' :: AssociateMacSecKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateMacSecKeyResponse
s@AssociateMacSecKeyResponse' {} Int
a -> AssociateMacSecKeyResponse
s {$sel:httpStatus:AssociateMacSecKeyResponse' :: Int
httpStatus = Int
a} :: AssociateMacSecKeyResponse)

instance Prelude.NFData AssociateMacSecKeyResponse