createFleet method

Future<CreateFleetResponse> createFleet({
  1. required String fleetName,
  2. String? displayName,
  3. bool? optimizeForEndUserLocation,
  4. Map<String, String>? tags,
})

Creates a fleet. A fleet consists of resources and the configuration that delivers associated websites to authorized users who download and set up the Amazon WorkLink app.

May throw UnauthorizedException. May throw InternalServerErrorException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ResourceAlreadyExistsException. May throw TooManyRequestsException.

Parameter fleetName : A unique name for the fleet.

Parameter displayName : The fleet name to display.

Parameter optimizeForEndUserLocation : The option to optimize for better performance by routing traffic through the closest AWS Region to users, which may be outside of your home Region.

Parameter tags : The tags to add to the resource. A tag is a key-value pair.

Implementation

Future<CreateFleetResponse> createFleet({
  required String fleetName,
  String? displayName,
  bool? optimizeForEndUserLocation,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(fleetName, 'fleetName');
  _s.validateStringLength(
    'fleetName',
    fleetName,
    1,
    48,
    isRequired: true,
  );
  _s.validateStringLength(
    'displayName',
    displayName,
    0,
    100,
  );
  final $payload = <String, dynamic>{
    'FleetName': fleetName,
    if (displayName != null) 'DisplayName': displayName,
    if (optimizeForEndUserLocation != null)
      'OptimizeForEndUserLocation': optimizeForEndUserLocation,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/createFleet',
    exceptionFnMap: _exceptionFns,
  );
  return CreateFleetResponse.fromJson(response);
}