createApp method

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

Creates a running App for the specified UserProfile. Supported Apps are JupyterServer and KernelGateway. This operation is automatically invoked by Amazon SageMaker Studio 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 ResourceLimitExceeded. May throw ResourceInUse.

Parameter appName : The name of the app.

Parameter appType : The type of app.

Parameter domainId : The domain ID.

Parameter userProfileName : The user profile name.

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

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

Implementation

Future<CreateAppResponse> createApp({
  required String appName,
  required AppType appType,
  required String domainId,
  required String userProfileName,
  ResourceSpec? resourceSpec,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(appName, 'appName');
  _s.validateStringLength(
    'appName',
    appName,
    0,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(appType, 'appType');
  ArgumentError.checkNotNull(domainId, 'domainId');
  _s.validateStringLength(
    'domainId',
    domainId,
    0,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userProfileName, 'userProfileName');
  _s.validateStringLength(
    'userProfileName',
    userProfileName,
    0,
    63,
    isRequired: true,
  );
  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.toValue(),
      'DomainId': domainId,
      'UserProfileName': userProfileName,
      if (resourceSpec != null) 'ResourceSpec': resourceSpec,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateAppResponse.fromJson(jsonResponse.body);
}