Class DirectAccessServiceClient (2.37.0-rc)

A service for allocating Android devices and interacting with the live-allocated devices.

Each Session will wait for available capacity, at a higher priority over Test Execution. When allocated, the session will be exposed through a stream for integration.

DirectAccessService is currently available as a preview to select developers. You can register today on behalf of you and your team at https://developer.android.com/studio/preview/android-device-streaming

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

DirectAccessServiceClient(DirectAccessServiceClient const &)

Copy and move support

Parameter
Name Description
DirectAccessServiceClient const &

DirectAccessServiceClient(DirectAccessServiceClient &&)

Copy and move support

Parameter
Name Description
DirectAccessServiceClient &&

DirectAccessServiceClient(std::shared_ptr< DirectAccessServiceConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< DirectAccessServiceConnection >
opts Options

Operators

operator=(DirectAccessServiceClient const &)

Copy and move support

Parameter
Name Description
DirectAccessServiceClient const &
Returns
Type Description
DirectAccessServiceClient &

operator=(DirectAccessServiceClient &&)

Copy and move support

Parameter
Name Description
DirectAccessServiceClient &&
Returns
Type Description
DirectAccessServiceClient &

Functions

CreateDeviceSession(std::string const &, google::cloud::devicestreaming::v1::DeviceSession const &, std::string const &, Options)

Creates a DeviceSession.

Parameters
Name Description
parent std::string const &

Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"

device_session google::cloud::devicestreaming::v1::DeviceSession const &

Required. A DeviceSession to create.

device_session_id std::string const &

Optional. The ID to use for the DeviceSession, which will become the final component of the DeviceSession's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::devicestreaming::v1::DeviceSession >

the result of the RPC. The response message type (google.cloud.devicestreaming.v1.DeviceSession) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateDeviceSession(google::cloud::devicestreaming::v1::CreateDeviceSessionRequest const &, Options)

Creates a DeviceSession.

Parameters
Name Description
request google::cloud::devicestreaming::v1::CreateDeviceSessionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.devicestreaming.v1.CreateDeviceSessionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::devicestreaming::v1::DeviceSession >

the result of the RPC. The response message type (google.cloud.devicestreaming.v1.DeviceSession) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListDeviceSessions(std::string const &, Options)

Lists DeviceSessions owned by the project user.

Parameters
Name Description
parent std::string const &

Required. The name of the parent to request, e.g. "projects/{project_id}"

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::devicestreaming::v1::DeviceSession >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.devicestreaming.v1.DeviceSession, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListDeviceSessions(google::cloud::devicestreaming::v1::ListDeviceSessionsRequest, Options)

Lists DeviceSessions owned by the project user.

Parameters
Name Description
request google::cloud::devicestreaming::v1::ListDeviceSessionsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.devicestreaming.v1.ListDeviceSessionsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::devicestreaming::v1::DeviceSession >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.devicestreaming.v1.DeviceSession, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetDeviceSession(std::string const &, Options)

Gets a DeviceSession, which documents the allocation status and whether the device is allocated.

Clients making requests from this API must poll GetDeviceSession.

Parameters
Name Description
name std::string const &

Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::devicestreaming::v1::DeviceSession >

the result of the RPC. The response message type (google.cloud.devicestreaming.v1.DeviceSession) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDeviceSession(google::cloud::devicestreaming::v1::GetDeviceSessionRequest const &, Options)

Gets a DeviceSession, which documents the allocation status and whether the device is allocated.

Clients making requests from this API must poll GetDeviceSession.

Parameters
Name Description
request google::cloud::devicestreaming::v1::GetDeviceSessionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.devicestreaming.v1.GetDeviceSessionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::devicestreaming::v1::DeviceSession >

the result of the RPC. The response message type (google.cloud.devicestreaming.v1.DeviceSession) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CancelDeviceSession(google::cloud::devicestreaming::v1::CancelDeviceSessionRequest const &, Options)

Cancel a DeviceSession.

This RPC 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.

Parameters
Name Description
request google::cloud::devicestreaming::v1::CancelDeviceSessionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.devicestreaming.v1.CancelDeviceSessionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

UpdateDeviceSession(google::cloud::devicestreaming::v1::DeviceSession const &, google::protobuf::FieldMask const &, Options)

Updates the current DeviceSession to the fields described by the update_mask.

Parameters
Name Description
device_session google::cloud::devicestreaming::v1::DeviceSession const &

Required. DeviceSession to update. The DeviceSession's name field is used to identify the session to update "projects/{project_id}/deviceSessions/{session_id}"

update_mask google::protobuf::FieldMask const &

Optional. The list of fields to update.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::devicestreaming::v1::DeviceSession >

the result of the RPC. The response message type (google.cloud.devicestreaming.v1.DeviceSession) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDeviceSession(google::cloud::devicestreaming::v1::UpdateDeviceSessionRequest const &, Options)

Updates the current DeviceSession to the fields described by the update_mask.

Parameters
Name Description
request google::cloud::devicestreaming::v1::UpdateDeviceSessionRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.devicestreaming.v1.UpdateDeviceSessionRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::devicestreaming::v1::DeviceSession >

the result of the RPC. The response message type (google.cloud.devicestreaming.v1.DeviceSession) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

AsyncAdbConnect(Options)

Exposes an ADB connection if the device supports ADB.

gRPC headers are used to authenticate the Connect RPC, as well as associate to a particular DeviceSession. In particular, the user must specify the "X-Omnilab-Session-Name" header.

Parameter
Name Description
opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc< google::cloud::devicestreaming::v1::AdbMessage, google::cloud::devicestreaming::v1::DeviceMessage > >

An object representing the bidirectional streaming RPC. Applications can send multiple request messages and receive multiple response messages through this API. Bidirectional streaming RPCs can impose restrictions on the sequence of request and response messages. Please consult the service documentation for details. The request message type (google.cloud.devicestreaming.v1.AdbMessage) and response messages (google.cloud.devicestreaming.v1.DeviceMessage) are mapped to C++ classes using the Protobuf mapping rules.