createApp method

Future<CreateAppResponse> createApp({
  1. required String appName,
  2. required AppType appType,
  3. required String domainId,
  4. bool? recoveryMode,
  5. ResourceSpec? resourceSpec,
  6. String? spaceName,
  7. List<Tag>? tags,
  8. String? userProfileName,
})

Creates a running app for the specified UserProfile. This operation is automatically invoked by Amazon SageMaker AI upon access to the associated Domain, and when new kernel configurations are selected by the user. A user may have multiple Apps active simultaneously.

May throw ResourceInUse. May throw ResourceLimitExceeded.

Parameter appName : The name of the app.

Parameter appType : The type of app.

Parameter domainId : The domain ID.

Parameter recoveryMode : Indicates whether the application is launched in recovery mode.

Parameter resourceSpec : The instance type and the Amazon Resource Name (ARN) of the SageMaker AI image created on the instance.

Parameter spaceName : The name of the space. If this value is not set, then UserProfileName must be set.

Parameter tags : Each tag consists of a key and an optional value. Tag keys must be unique per resource.

Parameter userProfileName : The user profile name. If this value is not set, then SpaceName must be set.

Implementation

Future<CreateAppResponse> createApp({
  required String appName,
  required AppType appType,
  required String domainId,
  bool? recoveryMode,
  ResourceSpec? resourceSpec,
  String? spaceName,
  List<Tag>? tags,
  String? userProfileName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateApp'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AppName': appName,
      'AppType': appType.value,
      'DomainId': domainId,
      if (recoveryMode != null) 'RecoveryMode': recoveryMode,
      if (resourceSpec != null) 'ResourceSpec': resourceSpec,
      if (spaceName != null) 'SpaceName': spaceName,
      if (tags != null) 'Tags': tags,
      if (userProfileName != null) 'UserProfileName': userProfileName,
    },
  );

  return CreateAppResponse.fromJson(jsonResponse.body);
}