describeWorkspaces method

Future<DescribeWorkspacesResult> describeWorkspaces({
  1. String? bundleId,
  2. String? directoryId,
  3. int? limit,
  4. String? nextToken,
  5. String? userName,
  6. List<String>? workspaceIds,
})

Describes the specified WorkSpaces.

You can filter the results by using the bundle identifier, directory identifier, or owner, but you can specify only one filter at a time.

May throw InvalidParameterValuesException. May throw ResourceUnavailableException.

Parameter bundleId : The identifier of the bundle. All WorkSpaces that are created from this bundle are retrieved. You cannot combine this parameter with any other filter.

Parameter directoryId : The identifier of the directory. In addition, you can optionally specify a specific directory user (see UserName). You cannot combine this parameter with any other filter.

Parameter limit : The maximum number of items to return.

Parameter nextToken : If you received a NextToken from a previous call that was paginated, provide this token to receive the next set of results.

Parameter userName : The name of the directory user. You must specify this parameter with DirectoryId.

Parameter workspaceIds : The identifiers of the WorkSpaces. You cannot combine this parameter with any other filter.

Because the CreateWorkspaces operation is asynchronous, the identifier it returns is not immediately available. If you immediately call DescribeWorkspaces with this identifier, no information is returned.

Implementation

Future<DescribeWorkspacesResult> describeWorkspaces({
  String? bundleId,
  String? directoryId,
  int? limit,
  String? nextToken,
  String? userName,
  List<String>? workspaceIds,
}) async {
  _s.validateStringLength(
    'directoryId',
    directoryId,
    10,
    65,
  );
  _s.validateNumRange(
    'limit',
    limit,
    1,
    25,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    2048,
  );
  _s.validateStringLength(
    'userName',
    userName,
    1,
    63,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.DescribeWorkspaces'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (bundleId != null) 'BundleId': bundleId,
      if (directoryId != null) 'DirectoryId': directoryId,
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
      if (userName != null) 'UserName': userName,
      if (workspaceIds != null) 'WorkspaceIds': workspaceIds,
    },
  );

  return DescribeWorkspacesResult.fromJson(jsonResponse.body);
}