pub struct DirectAccessService { /* private fields */ }Expand description
Implements a client for the Device Streaming API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = DirectAccessService::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_device_sessions()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
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
§Configuration
To configure DirectAccessService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://devicestreaming.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
DirectAccessService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap DirectAccessService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl DirectAccessService
impl DirectAccessService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for DirectAccessService.
let client = DirectAccessService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: DirectAccessService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: DirectAccessService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn create_device_session(&self) -> CreateDeviceSession
pub fn create_device_session(&self) -> CreateDeviceSession
Creates a DeviceSession.
§Example
use google_cloud_devicestreaming_v1::model::DeviceSession;
use google_cloud_devicestreaming_v1::Result;
async fn sample(
client: &DirectAccessService, parent: &str
) -> Result<()> {
let response = client.create_device_session()
.set_parent(parent)
.set_device_session(
DeviceSession::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_device_sessions(&self) -> ListDeviceSessions
pub fn list_device_sessions(&self) -> ListDeviceSessions
Lists DeviceSessions owned by the project user.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_devicestreaming_v1::Result;
async fn sample(
client: &DirectAccessService, parent: &str
) -> Result<()> {
let mut list = client.list_device_sessions()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_device_session(&self) -> GetDeviceSession
pub fn get_device_session(&self) -> GetDeviceSession
Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
§Example
use google_cloud_devicestreaming_v1::Result;
async fn sample(
client: &DirectAccessService, name: &str
) -> Result<()> {
let response = client.get_device_session()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn cancel_device_session(&self) -> CancelDeviceSession
pub fn cancel_device_session(&self) -> CancelDeviceSession
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.
§Example
use google_cloud_devicestreaming_v1::Result;
async fn sample(
client: &DirectAccessService
) -> Result<()> {
client.cancel_device_session()
/* set fields */
.send().await?;
Ok(())
}Sourcepub fn update_device_session(&self) -> UpdateDeviceSession
pub fn update_device_session(&self) -> UpdateDeviceSession
Updates the current DeviceSession to the fields described by the update_mask.
§Example
use google_cloud_wkt::FieldMask;
use google_cloud_devicestreaming_v1::model::DeviceSession;
use google_cloud_devicestreaming_v1::Result;
async fn sample(
client: &DirectAccessService, name: &str
) -> Result<()> {
let response = client.update_device_session()
.set_device_session(
DeviceSession::new().set_name(name)/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.send().await?;
println!("response {:?}", response);
Ok(())
}Trait Implementations§
Source§impl Clone for DirectAccessService
impl Clone for DirectAccessService
Source§fn clone(&self) -> DirectAccessService
fn clone(&self) -> DirectAccessService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more