checkOutMachine method
Check-out machine
Action to check-out a machine. This will generate a snapshot of the machine at time of checkout, encoded into a machine file certificate that can be decoded and used for licensing offline and air-gapped environments. The algorithm will depend on the license policy's scheme
. Machine files can be distributed using email or USB drives to air-gapped devices. For instructions on verifying a machine file, please see machine file verification.
Parameters:
-
String account (required): The identifier (UUID) or slug of your Keygen account.
-
String machine (required): The identifier (UUID) or URL-safe fingerprint of the machine to check-out.
-
int ttl: The time-to-live (TTL) of the checked out machine file, in seconds.
-
List<String> include: Include relationship data in the machine file.
-
bool encrypt: Whether or not to encrypt the machine file.
Implementation
Future<CheckOutMachineResponse?> checkOutMachine(String account, String machine, { int? ttl, List<String>? include, bool? encrypt, }) async {
final response = await checkOutMachineWithHttpInfo(account, machine, ttl: ttl, include: include, encrypt: encrypt, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CheckOutMachineResponse',) as CheckOutMachineResponse;
}
return null;
}