createStreamingURL method

Future<CreateStreamingURLResult> createStreamingURL({
  1. required String fleetName,
  2. required String stackName,
  3. required String userId,
  4. String? applicationId,
  5. String? sessionContext,
  6. int? validity,
})

Creates a temporary URL to start an AppStream 2.0 streaming session for the specified user. A streaming URL enables application streaming to be tested without user setup.

May throw ResourceNotFoundException. May throw ResourceNotAvailableException. May throw OperationNotPermittedException. May throw InvalidParameterCombinationException.

Parameter fleetName : The name of the fleet.

Parameter stackName : The name of the stack.

Parameter userId : The identifier of the user.

Parameter applicationId : The name of the application to launch after the session starts. This is the name that you specified as Name in the Image Assistant.

Parameter sessionContext : The session context. For more information, see Session Context in the Amazon AppStream 2.0 Administration Guide.

Parameter validity : The time that the streaming URL will be valid, in seconds. Specify a value between 1 and 604800 seconds. The default is 60 seconds.

Implementation

Future<CreateStreamingURLResult> createStreamingURL({
  required String fleetName,
  required String stackName,
  required String userId,
  String? applicationId,
  String? sessionContext,
  int? validity,
}) async {
  ArgumentError.checkNotNull(fleetName, 'fleetName');
  _s.validateStringLength(
    'fleetName',
    fleetName,
    1,
    1152921504606846976,
    isRequired: true,
  );
  ArgumentError.checkNotNull(stackName, 'stackName');
  _s.validateStringLength(
    'stackName',
    stackName,
    1,
    1152921504606846976,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userId, 'userId');
  _s.validateStringLength(
    'userId',
    userId,
    2,
    32,
    isRequired: true,
  );
  _s.validateStringLength(
    'applicationId',
    applicationId,
    1,
    1152921504606846976,
  );
  _s.validateStringLength(
    'sessionContext',
    sessionContext,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'PhotonAdminProxyService.CreateStreamingURL'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FleetName': fleetName,
      'StackName': stackName,
      'UserId': userId,
      if (applicationId != null) 'ApplicationId': applicationId,
      if (sessionContext != null) 'SessionContext': sessionContext,
      if (validity != null) 'Validity': validity,
    },
  );

  return CreateStreamingURLResult.fromJson(jsonResponse.body);
}