google-cloud-devicestreaming 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/cloud/devicestreaming/__init__.py +69 -0
- google/cloud/devicestreaming/gapic_version.py +16 -0
- google/cloud/devicestreaming/py.typed +2 -0
- google/cloud/devicestreaming_v1/__init__.py +67 -0
- google/cloud/devicestreaming_v1/gapic_metadata.json +118 -0
- google/cloud/devicestreaming_v1/gapic_version.py +16 -0
- google/cloud/devicestreaming_v1/py.typed +2 -0
- google/cloud/devicestreaming_v1/services/__init__.py +15 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/__init__.py +22 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/async_client.py +1001 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/client.py +1410 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/pagers.py +197 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/transports/__init__.py +38 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/transports/base.py +262 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/transports/grpc.py +512 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/transports/grpc_asyncio.py +592 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/transports/rest.py +1234 -0
- google/cloud/devicestreaming_v1/services/direct_access_service/transports/rest_base.py +361 -0
- google/cloud/devicestreaming_v1/types/__init__.py +56 -0
- google/cloud/devicestreaming_v1/types/adb_service.py +317 -0
- google/cloud/devicestreaming_v1/types/service.py +410 -0
- google_cloud_devicestreaming-0.1.0.dist-info/LICENSE +202 -0
- google_cloud_devicestreaming-0.1.0.dist-info/METADATA +228 -0
- google_cloud_devicestreaming-0.1.0.dist-info/RECORD +26 -0
- google_cloud_devicestreaming-0.1.0.dist-info/WHEEL +5 -0
- google_cloud_devicestreaming-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
import json
|
|
17
|
+
import logging as std_logging
|
|
18
|
+
import pickle
|
|
19
|
+
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
|
|
20
|
+
import warnings
|
|
21
|
+
|
|
22
|
+
from google.api_core import gapic_v1, grpc_helpers
|
|
23
|
+
import google.auth # type: ignore
|
|
24
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
25
|
+
from google.auth.transport.grpc import SslCredentials # type: ignore
|
|
26
|
+
from google.protobuf import empty_pb2 # type: ignore
|
|
27
|
+
from google.protobuf.json_format import MessageToJson
|
|
28
|
+
import google.protobuf.message
|
|
29
|
+
import grpc # type: ignore
|
|
30
|
+
import proto # type: ignore
|
|
31
|
+
|
|
32
|
+
from google.cloud.devicestreaming_v1.types import adb_service, service
|
|
33
|
+
|
|
34
|
+
from .base import DEFAULT_CLIENT_INFO, DirectAccessServiceTransport
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
from google.api_core import client_logging # type: ignore
|
|
38
|
+
|
|
39
|
+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
|
|
40
|
+
except ImportError: # pragma: NO COVER
|
|
41
|
+
CLIENT_LOGGING_SUPPORTED = False
|
|
42
|
+
|
|
43
|
+
_LOGGER = std_logging.getLogger(__name__)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
|
|
47
|
+
def intercept_unary_unary(self, continuation, client_call_details, request):
|
|
48
|
+
logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
49
|
+
std_logging.DEBUG
|
|
50
|
+
)
|
|
51
|
+
if logging_enabled: # pragma: NO COVER
|
|
52
|
+
request_metadata = client_call_details.metadata
|
|
53
|
+
if isinstance(request, proto.Message):
|
|
54
|
+
request_payload = type(request).to_json(request)
|
|
55
|
+
elif isinstance(request, google.protobuf.message.Message):
|
|
56
|
+
request_payload = MessageToJson(request)
|
|
57
|
+
else:
|
|
58
|
+
request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
|
|
59
|
+
|
|
60
|
+
request_metadata = {
|
|
61
|
+
key: value.decode("utf-8") if isinstance(value, bytes) else value
|
|
62
|
+
for key, value in request_metadata
|
|
63
|
+
}
|
|
64
|
+
grpc_request = {
|
|
65
|
+
"payload": request_payload,
|
|
66
|
+
"requestMethod": "grpc",
|
|
67
|
+
"metadata": dict(request_metadata),
|
|
68
|
+
}
|
|
69
|
+
_LOGGER.debug(
|
|
70
|
+
f"Sending request for {client_call_details.method}",
|
|
71
|
+
extra={
|
|
72
|
+
"serviceName": "google.cloud.devicestreaming.v1.DirectAccessService",
|
|
73
|
+
"rpcName": str(client_call_details.method),
|
|
74
|
+
"request": grpc_request,
|
|
75
|
+
"metadata": grpc_request["metadata"],
|
|
76
|
+
},
|
|
77
|
+
)
|
|
78
|
+
response = continuation(client_call_details, request)
|
|
79
|
+
if logging_enabled: # pragma: NO COVER
|
|
80
|
+
response_metadata = response.trailing_metadata()
|
|
81
|
+
# Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
|
|
82
|
+
metadata = (
|
|
83
|
+
dict([(k, str(v)) for k, v in response_metadata])
|
|
84
|
+
if response_metadata
|
|
85
|
+
else None
|
|
86
|
+
)
|
|
87
|
+
result = response.result()
|
|
88
|
+
if isinstance(result, proto.Message):
|
|
89
|
+
response_payload = type(result).to_json(result)
|
|
90
|
+
elif isinstance(result, google.protobuf.message.Message):
|
|
91
|
+
response_payload = MessageToJson(result)
|
|
92
|
+
else:
|
|
93
|
+
response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
|
|
94
|
+
grpc_response = {
|
|
95
|
+
"payload": response_payload,
|
|
96
|
+
"metadata": metadata,
|
|
97
|
+
"status": "OK",
|
|
98
|
+
}
|
|
99
|
+
_LOGGER.debug(
|
|
100
|
+
f"Received response for {client_call_details.method}.",
|
|
101
|
+
extra={
|
|
102
|
+
"serviceName": "google.cloud.devicestreaming.v1.DirectAccessService",
|
|
103
|
+
"rpcName": client_call_details.method,
|
|
104
|
+
"response": grpc_response,
|
|
105
|
+
"metadata": grpc_response["metadata"],
|
|
106
|
+
},
|
|
107
|
+
)
|
|
108
|
+
return response
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class DirectAccessServiceGrpcTransport(DirectAccessServiceTransport):
|
|
112
|
+
"""gRPC backend transport for DirectAccessService.
|
|
113
|
+
|
|
114
|
+
A service for allocating Android devices and interacting with
|
|
115
|
+
the live-allocated devices.
|
|
116
|
+
|
|
117
|
+
Each Session will wait for available capacity, at a higher
|
|
118
|
+
priority over Test Execution. When allocated, the session will
|
|
119
|
+
be exposed through a stream for integration.
|
|
120
|
+
|
|
121
|
+
DirectAccessService is currently available as a preview to
|
|
122
|
+
select developers. You can register today on behalf of you and
|
|
123
|
+
your team at
|
|
124
|
+
https://developer.android.com/studio/preview/android-device-streaming
|
|
125
|
+
|
|
126
|
+
This class defines the same methods as the primary client, so the
|
|
127
|
+
primary client can load the underlying transport implementation
|
|
128
|
+
and call it.
|
|
129
|
+
|
|
130
|
+
It sends protocol buffers over the wire using gRPC (which is built on
|
|
131
|
+
top of HTTP/2); the ``grpcio`` package must be installed.
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
_stubs: Dict[str, Callable]
|
|
135
|
+
|
|
136
|
+
def __init__(
|
|
137
|
+
self,
|
|
138
|
+
*,
|
|
139
|
+
host: str = "devicestreaming.googleapis.com",
|
|
140
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
141
|
+
credentials_file: Optional[str] = None,
|
|
142
|
+
scopes: Optional[Sequence[str]] = None,
|
|
143
|
+
channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
|
|
144
|
+
api_mtls_endpoint: Optional[str] = None,
|
|
145
|
+
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
146
|
+
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
|
|
147
|
+
client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
148
|
+
quota_project_id: Optional[str] = None,
|
|
149
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
150
|
+
always_use_jwt_access: Optional[bool] = False,
|
|
151
|
+
api_audience: Optional[str] = None,
|
|
152
|
+
) -> None:
|
|
153
|
+
"""Instantiate the transport.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
host (Optional[str]):
|
|
157
|
+
The hostname to connect to (default: 'devicestreaming.googleapis.com').
|
|
158
|
+
credentials (Optional[google.auth.credentials.Credentials]): The
|
|
159
|
+
authorization credentials to attach to requests. These
|
|
160
|
+
credentials identify the application to the service; if none
|
|
161
|
+
are specified, the client will attempt to ascertain the
|
|
162
|
+
credentials from the environment.
|
|
163
|
+
This argument is ignored if a ``channel`` instance is provided.
|
|
164
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
165
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
166
|
+
This argument is ignored if a ``channel`` instance is provided.
|
|
167
|
+
scopes (Optional(Sequence[str])): A list of scopes. This argument is
|
|
168
|
+
ignored if a ``channel`` instance is provided.
|
|
169
|
+
channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
|
|
170
|
+
A ``Channel`` instance through which to make calls, or a Callable
|
|
171
|
+
that constructs and returns one. If set to None, ``self.create_channel``
|
|
172
|
+
is used to create the channel. If a Callable is given, it will be called
|
|
173
|
+
with the same arguments as used in ``self.create_channel``.
|
|
174
|
+
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
|
|
175
|
+
If provided, it overrides the ``host`` argument and tries to create
|
|
176
|
+
a mutual TLS channel with client SSL credentials from
|
|
177
|
+
``client_cert_source`` or application default SSL credentials.
|
|
178
|
+
client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
|
|
179
|
+
Deprecated. A callback to provide client SSL certificate bytes and
|
|
180
|
+
private key bytes, both in PEM format. It is ignored if
|
|
181
|
+
``api_mtls_endpoint`` is None.
|
|
182
|
+
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
|
|
183
|
+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
|
|
184
|
+
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
|
|
185
|
+
A callback to provide client certificate bytes and private key bytes,
|
|
186
|
+
both in PEM format. It is used to configure a mutual TLS channel. It is
|
|
187
|
+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
|
|
188
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
189
|
+
and quota.
|
|
190
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
191
|
+
The client info used to send a user-agent string along with
|
|
192
|
+
API requests. If ``None``, then default info will be used.
|
|
193
|
+
Generally, you only need to set this if you're developing
|
|
194
|
+
your own client library.
|
|
195
|
+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
196
|
+
be used for service account credentials.
|
|
197
|
+
|
|
198
|
+
Raises:
|
|
199
|
+
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
|
|
200
|
+
creation failed for any reason.
|
|
201
|
+
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
|
|
202
|
+
and ``credentials_file`` are passed.
|
|
203
|
+
"""
|
|
204
|
+
self._grpc_channel = None
|
|
205
|
+
self._ssl_channel_credentials = ssl_channel_credentials
|
|
206
|
+
self._stubs: Dict[str, Callable] = {}
|
|
207
|
+
|
|
208
|
+
if api_mtls_endpoint:
|
|
209
|
+
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
|
|
210
|
+
if client_cert_source:
|
|
211
|
+
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
|
|
212
|
+
|
|
213
|
+
if isinstance(channel, grpc.Channel):
|
|
214
|
+
# Ignore credentials if a channel was passed.
|
|
215
|
+
credentials = None
|
|
216
|
+
self._ignore_credentials = True
|
|
217
|
+
# If a channel was explicitly provided, set it.
|
|
218
|
+
self._grpc_channel = channel
|
|
219
|
+
self._ssl_channel_credentials = None
|
|
220
|
+
|
|
221
|
+
else:
|
|
222
|
+
if api_mtls_endpoint:
|
|
223
|
+
host = api_mtls_endpoint
|
|
224
|
+
|
|
225
|
+
# Create SSL credentials with client_cert_source or application
|
|
226
|
+
# default SSL credentials.
|
|
227
|
+
if client_cert_source:
|
|
228
|
+
cert, key = client_cert_source()
|
|
229
|
+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
|
|
230
|
+
certificate_chain=cert, private_key=key
|
|
231
|
+
)
|
|
232
|
+
else:
|
|
233
|
+
self._ssl_channel_credentials = SslCredentials().ssl_credentials
|
|
234
|
+
|
|
235
|
+
else:
|
|
236
|
+
if client_cert_source_for_mtls and not ssl_channel_credentials:
|
|
237
|
+
cert, key = client_cert_source_for_mtls()
|
|
238
|
+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
|
|
239
|
+
certificate_chain=cert, private_key=key
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
# The base transport sets the host, credentials and scopes
|
|
243
|
+
super().__init__(
|
|
244
|
+
host=host,
|
|
245
|
+
credentials=credentials,
|
|
246
|
+
credentials_file=credentials_file,
|
|
247
|
+
scopes=scopes,
|
|
248
|
+
quota_project_id=quota_project_id,
|
|
249
|
+
client_info=client_info,
|
|
250
|
+
always_use_jwt_access=always_use_jwt_access,
|
|
251
|
+
api_audience=api_audience,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
if not self._grpc_channel:
|
|
255
|
+
# initialize with the provided callable or the default channel
|
|
256
|
+
channel_init = channel or type(self).create_channel
|
|
257
|
+
self._grpc_channel = channel_init(
|
|
258
|
+
self._host,
|
|
259
|
+
# use the credentials which are saved
|
|
260
|
+
credentials=self._credentials,
|
|
261
|
+
# Set ``credentials_file`` to ``None`` here as
|
|
262
|
+
# the credentials that we saved earlier should be used.
|
|
263
|
+
credentials_file=None,
|
|
264
|
+
scopes=self._scopes,
|
|
265
|
+
ssl_credentials=self._ssl_channel_credentials,
|
|
266
|
+
quota_project_id=quota_project_id,
|
|
267
|
+
options=[
|
|
268
|
+
("grpc.max_send_message_length", -1),
|
|
269
|
+
("grpc.max_receive_message_length", -1),
|
|
270
|
+
],
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
self._interceptor = _LoggingClientInterceptor()
|
|
274
|
+
self._logged_channel = grpc.intercept_channel(
|
|
275
|
+
self._grpc_channel, self._interceptor
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
# Wrap messages. This must be done after self._logged_channel exists
|
|
279
|
+
self._prep_wrapped_messages(client_info)
|
|
280
|
+
|
|
281
|
+
@classmethod
|
|
282
|
+
def create_channel(
|
|
283
|
+
cls,
|
|
284
|
+
host: str = "devicestreaming.googleapis.com",
|
|
285
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
286
|
+
credentials_file: Optional[str] = None,
|
|
287
|
+
scopes: Optional[Sequence[str]] = None,
|
|
288
|
+
quota_project_id: Optional[str] = None,
|
|
289
|
+
**kwargs,
|
|
290
|
+
) -> grpc.Channel:
|
|
291
|
+
"""Create and return a gRPC channel object.
|
|
292
|
+
Args:
|
|
293
|
+
host (Optional[str]): The host for the channel to use.
|
|
294
|
+
credentials (Optional[~.Credentials]): The
|
|
295
|
+
authorization credentials to attach to requests. These
|
|
296
|
+
credentials identify this application to the service. If
|
|
297
|
+
none are specified, the client will attempt to ascertain
|
|
298
|
+
the credentials from the environment.
|
|
299
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
300
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
301
|
+
This argument is mutually exclusive with credentials.
|
|
302
|
+
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
|
|
303
|
+
service. These are only used when credentials are not specified and
|
|
304
|
+
are passed to :func:`google.auth.default`.
|
|
305
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
306
|
+
and quota.
|
|
307
|
+
kwargs (Optional[dict]): Keyword arguments, which are passed to the
|
|
308
|
+
channel creation.
|
|
309
|
+
Returns:
|
|
310
|
+
grpc.Channel: A gRPC channel object.
|
|
311
|
+
|
|
312
|
+
Raises:
|
|
313
|
+
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
|
|
314
|
+
and ``credentials_file`` are passed.
|
|
315
|
+
"""
|
|
316
|
+
|
|
317
|
+
return grpc_helpers.create_channel(
|
|
318
|
+
host,
|
|
319
|
+
credentials=credentials,
|
|
320
|
+
credentials_file=credentials_file,
|
|
321
|
+
quota_project_id=quota_project_id,
|
|
322
|
+
default_scopes=cls.AUTH_SCOPES,
|
|
323
|
+
scopes=scopes,
|
|
324
|
+
default_host=cls.DEFAULT_HOST,
|
|
325
|
+
**kwargs,
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
@property
|
|
329
|
+
def grpc_channel(self) -> grpc.Channel:
|
|
330
|
+
"""Return the channel designed to connect to this service."""
|
|
331
|
+
return self._grpc_channel
|
|
332
|
+
|
|
333
|
+
@property
|
|
334
|
+
def create_device_session(
|
|
335
|
+
self,
|
|
336
|
+
) -> Callable[[service.CreateDeviceSessionRequest], service.DeviceSession]:
|
|
337
|
+
r"""Return a callable for the create device session method over gRPC.
|
|
338
|
+
|
|
339
|
+
Creates a DeviceSession.
|
|
340
|
+
|
|
341
|
+
Returns:
|
|
342
|
+
Callable[[~.CreateDeviceSessionRequest],
|
|
343
|
+
~.DeviceSession]:
|
|
344
|
+
A function that, when called, will call the underlying RPC
|
|
345
|
+
on the server.
|
|
346
|
+
"""
|
|
347
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
348
|
+
# the request.
|
|
349
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
350
|
+
# to pass in the functions for each.
|
|
351
|
+
if "create_device_session" not in self._stubs:
|
|
352
|
+
self._stubs["create_device_session"] = self._logged_channel.unary_unary(
|
|
353
|
+
"/google.cloud.devicestreaming.v1.DirectAccessService/CreateDeviceSession",
|
|
354
|
+
request_serializer=service.CreateDeviceSessionRequest.serialize,
|
|
355
|
+
response_deserializer=service.DeviceSession.deserialize,
|
|
356
|
+
)
|
|
357
|
+
return self._stubs["create_device_session"]
|
|
358
|
+
|
|
359
|
+
@property
|
|
360
|
+
def list_device_sessions(
|
|
361
|
+
self,
|
|
362
|
+
) -> Callable[
|
|
363
|
+
[service.ListDeviceSessionsRequest], service.ListDeviceSessionsResponse
|
|
364
|
+
]:
|
|
365
|
+
r"""Return a callable for the list device sessions method over gRPC.
|
|
366
|
+
|
|
367
|
+
Lists DeviceSessions owned by the project user.
|
|
368
|
+
|
|
369
|
+
Returns:
|
|
370
|
+
Callable[[~.ListDeviceSessionsRequest],
|
|
371
|
+
~.ListDeviceSessionsResponse]:
|
|
372
|
+
A function that, when called, will call the underlying RPC
|
|
373
|
+
on the server.
|
|
374
|
+
"""
|
|
375
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
376
|
+
# the request.
|
|
377
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
378
|
+
# to pass in the functions for each.
|
|
379
|
+
if "list_device_sessions" not in self._stubs:
|
|
380
|
+
self._stubs["list_device_sessions"] = self._logged_channel.unary_unary(
|
|
381
|
+
"/google.cloud.devicestreaming.v1.DirectAccessService/ListDeviceSessions",
|
|
382
|
+
request_serializer=service.ListDeviceSessionsRequest.serialize,
|
|
383
|
+
response_deserializer=service.ListDeviceSessionsResponse.deserialize,
|
|
384
|
+
)
|
|
385
|
+
return self._stubs["list_device_sessions"]
|
|
386
|
+
|
|
387
|
+
@property
|
|
388
|
+
def get_device_session(
|
|
389
|
+
self,
|
|
390
|
+
) -> Callable[[service.GetDeviceSessionRequest], service.DeviceSession]:
|
|
391
|
+
r"""Return a callable for the get device session method over gRPC.
|
|
392
|
+
|
|
393
|
+
Gets a DeviceSession, which documents the allocation
|
|
394
|
+
status and whether the device is allocated. Clients
|
|
395
|
+
making requests from this API must poll
|
|
396
|
+
GetDeviceSession.
|
|
397
|
+
|
|
398
|
+
Returns:
|
|
399
|
+
Callable[[~.GetDeviceSessionRequest],
|
|
400
|
+
~.DeviceSession]:
|
|
401
|
+
A function that, when called, will call the underlying RPC
|
|
402
|
+
on the server.
|
|
403
|
+
"""
|
|
404
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
405
|
+
# the request.
|
|
406
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
407
|
+
# to pass in the functions for each.
|
|
408
|
+
if "get_device_session" not in self._stubs:
|
|
409
|
+
self._stubs["get_device_session"] = self._logged_channel.unary_unary(
|
|
410
|
+
"/google.cloud.devicestreaming.v1.DirectAccessService/GetDeviceSession",
|
|
411
|
+
request_serializer=service.GetDeviceSessionRequest.serialize,
|
|
412
|
+
response_deserializer=service.DeviceSession.deserialize,
|
|
413
|
+
)
|
|
414
|
+
return self._stubs["get_device_session"]
|
|
415
|
+
|
|
416
|
+
@property
|
|
417
|
+
def cancel_device_session(
|
|
418
|
+
self,
|
|
419
|
+
) -> Callable[[service.CancelDeviceSessionRequest], empty_pb2.Empty]:
|
|
420
|
+
r"""Return a callable for the cancel device session method over gRPC.
|
|
421
|
+
|
|
422
|
+
Cancel a DeviceSession.
|
|
423
|
+
This RPC changes the DeviceSession to state FINISHED and
|
|
424
|
+
terminates all connections.
|
|
425
|
+
Canceled sessions are not deleted and can be retrieved
|
|
426
|
+
or listed by the user until they expire based on the 28
|
|
427
|
+
day deletion policy.
|
|
428
|
+
|
|
429
|
+
Returns:
|
|
430
|
+
Callable[[~.CancelDeviceSessionRequest],
|
|
431
|
+
~.Empty]:
|
|
432
|
+
A function that, when called, will call the underlying RPC
|
|
433
|
+
on the server.
|
|
434
|
+
"""
|
|
435
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
436
|
+
# the request.
|
|
437
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
438
|
+
# to pass in the functions for each.
|
|
439
|
+
if "cancel_device_session" not in self._stubs:
|
|
440
|
+
self._stubs["cancel_device_session"] = self._logged_channel.unary_unary(
|
|
441
|
+
"/google.cloud.devicestreaming.v1.DirectAccessService/CancelDeviceSession",
|
|
442
|
+
request_serializer=service.CancelDeviceSessionRequest.serialize,
|
|
443
|
+
response_deserializer=empty_pb2.Empty.FromString,
|
|
444
|
+
)
|
|
445
|
+
return self._stubs["cancel_device_session"]
|
|
446
|
+
|
|
447
|
+
@property
|
|
448
|
+
def update_device_session(
|
|
449
|
+
self,
|
|
450
|
+
) -> Callable[[service.UpdateDeviceSessionRequest], service.DeviceSession]:
|
|
451
|
+
r"""Return a callable for the update device session method over gRPC.
|
|
452
|
+
|
|
453
|
+
Updates the current DeviceSession to the fields described by the
|
|
454
|
+
update_mask.
|
|
455
|
+
|
|
456
|
+
Returns:
|
|
457
|
+
Callable[[~.UpdateDeviceSessionRequest],
|
|
458
|
+
~.DeviceSession]:
|
|
459
|
+
A function that, when called, will call the underlying RPC
|
|
460
|
+
on the server.
|
|
461
|
+
"""
|
|
462
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
463
|
+
# the request.
|
|
464
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
465
|
+
# to pass in the functions for each.
|
|
466
|
+
if "update_device_session" not in self._stubs:
|
|
467
|
+
self._stubs["update_device_session"] = self._logged_channel.unary_unary(
|
|
468
|
+
"/google.cloud.devicestreaming.v1.DirectAccessService/UpdateDeviceSession",
|
|
469
|
+
request_serializer=service.UpdateDeviceSessionRequest.serialize,
|
|
470
|
+
response_deserializer=service.DeviceSession.deserialize,
|
|
471
|
+
)
|
|
472
|
+
return self._stubs["update_device_session"]
|
|
473
|
+
|
|
474
|
+
@property
|
|
475
|
+
def adb_connect(
|
|
476
|
+
self,
|
|
477
|
+
) -> Callable[[adb_service.AdbMessage], adb_service.DeviceMessage]:
|
|
478
|
+
r"""Return a callable for the adb connect method over gRPC.
|
|
479
|
+
|
|
480
|
+
Exposes an ADB connection if the device supports ADB.
|
|
481
|
+
gRPC headers are used to authenticate the Connect RPC,
|
|
482
|
+
as well as associate to a particular DeviceSession.
|
|
483
|
+
In particular, the user must specify the
|
|
484
|
+
"X-Omnilab-Session-Name" header.
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
Callable[[~.AdbMessage],
|
|
488
|
+
~.DeviceMessage]:
|
|
489
|
+
A function that, when called, will call the underlying RPC
|
|
490
|
+
on the server.
|
|
491
|
+
"""
|
|
492
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
493
|
+
# the request.
|
|
494
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
495
|
+
# to pass in the functions for each.
|
|
496
|
+
if "adb_connect" not in self._stubs:
|
|
497
|
+
self._stubs["adb_connect"] = self._logged_channel.stream_stream(
|
|
498
|
+
"/google.cloud.devicestreaming.v1.DirectAccessService/AdbConnect",
|
|
499
|
+
request_serializer=adb_service.AdbMessage.serialize,
|
|
500
|
+
response_deserializer=adb_service.DeviceMessage.deserialize,
|
|
501
|
+
)
|
|
502
|
+
return self._stubs["adb_connect"]
|
|
503
|
+
|
|
504
|
+
def close(self):
|
|
505
|
+
self._logged_channel.close()
|
|
506
|
+
|
|
507
|
+
@property
|
|
508
|
+
def kind(self) -> str:
|
|
509
|
+
return "grpc"
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
__all__ = ("DirectAccessServiceGrpcTransport",)
|