Device Streaming V1 API - Class Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client (v0.1.0)

Reference documentation and code samples for the Device Streaming V1 API class Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.

REST client for the DirectAccessService service.

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

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the DirectAccessService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all DirectAccessService clients
::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#cancel_device_session

def cancel_device_session(request, options = nil) -> ::Google::Protobuf::Empty
def cancel_device_session(name: nil) -> ::Google::Protobuf::Empty

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.

Overloads
def cancel_device_session(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to cancel_device_session via a request object, either of type CancelDeviceSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DeviceStreaming::V1::CancelDeviceSessionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def cancel_device_session(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to cancel_device_session via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/device_streaming/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DeviceStreaming::V1::CancelDeviceSessionRequest.new

# Call the cancel_device_session method.
result = client.cancel_device_session request

# The returned object is of type Google::Protobuf::Empty.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the DirectAccessService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_device_session

def create_device_session(request, options = nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
def create_device_session(parent: nil, device_session: nil, device_session_id: nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession

Creates a DeviceSession.

Overloads
def create_device_session(request, options = nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
Pass arguments to create_device_session via a request object, either of type CreateDeviceSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DeviceStreaming::V1::CreateDeviceSessionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_device_session(parent: nil, device_session: nil, device_session_id: nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
Pass arguments to create_device_session via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"
  • device_session (::Google::Cloud::DeviceStreaming::V1::DeviceSession, ::Hash) — Required. A DeviceSession to create.
  • device_session_id (::String) — 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]-/.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/device_streaming/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DeviceStreaming::V1::CreateDeviceSessionRequest.new

# Call the create_device_session method.
result = client.create_device_session request

# The returned object is of type Google::Cloud::DeviceStreaming::V1::DeviceSession.
p result

#get_device_session

def get_device_session(request, options = nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
def get_device_session(name: nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession

Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.

Overloads
def get_device_session(request, options = nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
Pass arguments to get_device_session via a request object, either of type GetDeviceSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DeviceStreaming::V1::GetDeviceSessionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_device_session(name: nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
Pass arguments to get_device_session via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/device_streaming/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DeviceStreaming::V1::GetDeviceSessionRequest.new

# Call the get_device_session method.
result = client.get_device_session request

# The returned object is of type Google::Cloud::DeviceStreaming::V1::DeviceSession.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new DirectAccessService REST client object.

Yields
  • (config) — Configure the DirectAccessService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_device_sessions

def list_device_sessions(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DeviceStreaming::V1::DeviceSession>
def list_device_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DeviceStreaming::V1::DeviceSession>

Lists DeviceSessions owned by the project user.

Overloads
def list_device_sessions(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DeviceStreaming::V1::DeviceSession>
Pass arguments to list_device_sessions via a request object, either of type ListDeviceSessionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DeviceStreaming::V1::ListDeviceSessionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_device_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DeviceStreaming::V1::DeviceSession>
Pass arguments to list_device_sessions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the parent to request, e.g. "projects/{project_id}"
  • page_size (::Integer) — Optional. The maximum number of DeviceSessions to return.
  • page_token (::String) — Optional. A continuation token for paging.
  • filter (::String) — Optional. If specified, responses will be filtered by the given filter. Allowed fields are: session_state.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/device_streaming/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DeviceStreaming::V1::ListDeviceSessionsRequest.new

# Call the list_device_sessions method.
result = client.list_device_sessions request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::DeviceStreaming::V1::DeviceSession.
  p item
end

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_device_session

def update_device_session(request, options = nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
def update_device_session(device_session: nil, update_mask: nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession

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

Overloads
def update_device_session(request, options = nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
Pass arguments to update_device_session via a request object, either of type UpdateDeviceSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DeviceStreaming::V1::UpdateDeviceSessionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_device_session(device_session: nil, update_mask: nil) -> ::Google::Cloud::DeviceStreaming::V1::DeviceSession
Pass arguments to update_device_session via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/device_streaming/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DeviceStreaming::V1::DirectAccessService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DeviceStreaming::V1::UpdateDeviceSessionRequest.new

# Call the update_device_session method.
result = client.update_device_session request

# The returned object is of type Google::Cloud::DeviceStreaming::V1::DeviceSession.
p result