createService method

Future<CreateServiceResponse> createService({
  1. required String name,
  2. required PermissionModel permissionModel,
  3. required List<String> regions,
  4. List<AssociatedSystem>? associatedSystems,
  5. String? clientToken,
  6. DependencyDiscoveryInput? dependencyDiscovery,
  7. String? description,
  8. String? kmsKeyId,
  9. String? policyArn,
  10. ServiceReportConfiguration? reportConfiguration,
  11. Map<String, String>? tags,
})

Creates a service.

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

Parameter permissionModel : The permission model for the service.

Parameter regions : The Regions where the service operates.

Parameter associatedSystems : The systems to associate with the service.

Implementation

Future<CreateServiceResponse> createService({
  required String name,
  required PermissionModel permissionModel,
  required List<String> regions,
  List<AssociatedSystem>? associatedSystems,
  String? clientToken,
  DependencyDiscoveryInput? dependencyDiscovery,
  String? description,
  String? kmsKeyId,
  String? policyArn,
  ServiceReportConfiguration? reportConfiguration,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'permissionModel': permissionModel,
    'regions': regions,
    if (associatedSystems != null) 'associatedSystems': associatedSystems,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (dependencyDiscovery != null)
      'dependencyDiscovery': dependencyDiscovery.value,
    if (description != null) 'description': description,
    if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
    if (policyArn != null) 'policyArn': policyArn,
    if (reportConfiguration != null)
      'reportConfiguration': reportConfiguration,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v2/create-service',
    exceptionFnMap: _exceptionFns,
  );
  return CreateServiceResponse.fromJson(response);
}