Revokes the current client access token (CAT) and returns new CAT for clients to use when reconnecting to secure tunneling to access the same tunnel.
Requires permission to access the RotateTunnelAccessToken action.
Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel duration is 12 hours and the tunnel has already been open for 4 hours. When you rotate the access tokens, the new tokens that are generated can only be used for the remaining 8 hours.
Parameters:
-
tunnel_id
(TunnelId)
–
The tunnel for which you want to rotate the access tokens.
-
client_mode
(ClientMode)
–
The mode of the client that will use the client token, which can be either the source or destination, or both source and destination.
Raises:
Source code in docs_src/capo_iotsecuretunneling/_services/async_io_t_secure_tunneling.py
| async def rotate_tunnel_access_token(
self,
tunnel_id: "capo_iotsecuretunneling.types.tunnel_id.TunnelId",
client_mode: "capo_iotsecuretunneling.types.client_mode.ClientMode",
*,
config_overrides: Optional[AsyncIoTSecureTunnelingClientConfig] = None,
destination_config: Optional[
"capo_iotsecuretunneling.types.destination_config.DestinationConfig"
] = None,
) -> "capo_iotsecuretunneling.types.rotate_tunnel_access_token_response.RotateTunnelAccessTokenResponse":
"""<p>Revokes the current client access token (CAT) and returns new CAT for clients to use when reconnecting to secure tunneling to access the same tunnel.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">RotateTunnelAccessToken</a> action.</p> <note> <p>Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel duration is 12 hours and the tunnel has already been open for 4 hours. When you rotate the access tokens, the new tokens that are generated can only be used for the remaining 8 hours.</p> </note>
Args:
tunnel_id: <p>The tunnel for which you want to rotate the access tokens.</p>
client_mode: <p>The mode of the client that will use the client token, which can be either the source or destination, or both source and destination.</p>
Raises:
capo_iotsecuretunneling.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when an operation is attempted on a resource that does not exist.</p>
capo_iotsecuretunneling.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_iotsecuretunneling.types.rotate_tunnel_access_token_request.RotateTunnelAccessTokenRequest]",
) -> AsyncOperationResponse[
"capo_iotsecuretunneling.types.rotate_tunnel_access_token_response.RotateTunnelAccessTokenResponse"
]:
import capo_iotsecuretunneling._operations.io_t_secured_tunneling.rotate_tunnel_access_token
(
output,
http_response,
) = await capo_iotsecuretunneling._operations.io_t_secured_tunneling.rotate_tunnel_access_token.async_rotate_tunnel_access_token(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_iotsecuretunneling.types.rotate_tunnel_access_token_response.RotateTunnelAccessTokenResponse",
) -> dict[str, Any]:
import capo_iotsecuretunneling.types.rotate_tunnel_access_token_response
return capo_iotsecuretunneling.types.rotate_tunnel_access_token_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("RotateTunnelAccessToken", redact_output=_redact_output),
)
input_: capo_iotsecuretunneling.types.rotate_tunnel_access_token_request.RotateTunnelAccessTokenRequest = {
"tunnel_id": tunnel_id,
"client_mode": client_mode,
}
if destination_config is not None:
input_["destination_config"] = destination_config
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|