createMicrovmShellAuthToken method

Future<CreateMicrovmShellAuthTokenResponse> createMicrovmShellAuthToken({
  1. required int expirationInMinutes,
  2. required String microvmIdentifier,
})

Creates a shell authentication token for interactive shell access to a running MicroVM. The MicroVM must have been run with the SHELL_INGRESS network connector attached.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter expirationInMinutes : The duration in minutes before the shell authentication token expires.

Parameter microvmIdentifier : The ID of the MicroVM to create a shell authentication token for.

Implementation

Future<CreateMicrovmShellAuthTokenResponse> createMicrovmShellAuthToken({
  required int expirationInMinutes,
  required String microvmIdentifier,
}) async {
  _s.validateNumRange(
    'expirationInMinutes',
    expirationInMinutes,
    1,
    1152921504606846976,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'expirationInMinutes': expirationInMinutes,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2025-09-09/microvms/${Uri.encodeComponent(microvmIdentifier)}/shell-auth-token',
    exceptionFnMap: _exceptionFns,
  );
  return CreateMicrovmShellAuthTokenResponse.fromJson(response);
}