createUserProfile method

Future<CreateUserProfileResponse> createUserProfile({
  1. required String domainId,
  2. required String userProfileName,
  3. String? singleSignOnUserIdentifier,
  4. String? singleSignOnUserValue,
  5. List<Tag>? tags,
  6. UserSettings? userSettings,
})

Creates a user profile. A user profile represents a single user within a domain, and is the main way to reference a "person" for the purposes of sharing, reporting, and other user-oriented features. This entity is created when a user onboards to Amazon SageMaker Studio. If an administrator invites a person by email or imports them from SSO, a user profile is automatically created. A user profile is the primary holder of settings for an individual user and has a reference to the user's private Amazon Elastic File System (EFS) home directory.

May throw ResourceLimitExceeded. May throw ResourceInUse.

Parameter domainId : The ID of the associated Domain.

Parameter userProfileName : A name for the UserProfile.

Parameter singleSignOnUserIdentifier : A specifier for the type of value specified in SingleSignOnUserValue. Currently, the only supported value is "UserName". If the Domain's AuthMode is SSO, this field is required. If the Domain's AuthMode is not SSO, this field cannot be specified.

Parameter singleSignOnUserValue : The username of the associated AWS Single Sign-On User for this UserProfile. If the Domain's AuthMode is SSO, this field is required, and must match a valid username of a user in your directory. If the Domain's AuthMode is not SSO, this field cannot be specified.

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

Parameter userSettings : A collection of settings.

Implementation

Future<CreateUserProfileResponse> createUserProfile({
  required String domainId,
  required String userProfileName,
  String? singleSignOnUserIdentifier,
  String? singleSignOnUserValue,
  List<Tag>? tags,
  UserSettings? userSettings,
}) async {
  ArgumentError.checkNotNull(domainId, 'domainId');
  _s.validateStringLength(
    'domainId',
    domainId,
    0,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userProfileName, 'userProfileName');
  _s.validateStringLength(
    'userProfileName',
    userProfileName,
    0,
    63,
    isRequired: true,
  );
  _s.validateStringLength(
    'singleSignOnUserValue',
    singleSignOnUserValue,
    0,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateUserProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainId': domainId,
      'UserProfileName': userProfileName,
      if (singleSignOnUserIdentifier != null)
        'SingleSignOnUserIdentifier': singleSignOnUserIdentifier,
      if (singleSignOnUserValue != null)
        'SingleSignOnUserValue': singleSignOnUserValue,
      if (tags != null) 'Tags': tags,
      if (userSettings != null) 'UserSettings': userSettings,
    },
  );

  return CreateUserProfileResponse.fromJson(jsonResponse.body);
}