createDevice method

Future<CreateDeviceResponse> createDevice({
  1. required String globalNetworkId,
  2. AWSLocation? awsLocation,
  3. String? description,
  4. Location? location,
  5. String? model,
  6. String? serialNumber,
  7. String? siteId,
  8. List<Tag>? tags,
  9. String? type,
  10. String? vendor,
})

Creates a new device in a global network. If you specify both a site ID and a location, the location of the site is used for visualization in the Network Manager console.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter globalNetworkId : The ID of the global network.

Parameter awsLocation : The Amazon Web Services location of the device, if applicable. For an on-premises device, you can omit this parameter.

Parameter description : A description of the device.

Constraints: Maximum length of 256 characters.

Parameter location : The location of the device.

Parameter model : The model of the device.

Constraints: Maximum length of 128 characters.

Parameter serialNumber : The serial number of the device.

Constraints: Maximum length of 128 characters.

Parameter siteId : The ID of the site.

Parameter tags : The tags to apply to the resource during creation.

Parameter type : The type of the device.

Parameter vendor : The vendor of the device.

Constraints: Maximum length of 128 characters.

Implementation

Future<CreateDeviceResponse> createDevice({
  required String globalNetworkId,
  AWSLocation? awsLocation,
  String? description,
  Location? location,
  String? model,
  String? serialNumber,
  String? siteId,
  List<Tag>? tags,
  String? type,
  String? vendor,
}) async {
  final $payload = <String, dynamic>{
    if (awsLocation != null) 'AWSLocation': awsLocation,
    if (description != null) 'Description': description,
    if (location != null) 'Location': location,
    if (model != null) 'Model': model,
    if (serialNumber != null) 'SerialNumber': serialNumber,
    if (siteId != null) 'SiteId': siteId,
    if (tags != null) 'Tags': tags,
    if (type != null) 'Type': type,
    if (vendor != null) 'Vendor': vendor,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/global-networks/${Uri.encodeComponent(globalNetworkId)}/devices',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDeviceResponse.fromJson(response);
}