createDeviceDefinitionVersion method
Creates a version of a device definition that has already been defined.
May throw BadRequestException.
Parameter deviceDefinitionId
:
The ID of the device definition.
Parameter amznClientToken
:
A client token used to correlate requests and responses.
Parameter devices
:
A list of devices in the definition version.
Implementation
Future<CreateDeviceDefinitionVersionResponse> createDeviceDefinitionVersion({
required String deviceDefinitionId,
String? amznClientToken,
List<Device>? devices,
}) async {
ArgumentError.checkNotNull(deviceDefinitionId, 'deviceDefinitionId');
final headers = <String, String>{
if (amznClientToken != null)
'X-Amzn-Client-Token': amznClientToken.toString(),
};
final $payload = <String, dynamic>{
if (devices != null) 'Devices': devices,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/greengrass/definition/devices/${Uri.encodeComponent(deviceDefinitionId)}/versions',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateDeviceDefinitionVersionResponse.fromJson(response);
}