associateDeviceWithPlacement method

Future<void> associateDeviceWithPlacement({
  1. required String deviceId,
  2. required String deviceTemplateName,
  3. required String placementName,
  4. required String projectName,
})

Associates a physical device with a placement.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceConflictException. May throw ResourceNotFoundException.

Parameter deviceId : The ID of the physical device to be associated with the given placement in the project. Note that a mandatory 4 character prefix is required for all deviceId values.

Parameter deviceTemplateName : The device template name to associate with the device ID.

Parameter placementName : The name of the placement in which to associate the device.

Parameter projectName : The name of the project containing the placement in which to associate the device.

Implementation

Future<void> associateDeviceWithPlacement({
  required String deviceId,
  required String deviceTemplateName,
  required String placementName,
  required String projectName,
}) async {
  ArgumentError.checkNotNull(deviceId, 'deviceId');
  _s.validateStringLength(
    'deviceId',
    deviceId,
    1,
    32,
    isRequired: true,
  );
  ArgumentError.checkNotNull(deviceTemplateName, 'deviceTemplateName');
  _s.validateStringLength(
    'deviceTemplateName',
    deviceTemplateName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(placementName, 'placementName');
  _s.validateStringLength(
    'placementName',
    placementName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(projectName, 'projectName');
  _s.validateStringLength(
    'projectName',
    projectName,
    1,
    128,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'deviceId': deviceId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/projects/${Uri.encodeComponent(projectName)}/placements/${Uri.encodeComponent(placementName)}/devices/${Uri.encodeComponent(deviceTemplateName)}',
    exceptionFnMap: _exceptionFns,
  );
}