# Google Cloud Device Streaming V1 Client - Class DirectAccessServiceClient (0.2.4)

0.2.4 (latest) 0.2.3 0.1.1 Reference documentation and code samples for the Google Cloud Device Streaming V1 Client class DirectAccessServiceClient.

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>

This class provides the ability to make remote calls to the backing service through method
calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To
assist with these names, this class includes a format method for each type of
name, and additionally a parseName method to extract the individual identifiers
contained within formatted names that are returned by the API.

## Namespace

Google \\ Cloud \\ DeviceStreaming \\ V1 \\ Client

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array|https://docs.cloud.google.com/php/docs/reference/gax/latest/Options.ClientOptions.html` Optional. Options for configuring the service API wrapper. |
| `↳ apiEndpoint` | `string` The address of the API remote host. May optionally include the port, formatted as " |
| `↳ credentials` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html|https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html` This option should only be used with a pre-constructed [Google\\Auth\\FetchAuthTokenInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html) or [Google\\ApiCore\\CredentialsWrapper](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html) object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. **Important** : If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly `use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\DeviceStreaming\V1\DirectAccessServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new DirectAccessServiceClient(['credentials' => $creds]);` <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ credentialsConfig` | `array` Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see [Google\\ApiCore\\CredentialsWrapper::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html#_Google_ApiCore_CredentialsWrapper__build__) . |
| `↳ disableRetries` | `bool` Determines whether or not retries defined by the client configuration should be disabled. Defaults to `false`. |
| `↳ clientConfig` | `string|array` Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
| `↳ transport` | `string|https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html` The transport used for executing network requests. May be either the string `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. *Advanced usage* : Additionally, it is possible to pass in an already instantiated [Google\\ApiCore\\Transport\\TransportInterface](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html) object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored. |
| `↳ transportConfig` | `array` Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = \[ 'grpc' =\> \[...\], 'rest' =\> \[...\], \]; See the [Google\\ApiCore\\Transport\\GrpcTransport::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.GrpcTransport.html#_Google_ApiCore_Transport_GrpcTransport__build__) and [Google\\ApiCore\\Transport\\RestTransport::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.RestTransport.html#_Google_ApiCore_Transport_RestTransport__build__) methods for the supported options. |
| `↳ clientCertSource` | `callable` A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
| `↳ logger` | `false|Psr\Log\LoggerInterface` A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
| `↳ universeDomain` | `string` The service domain for the client. Defaults to 'googleapis.com'. |

### adbConnect

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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callOptions` | `array` Optional. |
| `↳ timeoutMillis` | `int` Timeout to use for this call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/BidiStream.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\BidiStream;
    use Google\Cloud\DeviceStreaming\V1\AdbMessage;
    use Google\Cloud\DeviceStreaming\V1\Client\DirectAccessServiceClient;
    use Google\Cloud\DeviceStreaming\V1\DeviceMessage;

    /**
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function adb_connect_sample(): void
    {
        // Create a client.
        $directAccessServiceClient = new DirectAccessServiceClient();

        // Prepare the request message.
        $request = new AdbMessage();

        // Call the API and handle any network failures.
        try {
            /** @var BidiStream $stream */
            $stream = $directAccessServiceClient->adbConnect();
            $stream->writeAll([$request,]);

            /** @var DeviceMessage $element */
            foreach ($stream->closeWriteAndReadAll() as $element) {
                printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

### 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.

The async variant is
[DirectAccessServiceClient::cancelDeviceSessionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.Client.DirectAccessServiceClient#_Google_Cloud_DeviceStreaming_V1_Client_DirectAccessServiceClient__cancelDeviceSessionAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.CancelDeviceSessionRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\DeviceStreaming\V1\CancelDeviceSessionRequest;
    use Google\Cloud\DeviceStreaming\V1\Client\DirectAccessServiceClient;

    /**
     * @param string $formattedName Name of the DeviceSession, e.g.
     *                              "projects/{project_id}/deviceSessions/{session_id}"
     *                              Please see {@see DirectAccessServiceClient::deviceSessionName()} for help formatting this field.
     */
    function cancel_device_session_sample(string $formattedName): void
    {
        // Create a client.
        $directAccessServiceClient = new DirectAccessServiceClient();

        // Prepare the request message.
        $request = (new CancelDeviceSessionRequest())
            ->setName($formattedName);

        // Call the API and handle any network failures.
        try {
            $directAccessServiceClient->cancelDeviceSession($request);
            printf('Call completed successfully.' . PHP_EOL);
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedName = DirectAccessServiceClient::deviceSessionName('[PROJECT]', '[DEVICE_SESSION]');

        cancel_device_session_sample($formattedName);
    }

### createDeviceSession

Creates a DeviceSession.

The async variant is
[DirectAccessServiceClient::createDeviceSessionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.Client.DirectAccessServiceClient#_Google_Cloud_DeviceStreaming_V1_Client_DirectAccessServiceClient__createDeviceSessionAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.CreateDeviceSessionRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.DeviceSession` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\DeviceStreaming\V1\AndroidDevice;
    use Google\Cloud\DeviceStreaming\V1\Client\DirectAccessServiceClient;
    use Google\Cloud\DeviceStreaming\V1\CreateDeviceSessionRequest;
    use Google\Cloud\DeviceStreaming\V1\DeviceSession;

    /**
     * @param string $formattedParent                            The Compute Engine project under which this device will be
     *                                                           allocated. "projects/{project_id}"
     *                                                           Please see {@see DirectAccessServiceClient::projectName()} for help formatting this field.
     * @param string $deviceSessionAndroidDeviceAndroidModelId   The id of the Android device to be used.
     *                                                           Use the TestEnvironmentDiscoveryService to get supported options.
     * @param string $deviceSessionAndroidDeviceAndroidVersionId The id of the Android OS version to be used.
     *                                                           Use the TestEnvironmentDiscoveryService to get supported options.
     */
    function create_device_session_sample(
        string $formattedParent,
        string $deviceSessionAndroidDeviceAndroidModelId,
        string $deviceSessionAndroidDeviceAndroidVersionId
    ): void {
        // Create a client.
        $directAccessServiceClient = new DirectAccessServiceClient();

        // Prepare the request message.
        $deviceSessionAndroidDevice = (new AndroidDevice())
            ->setAndroidModelId($deviceSessionAndroidDeviceAndroidModelId)
            ->setAndroidVersionId($deviceSessionAndroidDeviceAndroidVersionId);
        $deviceSession = (new DeviceSession())
            ->setAndroidDevice($deviceSessionAndroidDevice);
        $request = (new CreateDeviceSessionRequest())
            ->setParent($formattedParent)
            ->setDeviceSession($deviceSession);

        // Call the API and handle any network failures.
        try {
            /** @var DeviceSession $response */
            $response = $directAccessServiceClient->createDeviceSession($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = DirectAccessServiceClient::projectName('[PROJECT]');
        $deviceSessionAndroidDeviceAndroidModelId = '[ANDROID_MODEL_ID]';
        $deviceSessionAndroidDeviceAndroidVersionId = '[ANDROID_VERSION_ID]';

        create_device_session_sample(
            $formattedParent,
            $deviceSessionAndroidDeviceAndroidModelId,
            $deviceSessionAndroidDeviceAndroidVersionId
        );
    }

### getDeviceSession

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

The async variant is [DirectAccessServiceClient::getDeviceSessionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.Client.DirectAccessServiceClient#_Google_Cloud_DeviceStreaming_V1_Client_DirectAccessServiceClient__getDeviceSessionAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.GetDeviceSessionRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.DeviceSession` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\DeviceStreaming\V1\Client\DirectAccessServiceClient;
    use Google\Cloud\DeviceStreaming\V1\DeviceSession;
    use Google\Cloud\DeviceStreaming\V1\GetDeviceSessionRequest;

    /**
     * @param string $formattedName Name of the DeviceSession, e.g.
     *                              "projects/{project_id}/deviceSessions/{session_id}"
     *                              Please see {@see DirectAccessServiceClient::deviceSessionName()} for help formatting this field.
     */
    function get_device_session_sample(string $formattedName): void
    {
        // Create a client.
        $directAccessServiceClient = new DirectAccessServiceClient();

        // Prepare the request message.
        $request = (new GetDeviceSessionRequest())
            ->setName($formattedName);

        // Call the API and handle any network failures.
        try {
            /** @var DeviceSession $response */
            $response = $directAccessServiceClient->getDeviceSession($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedName = DirectAccessServiceClient::deviceSessionName('[PROJECT]', '[DEVICE_SESSION]');

        get_device_session_sample($formattedName);
    }

### listDeviceSessions

Lists DeviceSessions owned by the project user.

The async variant is [DirectAccessServiceClient::listDeviceSessionsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.Client.DirectAccessServiceClient#_Google_Cloud_DeviceStreaming_V1_Client_DirectAccessServiceClient__listDeviceSessionsAsync__)
.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.ListDeviceSessionsRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\PagedListResponse;
    use Google\Cloud\DeviceStreaming\V1\Client\DirectAccessServiceClient;
    use Google\Cloud\DeviceStreaming\V1\DeviceSession;
    use Google\Cloud\DeviceStreaming\V1\ListDeviceSessionsRequest;

    /**
     * @param string $formattedParent The name of the parent to request, e.g. "projects/{project_id}"
     *                                Please see {@see DirectAccessServiceClient::projectName()} for help formatting this field.
     */
    function list_device_sessions_sample(string $formattedParent): void
    {
        // Create a client.
        $directAccessServiceClient = new DirectAccessServiceClient();

        // Prepare the request message.
        $request = (new ListDeviceSessionsRequest())
            ->setParent($formattedParent);

        // Call the API and handle any network failures.
        try {
            /** @var PagedListResponse $response */
            $response = $directAccessServiceClient->listDeviceSessions($request);

            /** @var DeviceSession $element */
            foreach ($response as $element) {
                printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = DirectAccessServiceClient::projectName('[PROJECT]');

        list_device_sessions_sample($formattedParent);
    }

### updateDeviceSession

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

The async variant is
[DirectAccessServiceClient::updateDeviceSessionAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.Client.DirectAccessServiceClient#_Google_Cloud_DeviceStreaming_V1_Client_DirectAccessServiceClient__updateDeviceSessionAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.UpdateDeviceSessionRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.DeviceSession` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\DeviceStreaming\V1\AndroidDevice;
    use Google\Cloud\DeviceStreaming\V1\Client\DirectAccessServiceClient;
    use Google\Cloud\DeviceStreaming\V1\DeviceSession;
    use Google\Cloud\DeviceStreaming\V1\UpdateDeviceSessionRequest;

    /**
     * @param string $deviceSessionAndroidDeviceAndroidModelId   The id of the Android device to be used.
     *                                                           Use the TestEnvironmentDiscoveryService to get supported options.
     * @param string $deviceSessionAndroidDeviceAndroidVersionId The id of the Android OS version to be used.
     *                                                           Use the TestEnvironmentDiscoveryService to get supported options.
     */
    function update_device_session_sample(
        string $deviceSessionAndroidDeviceAndroidModelId,
        string $deviceSessionAndroidDeviceAndroidVersionId
    ): void {
        // Create a client.
        $directAccessServiceClient = new DirectAccessServiceClient();

        // Prepare the request message.
        $deviceSessionAndroidDevice = (new AndroidDevice())
            ->setAndroidModelId($deviceSessionAndroidDeviceAndroidModelId)
            ->setAndroidVersionId($deviceSessionAndroidDeviceAndroidVersionId);
        $deviceSession = (new DeviceSession())
            ->setAndroidDevice($deviceSessionAndroidDevice);
        $request = (new UpdateDeviceSessionRequest())
            ->setDeviceSession($deviceSession);

        // Call the API and handle any network failures.
        try {
            /** @var DeviceSession $response */
            $response = $directAccessServiceClient->updateDeviceSession($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $deviceSessionAndroidDeviceAndroidModelId = '[ANDROID_MODEL_ID]';
        $deviceSessionAndroidDeviceAndroidVersionId = '[ANDROID_VERSION_ID]';

        update_device_session_sample(
            $deviceSessionAndroidDeviceAndroidModelId,
            $deviceSessionAndroidDeviceAndroidVersionId
        );
    }

### cancelDeviceSessionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.CancelDeviceSessionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<void>` |   |

### createDeviceSessionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.CreateDeviceSessionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.DeviceSession>` |   |

### getDeviceSessionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.GetDeviceSessionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.DeviceSession>` |   |

### listDeviceSessionsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.ListDeviceSessionsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### updateDeviceSessionAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.UpdateDeviceSessionRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-devicestreaming/latest/V1.DeviceSession>` |   |

### static::deviceSessionName

Formats a string containing the fully-qualified path to represent a
device_session resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `deviceSession` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted device_session resource. |

### static::projectName

Formats a string containing the fully-qualified path to represent a project
resource.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted project resource. |

### static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported:
Template: Pattern

- deviceSession: projects/{project}/deviceSessions/{device_session}
- project: projects/{project}

The optional $template argument can be supplied to specify a particular pattern,
and must match one of the templates listed above. If no $template argument is
provided, or if the $template argument does not match one of the templates
listed, then parseName will check each of the supported templates, and return
the first match.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `formattedName` | `string` The formatted name string |
| `template` | `?string` Optional name of template to match |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` | An associative array from name component IDs to component values. |