createMachineScope method
Future<MachineScope?>
createMachineScope(
- String machineId, {
- CreateMachineScopeRequest? createMachineScopeRequest,
Create a machine scope
Creates a new machine scope, allowing the specified machine to access another machine. Maximum of 150 scopes per machine.
Parameters:
-
String machineId (required): The ID of the machine that will have access to another machine
-
CreateMachineScopeRequest createMachineScopeRequest:
Implementation
Future<MachineScope?> createMachineScope(
String machineId, {
CreateMachineScopeRequest? createMachineScopeRequest,
}) async {
final response = await createMachineScopeWithHttpInfo(
machineId,
createMachineScopeRequest: createMachineScopeRequest,
);
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),
'MachineScope',
) as MachineScope;
}
return null;
}