createPresignedDomainUrl method

Future<CreatePresignedDomainUrlResponse> createPresignedDomainUrl({
  1. required String domainId,
  2. required String userProfileName,
  3. int? sessionExpirationDurationInSeconds,
})

Creates a URL for a specified UserProfile in a Domain. When accessed in a web browser, the user will be automatically signed in to Amazon SageMaker Studio, and granted access to all of the Apps and files associated with the Domain's Amazon Elastic File System (EFS) volume. This operation can only be called when the authentication mode equals IAM.

May throw ResourceNotFound.

Parameter domainId : The domain ID.

Parameter userProfileName : The name of the UserProfile to sign-in as.

Parameter sessionExpirationDurationInSeconds : The session expiration duration in seconds.

Implementation

Future<CreatePresignedDomainUrlResponse> createPresignedDomainUrl({
  required String domainId,
  required String userProfileName,
  int? sessionExpirationDurationInSeconds,
}) 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.validateNumRange(
    'sessionExpirationDurationInSeconds',
    sessionExpirationDurationInSeconds,
    1800,
    43200,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreatePresignedDomainUrl'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainId': domainId,
      'UserProfileName': userProfileName,
      if (sessionExpirationDurationInSeconds != null)
        'SessionExpirationDurationInSeconds':
            sessionExpirationDurationInSeconds,
    },
  );

  return CreatePresignedDomainUrlResponse.fromJson(jsonResponse.body);
}