describeSessions method

Future<DescribeSessionsResult> describeSessions({
  1. required String fleetName,
  2. required String stackName,
  3. AuthenticationType? authenticationType,
  4. int? limit,
  5. String? nextToken,
  6. String? userId,
})

Retrieves a list that describes the streaming sessions for a specified stack and fleet. If a UserId is provided for the stack and fleet, only streaming sessions for that user are described. If an authentication type is not provided, the default is to authenticate users using a streaming URL.

May throw InvalidParameterCombinationException.

Parameter fleetName : The name of the fleet. This value is case-sensitive.

Parameter stackName : The name of the stack. This value is case-sensitive.

Parameter authenticationType : The authentication method. Specify API for a user authenticated using a streaming URL or SAML for a SAML federated user. The default is to authenticate users using a streaming URL.

Parameter limit : The size of each page of results. The default value is 20 and the maximum value is 50.

Parameter nextToken : The pagination token to use to retrieve the next page of results for this operation. If this value is null, it retrieves the first page.

Parameter userId : The user identifier (ID). If you specify a user ID, you must also specify the authentication type.

Implementation

Future<DescribeSessionsResult> describeSessions({
  required String fleetName,
  required String stackName,
  AuthenticationType? authenticationType,
  int? limit,
  String? nextToken,
  String? userId,
}) 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,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1152921504606846976,
  );
  _s.validateStringLength(
    'userId',
    userId,
    2,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'PhotonAdminProxyService.DescribeSessions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FleetName': fleetName,
      'StackName': stackName,
      if (authenticationType != null)
        'AuthenticationType': authenticationType.toValue(),
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
      if (userId != null) 'UserId': userId,
    },
  );

  return DescribeSessionsResult.fromJson(jsonResponse.body);
}