createRemoteAccessSession method

Future<CreateRemoteAccessSessionResult> createRemoteAccessSession({
  1. required String deviceArn,
  2. required String projectArn,
  3. String? clientId,
  4. CreateRemoteAccessSessionConfiguration? configuration,
  5. String? instanceArn,
  6. InteractionMode? interactionMode,
  7. String? name,
  8. bool? remoteDebugEnabled,
  9. String? remoteRecordAppArn,
  10. bool? remoteRecordEnabled,
  11. bool? skipAppResign,
  12. String? sshPublicKey,
})

Specifies and starts a remote access session.

May throw ArgumentException. May throw NotFoundException. May throw LimitExceededException. May throw ServiceAccountException.

Parameter deviceArn : The ARN of the device for which you want to create a remote access session.

Parameter projectArn : The Amazon Resource Name (ARN) of the project for which you want to create a remote access session.

Parameter clientId : Unique identifier for the client. If you want access to multiple devices on the same client, you should pass the same clientId value in each call to CreateRemoteAccessSession. This identifier is required only if remoteDebugEnabled is set to true.

Remote debugging is no longer supported.

Parameter configuration : The configuration information for the remote access session request.

Parameter instanceArn : The Amazon Resource Name (ARN) of the device instance for which you want to create a remote access session.

Parameter interactionMode : The interaction mode of the remote access session. Valid values are:

  • INTERACTIVE: You can interact with the iOS device by viewing, touching, and rotating the screen. You cannot run XCUITest framework-based tests in this mode.
  • NO_VIDEO: You are connected to the device, but cannot interact with it or view the screen. This mode has the fastest test execution speed. You can run XCUITest framework-based tests in this mode.
  • VIDEO_ONLY: You can view the screen, but cannot touch or rotate it. You can run XCUITest framework-based tests and watch the screen in this mode.

Parameter name : The name of the remote access session to create.

Parameter remoteDebugEnabled : Set to true if you want to access devices remotely for debugging in your remote access session.

Remote debugging is no longer supported.

Parameter remoteRecordAppArn : The Amazon Resource Name (ARN) for the app to be recorded in the remote access session.

Parameter remoteRecordEnabled : Set to true to enable remote recording for the remote access session.

Parameter skipAppResign : When set to true, for private devices, Device Farm does not sign your app again. For public devices, Device Farm always signs your apps again.

For more information on how Device Farm modifies your uploads during tests, see Do you modify my app?

Parameter sshPublicKey : Ignored. The public key of the ssh key pair you want to use for connecting to remote devices in your remote debugging session. This key is required only if remoteDebugEnabled is set to true.

Remote debugging is no longer supported.

Implementation

Future<CreateRemoteAccessSessionResult> createRemoteAccessSession({
  required String deviceArn,
  required String projectArn,
  String? clientId,
  CreateRemoteAccessSessionConfiguration? configuration,
  String? instanceArn,
  InteractionMode? interactionMode,
  String? name,
  bool? remoteDebugEnabled,
  String? remoteRecordAppArn,
  bool? remoteRecordEnabled,
  bool? skipAppResign,
  String? sshPublicKey,
}) async {
  ArgumentError.checkNotNull(deviceArn, 'deviceArn');
  _s.validateStringLength(
    'deviceArn',
    deviceArn,
    32,
    1011,
    isRequired: true,
  );
  ArgumentError.checkNotNull(projectArn, 'projectArn');
  _s.validateStringLength(
    'projectArn',
    projectArn,
    32,
    1011,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientId',
    clientId,
    0,
    64,
  );
  _s.validateStringLength(
    'instanceArn',
    instanceArn,
    32,
    1011,
  );
  _s.validateStringLength(
    'name',
    name,
    0,
    256,
  );
  _s.validateStringLength(
    'remoteRecordAppArn',
    remoteRecordAppArn,
    32,
    1011,
  );
  _s.validateStringLength(
    'sshPublicKey',
    sshPublicKey,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.CreateRemoteAccessSession'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'deviceArn': deviceArn,
      'projectArn': projectArn,
      if (clientId != null) 'clientId': clientId,
      if (configuration != null) 'configuration': configuration,
      if (instanceArn != null) 'instanceArn': instanceArn,
      if (interactionMode != null)
        'interactionMode': interactionMode.toValue(),
      if (name != null) 'name': name,
      if (remoteDebugEnabled != null)
        'remoteDebugEnabled': remoteDebugEnabled,
      if (remoteRecordAppArn != null)
        'remoteRecordAppArn': remoteRecordAppArn,
      if (remoteRecordEnabled != null)
        'remoteRecordEnabled': remoteRecordEnabled,
      if (skipAppResign != null) 'skipAppResign': skipAppResign,
      if (sshPublicKey != null) 'sshPublicKey': sshPublicKey,
    },
  );

  return CreateRemoteAccessSessionResult.fromJson(jsonResponse.body);
}