Skip to main content

device_sessions

Creates, updates, deletes, gets or lists a device_sessions resource.

Overview

Namedevice_sessions
TypeResource
Idgoogle.testing.device_sessions

Fields

NameDatatypeDescription
namestringOptional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
activeStartTimestringOutput only. The timestamp that the session first became ACTIVE.
androidDeviceobjectA single Android device.
createTimestringOutput only. The time that the Session was created.
displayNamestringOutput only. The title of the DeviceSession to be presented in the UI.
expireTimestringOptional. If the device is still in use at this time, any connections will be ended and the SessionState will transition from ACTIVE to FINISHED.
inactivityTimeoutstringOutput only. The interval of time that this device must be interacted with before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
statestringOutput only. Current state of the DeviceSession.
stateHistoriesarrayOutput only. The historical state transitions of the session_state message including the current session state.
ttlstringOptional. The amount of time that a device will be initially allocated for. This can eventually be extended with the UpdateDeviceSession RPC. Default: 15 minutes.

Methods

NameAccessible byRequired ParamsDescription
getSELECTdeviceSessionsId, projectsIdGET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
listSELECTprojectsIdGET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.
createINSERTprojectsIdPOST /v1/projects/{project_id}/deviceSessions
patchUPDATEdeviceSessionsId, projectsIdPATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.
cancelEXECdeviceSessionsId, projectsIdPOST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.

SELECT examples

GET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.

SELECT
name,
activeStartTime,
androidDevice,
createTime,
displayName,
expireTime,
inactivityTimeout,
state,
stateHistories,
ttl
FROM google.testing.device_sessions
WHERE projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new device_sessions resource.

/*+ create */
INSERT INTO google.testing.device_sessions (
projectsId,
name,
ttl,
expireTime,
androidDevice
)
SELECT
'{{ projectsId }}',
'{{ name }}',
'{{ ttl }}',
'{{ expireTime }}',
'{{ androidDevice }}'
;

UPDATE example

Updates a device_sessions resource.

/*+ update */
UPDATE google.testing.device_sessions
SET
name = '{{ name }}',
ttl = '{{ ttl }}',
expireTime = '{{ expireTime }}',
androidDevice = '{{ androidDevice }}'
WHERE
deviceSessionsId = '{{ deviceSessionsId }}'
AND projectsId = '{{ projectsId }}';