updateDomain method

Future<UpdateDomainResponse> updateDomain({
  1. required String domainId,
  2. AppNetworkAccessType? appNetworkAccessType,
  3. AppSecurityGroupManagement? appSecurityGroupManagement,
  4. DefaultSpaceSettings? defaultSpaceSettings,
  5. UserSettings? defaultUserSettings,
  6. DomainSettingsForUpdate? domainSettingsForUpdate,
  7. HomeEfsFileSystemCreation? homeEfsFileSystemCreation,
  8. List<String>? subnetIds,
  9. TagPropagation? tagPropagation,
  10. String? vpcId,
})

Updates the default settings for new user profiles in the domain.

May throw ResourceInUse. May throw ResourceLimitExceeded. May throw ResourceNotFound.

Parameter domainId : The ID of the domain to be updated.

Parameter appNetworkAccessType : Specifies the VPC used for non-EFS traffic.

  • PublicInternetOnly - Non-EFS traffic is through a VPC managed by Amazon SageMaker AI, which allows direct internet access.
  • VpcOnly - All Studio traffic is through the specified VPC and subnets.
This configuration can only be modified if there are no apps in the InService, Pending, or Deleting state. The configuration cannot be updated if DomainSettings.RStudioServerProDomainSettings.DomainExecutionRoleArn is already set or DomainSettings.RStudioServerProDomainSettings.DomainExecutionRoleArn is provided as part of the same request.

Parameter appSecurityGroupManagement : The entity that creates and manages the required security groups for inter-app communication in VPCOnly mode. Required when CreateDomain.AppNetworkAccessType is VPCOnly and DomainSettings.RStudioServerProDomainSettings.DomainExecutionRoleArn is provided. If setting up the domain for use with RStudio, this value must be set to Service.

Parameter defaultSpaceSettings : The default settings for shared spaces that users create in the domain.

Parameter defaultUserSettings : A collection of settings.

Parameter domainSettingsForUpdate : A collection of DomainSettings configuration values to update.

Parameter homeEfsFileSystemCreation : Indicates whether to create a home EFS file system for the domain. You can change from Disabled to Enabled to provision EFS on demand, but you cannot change from Enabled to Disabled.

Parameter subnetIds : The VPC subnets that Studio uses for communication.

If removing subnets, ensure there are no apps in the InService, Pending, or Deleting state.

Parameter tagPropagation : Indicates whether custom tag propagation is supported for the domain. Defaults to DISABLED.

Parameter vpcId : The identifier for the VPC used by the domain for network communication. Use this field only when adding VPC configuration to a SageMaker AI domain used in Amazon SageMaker Unified Studio that was created without VPC settings. SageMaker AI doesn't automatically apply VPC updates to existing applications. Stop and restart your applications to apply the changes.

Implementation

Future<UpdateDomainResponse> updateDomain({
  required String domainId,
  AppNetworkAccessType? appNetworkAccessType,
  AppSecurityGroupManagement? appSecurityGroupManagement,
  DefaultSpaceSettings? defaultSpaceSettings,
  UserSettings? defaultUserSettings,
  DomainSettingsForUpdate? domainSettingsForUpdate,
  HomeEfsFileSystemCreation? homeEfsFileSystemCreation,
  List<String>? subnetIds,
  TagPropagation? tagPropagation,
  String? vpcId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.UpdateDomain'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainId': domainId,
      if (appNetworkAccessType != null)
        'AppNetworkAccessType': appNetworkAccessType.value,
      if (appSecurityGroupManagement != null)
        'AppSecurityGroupManagement': appSecurityGroupManagement.value,
      if (defaultSpaceSettings != null)
        'DefaultSpaceSettings': defaultSpaceSettings,
      if (defaultUserSettings != null)
        'DefaultUserSettings': defaultUserSettings,
      if (domainSettingsForUpdate != null)
        'DomainSettingsForUpdate': domainSettingsForUpdate,
      if (homeEfsFileSystemCreation != null)
        'HomeEfsFileSystemCreation': homeEfsFileSystemCreation.value,
      if (subnetIds != null) 'SubnetIds': subnetIds,
      if (tagPropagation != null) 'TagPropagation': tagPropagation.value,
      if (vpcId != null) 'VpcId': vpcId,
    },
  );

  return UpdateDomainResponse.fromJson(jsonResponse.body);
}