Skip to content

associate_mac_sec_key async

associate_mac_sec_key(
    connection_id: ConnectionId,
    *,
    config_overrides: Optional[AsyncDirectConnectClientConfig] = None,
    secret_arn: Optional[SecretARN] = None,
    ckn: Optional[Ckn] = None,
    cak: Optional[Cak] = None,
) -> AssociateMacSecKeyResponse

Associates a MAC Security (MACsec) Connection Key Name (CKN)/ Connectivity Association Key (CAK) pair with a Direct Connect 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 MACsec pre-shared CKN/CAK key considerations in the Direct Connect User Guide.

Parameters:

  • connection_id (ConnectionId) –

    The ID of the dedicated connection (dxcon-xxxx), interconnect (dxcon-xxxx), or LAG (dxlag-xxxx).

    You can use DescribeConnections, DescribeInterconnects, or DescribeLags to retrieve connection ID.

  • secret_arn (Optional[SecretARN], default: None ) –

    The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the 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.

  • ckn (Optional[Ckn], default: None ) –

    The MAC Security (MACsec) CKN to associate with the 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 (Optional[Cak], default: None ) –

    The MAC Security (MACsec) CAK to associate with the 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.

Raises:

Source code in docs_src/capo_direct_connect/_services/async_direct_connect.py
async def associate_mac_sec_key(
    self,
    connection_id: "capo_direct_connect.types.connection_id.ConnectionId",
    *,
    config_overrides: Optional[AsyncDirectConnectClientConfig] = None,
    secret_arn: Optional["capo_direct_connect.types.secret_arn.SecretARN"] = None,
    ckn: Optional["capo_direct_connect.types.ckn.Ckn"] = None,
    cak: Optional["capo_direct_connect.types.cak.Cak"] = None,
) -> "capo_direct_connect.types.associate_mac_sec_key_response.AssociateMacSecKeyResponse":
    """<p>Associates a MAC Security (MACsec) Connection Key Name (CKN)/ Connectivity Association Key (CAK) pair with a Direct Connect connection.</p> <p>You must supply either the <code>secretARN,</code> or the CKN/CAK (<code>ckn</code> and <code>cak</code>) pair in the request.</p> <p>For information about MAC Security (MACsec) key considerations, see <a href="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 </a> in the <i>Direct Connect User Guide</i>.</p>

    Args:
        connection_id: <p>The ID of the dedicated connection (dxcon-xxxx), interconnect (dxcon-xxxx), or LAG (dxlag-xxxx).</p> <p>You can use <a>DescribeConnections</a>, <a>DescribeInterconnects</a>, or <a>DescribeLags</a> to retrieve connection ID.</p>
        secret_arn: <p>The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the connection.</p> <p>You can use <a>DescribeConnections</a> or <a>DescribeLags</a> to retrieve the MAC Security (MACsec) secret key.</p> <p>If you use this request parameter, you do not use the <code>ckn</code> and <code>cak</code> request parameters.</p>
        ckn: <p>The MAC Security (MACsec) CKN to associate with the connection.</p> <p>You can create the CKN/CAK pair using an industry standard tool.</p> <p> The valid values are 64 hexadecimal characters (0-9, A-E).</p> <p>If you use this request parameter, you must use the <code>cak</code> request parameter and not use the <code>secretARN</code> request parameter.</p>
        cak: <p>The MAC Security (MACsec) CAK to associate with the connection.</p> <p>You can create the CKN/CAK pair using an industry standard tool.</p> <p> The valid values are 64 hexadecimal characters (0-9, A-E).</p> <p>If you use this request parameter, you must use the <code>ckn</code> request parameter and not use the <code>secretARN</code> request parameter.</p>

    Raises:
        capo_direct_connect.errors.direct_connect_client_exception.DirectConnectClientException: <p>One or more parameters are not valid.</p>
        capo_direct_connect.errors.direct_connect_server_exception.DirectConnectServerException: <p>A server-side error occurred.</p>
        capo_direct_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_direct_connect.types.associate_mac_sec_key_request.AssociateMacSecKeyRequest]",
    ) -> AsyncOperationResponse[
        "capo_direct_connect.types.associate_mac_sec_key_response.AssociateMacSecKeyResponse"
    ]:
        import capo_direct_connect._operations.overture_service.associate_mac_sec_key

        (
            output,
            http_response,
        ) = await capo_direct_connect._operations.overture_service.associate_mac_sec_key.async_associate_mac_sec_key(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateMacSecKey")
    )
    input_: capo_direct_connect.types.associate_mac_sec_key_request.AssociateMacSecKeyRequest = {
        "connection_id": connection_id
    }
    if secret_arn is not None:
        input_["secret_arn"] = secret_arn
    if ckn is not None:
        input_["ckn"] = ckn
    if cak is not None:
        input_["cak"] = cak

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output