createNetworkProfile method

Future<CreateNetworkProfileResult> createNetworkProfile({
  1. required String name,
  2. required String projectArn,
  3. String? description,
  4. int? downlinkBandwidthBits,
  5. int? downlinkDelayMs,
  6. int? downlinkJitterMs,
  7. int? downlinkLossPercent,
  8. NetworkProfileType? type,
  9. int? uplinkBandwidthBits,
  10. int? uplinkDelayMs,
  11. int? uplinkJitterMs,
  12. int? uplinkLossPercent,
})

Creates a network profile.

May throw ArgumentException. May throw NotFoundException. May throw LimitExceededException. May throw ServiceAccountException.

Parameter name : The name for the new network profile.

Parameter projectArn : The Amazon Resource Name (ARN) of the project for which you want to create a network profile.

Parameter description : The description of the network profile.

Parameter downlinkBandwidthBits : The data throughput rate in bits per second, as an integer from 0 to 104857600.

Parameter downlinkDelayMs : Delay time for all packets to destination in milliseconds as an integer from 0 to 2000.

Parameter downlinkJitterMs : Time variation in the delay of received packets in milliseconds as an integer from 0 to 2000.

Parameter downlinkLossPercent : Proportion of received packets that fail to arrive from 0 to 100 percent.

Parameter type : The type of network profile to create. Valid values are listed here.

Parameter uplinkBandwidthBits : The data throughput rate in bits per second, as an integer from 0 to 104857600.

Parameter uplinkDelayMs : Delay time for all packets to destination in milliseconds as an integer from 0 to 2000.

Parameter uplinkJitterMs : Time variation in the delay of received packets in milliseconds as an integer from 0 to 2000.

Parameter uplinkLossPercent : Proportion of transmitted packets that fail to arrive from 0 to 100 percent.

Implementation

Future<CreateNetworkProfileResult> createNetworkProfile({
  required String name,
  required String projectArn,
  String? description,
  int? downlinkBandwidthBits,
  int? downlinkDelayMs,
  int? downlinkJitterMs,
  int? downlinkLossPercent,
  NetworkProfileType? type,
  int? uplinkBandwidthBits,
  int? uplinkDelayMs,
  int? uplinkJitterMs,
  int? uplinkLossPercent,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(projectArn, 'projectArn');
  _s.validateStringLength(
    'projectArn',
    projectArn,
    32,
    1011,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    16384,
  );
  _s.validateNumRange(
    'downlinkLossPercent',
    downlinkLossPercent,
    0,
    100,
  );
  _s.validateNumRange(
    'uplinkLossPercent',
    uplinkLossPercent,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.CreateNetworkProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'projectArn': projectArn,
      if (description != null) 'description': description,
      if (downlinkBandwidthBits != null)
        'downlinkBandwidthBits': downlinkBandwidthBits,
      if (downlinkDelayMs != null) 'downlinkDelayMs': downlinkDelayMs,
      if (downlinkJitterMs != null) 'downlinkJitterMs': downlinkJitterMs,
      if (downlinkLossPercent != null)
        'downlinkLossPercent': downlinkLossPercent,
      if (type != null) 'type': type.toValue(),
      if (uplinkBandwidthBits != null)
        'uplinkBandwidthBits': uplinkBandwidthBits,
      if (uplinkDelayMs != null) 'uplinkDelayMs': uplinkDelayMs,
      if (uplinkJitterMs != null) 'uplinkJitterMs': uplinkJitterMs,
      if (uplinkLossPercent != null) 'uplinkLossPercent': uplinkLossPercent,
    },
  );

  return CreateNetworkProfileResult.fromJson(jsonResponse.body);
}