createDeviceDefinition method
Creates a device definition. You may provide the initial version of the device definition now or use ''CreateDeviceDefinitionVersion'' at a later time.
May throw BadRequestException.
Parameter amznClientToken
:
A client token used to correlate requests and responses.
Parameter initialVersion
:
Information about the initial version of the device definition.
Parameter name
:
The name of the device definition.
Parameter tags
:
Tag(s) to add to the new resource.
Implementation
Future<CreateDeviceDefinitionResponse> createDeviceDefinition({
String? amznClientToken,
DeviceDefinitionVersion? initialVersion,
String? name,
Map<String, String>? tags,
}) async {
final headers = <String, String>{
if (amznClientToken != null)
'X-Amzn-Client-Token': amznClientToken.toString(),
};
final $payload = <String, dynamic>{
if (initialVersion != null) 'InitialVersion': initialVersion,
if (name != null) 'Name': name,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/greengrass/definition/devices',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateDeviceDefinitionResponse.fromJson(response);
}