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,361 @@
|
|
|
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 # type: ignore
|
|
17
|
+
import re
|
|
18
|
+
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
|
|
19
|
+
|
|
20
|
+
from google.api_core import gapic_v1, path_template
|
|
21
|
+
from google.protobuf import empty_pb2 # type: ignore
|
|
22
|
+
from google.protobuf import json_format
|
|
23
|
+
|
|
24
|
+
from google.cloud.devicestreaming_v1.types import adb_service, service
|
|
25
|
+
|
|
26
|
+
from .base import DEFAULT_CLIENT_INFO, DirectAccessServiceTransport
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class _BaseDirectAccessServiceRestTransport(DirectAccessServiceTransport):
|
|
30
|
+
"""Base REST backend transport for DirectAccessService.
|
|
31
|
+
|
|
32
|
+
Note: This class is not meant to be used directly. Use its sync and
|
|
33
|
+
async sub-classes instead.
|
|
34
|
+
|
|
35
|
+
This class defines the same methods as the primary client, so the
|
|
36
|
+
primary client can load the underlying transport implementation
|
|
37
|
+
and call it.
|
|
38
|
+
|
|
39
|
+
It sends JSON representations of protocol buffers over HTTP/1.1
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
def __init__(
|
|
43
|
+
self,
|
|
44
|
+
*,
|
|
45
|
+
host: str = "devicestreaming.googleapis.com",
|
|
46
|
+
credentials: Optional[Any] = None,
|
|
47
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
48
|
+
always_use_jwt_access: Optional[bool] = False,
|
|
49
|
+
url_scheme: str = "https",
|
|
50
|
+
api_audience: Optional[str] = None,
|
|
51
|
+
) -> None:
|
|
52
|
+
"""Instantiate the transport.
|
|
53
|
+
Args:
|
|
54
|
+
host (Optional[str]):
|
|
55
|
+
The hostname to connect to (default: 'devicestreaming.googleapis.com').
|
|
56
|
+
credentials (Optional[Any]): The
|
|
57
|
+
authorization credentials to attach to requests. These
|
|
58
|
+
credentials identify the application to the service; if none
|
|
59
|
+
are specified, the client will attempt to ascertain the
|
|
60
|
+
credentials from the environment.
|
|
61
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
62
|
+
The client info used to send a user-agent string along with
|
|
63
|
+
API requests. If ``None``, then default info will be used.
|
|
64
|
+
Generally, you only need to set this if you are developing
|
|
65
|
+
your own client library.
|
|
66
|
+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
67
|
+
be used for service account credentials.
|
|
68
|
+
url_scheme: the protocol scheme for the API endpoint. Normally
|
|
69
|
+
"https", but for testing or local servers,
|
|
70
|
+
"http" can be specified.
|
|
71
|
+
"""
|
|
72
|
+
# Run the base constructor
|
|
73
|
+
maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
|
|
74
|
+
if maybe_url_match is None:
|
|
75
|
+
raise ValueError(
|
|
76
|
+
f"Unexpected hostname structure: {host}"
|
|
77
|
+
) # pragma: NO COVER
|
|
78
|
+
|
|
79
|
+
url_match_items = maybe_url_match.groupdict()
|
|
80
|
+
|
|
81
|
+
host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
|
|
82
|
+
|
|
83
|
+
super().__init__(
|
|
84
|
+
host=host,
|
|
85
|
+
credentials=credentials,
|
|
86
|
+
client_info=client_info,
|
|
87
|
+
always_use_jwt_access=always_use_jwt_access,
|
|
88
|
+
api_audience=api_audience,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
class _BaseAdbConnect:
|
|
92
|
+
def __hash__(self): # pragma: NO COVER
|
|
93
|
+
return NotImplementedError("__hash__ must be implemented.")
|
|
94
|
+
|
|
95
|
+
class _BaseCancelDeviceSession:
|
|
96
|
+
def __hash__(self): # pragma: NO COVER
|
|
97
|
+
return NotImplementedError("__hash__ must be implemented.")
|
|
98
|
+
|
|
99
|
+
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def _get_unset_required_fields(cls, message_dict):
|
|
103
|
+
return {
|
|
104
|
+
k: v
|
|
105
|
+
for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
|
|
106
|
+
if k not in message_dict
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@staticmethod
|
|
110
|
+
def _get_http_options():
|
|
111
|
+
http_options: List[Dict[str, str]] = [
|
|
112
|
+
{
|
|
113
|
+
"method": "post",
|
|
114
|
+
"uri": "/v1/{name=projects/*/deviceSessions/*}:cancel",
|
|
115
|
+
"body": "*",
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
return http_options
|
|
119
|
+
|
|
120
|
+
@staticmethod
|
|
121
|
+
def _get_transcoded_request(http_options, request):
|
|
122
|
+
pb_request = service.CancelDeviceSessionRequest.pb(request)
|
|
123
|
+
transcoded_request = path_template.transcode(http_options, pb_request)
|
|
124
|
+
return transcoded_request
|
|
125
|
+
|
|
126
|
+
@staticmethod
|
|
127
|
+
def _get_request_body_json(transcoded_request):
|
|
128
|
+
# Jsonify the request body
|
|
129
|
+
|
|
130
|
+
body = json_format.MessageToJson(
|
|
131
|
+
transcoded_request["body"], use_integers_for_enums=True
|
|
132
|
+
)
|
|
133
|
+
return body
|
|
134
|
+
|
|
135
|
+
@staticmethod
|
|
136
|
+
def _get_query_params_json(transcoded_request):
|
|
137
|
+
query_params = json.loads(
|
|
138
|
+
json_format.MessageToJson(
|
|
139
|
+
transcoded_request["query_params"],
|
|
140
|
+
use_integers_for_enums=True,
|
|
141
|
+
)
|
|
142
|
+
)
|
|
143
|
+
query_params.update(
|
|
144
|
+
_BaseDirectAccessServiceRestTransport._BaseCancelDeviceSession._get_unset_required_fields(
|
|
145
|
+
query_params
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
query_params["$alt"] = "json;enum-encoding=int"
|
|
150
|
+
return query_params
|
|
151
|
+
|
|
152
|
+
class _BaseCreateDeviceSession:
|
|
153
|
+
def __hash__(self): # pragma: NO COVER
|
|
154
|
+
return NotImplementedError("__hash__ must be implemented.")
|
|
155
|
+
|
|
156
|
+
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
|
|
157
|
+
|
|
158
|
+
@classmethod
|
|
159
|
+
def _get_unset_required_fields(cls, message_dict):
|
|
160
|
+
return {
|
|
161
|
+
k: v
|
|
162
|
+
for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
|
|
163
|
+
if k not in message_dict
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@staticmethod
|
|
167
|
+
def _get_http_options():
|
|
168
|
+
http_options: List[Dict[str, str]] = [
|
|
169
|
+
{
|
|
170
|
+
"method": "post",
|
|
171
|
+
"uri": "/v1/{parent=projects/*}/deviceSessions",
|
|
172
|
+
"body": "device_session",
|
|
173
|
+
},
|
|
174
|
+
]
|
|
175
|
+
return http_options
|
|
176
|
+
|
|
177
|
+
@staticmethod
|
|
178
|
+
def _get_transcoded_request(http_options, request):
|
|
179
|
+
pb_request = service.CreateDeviceSessionRequest.pb(request)
|
|
180
|
+
transcoded_request = path_template.transcode(http_options, pb_request)
|
|
181
|
+
return transcoded_request
|
|
182
|
+
|
|
183
|
+
@staticmethod
|
|
184
|
+
def _get_request_body_json(transcoded_request):
|
|
185
|
+
# Jsonify the request body
|
|
186
|
+
|
|
187
|
+
body = json_format.MessageToJson(
|
|
188
|
+
transcoded_request["body"], use_integers_for_enums=True
|
|
189
|
+
)
|
|
190
|
+
return body
|
|
191
|
+
|
|
192
|
+
@staticmethod
|
|
193
|
+
def _get_query_params_json(transcoded_request):
|
|
194
|
+
query_params = json.loads(
|
|
195
|
+
json_format.MessageToJson(
|
|
196
|
+
transcoded_request["query_params"],
|
|
197
|
+
use_integers_for_enums=True,
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
query_params.update(
|
|
201
|
+
_BaseDirectAccessServiceRestTransport._BaseCreateDeviceSession._get_unset_required_fields(
|
|
202
|
+
query_params
|
|
203
|
+
)
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
query_params["$alt"] = "json;enum-encoding=int"
|
|
207
|
+
return query_params
|
|
208
|
+
|
|
209
|
+
class _BaseGetDeviceSession:
|
|
210
|
+
def __hash__(self): # pragma: NO COVER
|
|
211
|
+
return NotImplementedError("__hash__ must be implemented.")
|
|
212
|
+
|
|
213
|
+
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
|
|
214
|
+
|
|
215
|
+
@classmethod
|
|
216
|
+
def _get_unset_required_fields(cls, message_dict):
|
|
217
|
+
return {
|
|
218
|
+
k: v
|
|
219
|
+
for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
|
|
220
|
+
if k not in message_dict
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@staticmethod
|
|
224
|
+
def _get_http_options():
|
|
225
|
+
http_options: List[Dict[str, str]] = [
|
|
226
|
+
{
|
|
227
|
+
"method": "get",
|
|
228
|
+
"uri": "/v1/{name=projects/*/deviceSessions/*}",
|
|
229
|
+
},
|
|
230
|
+
]
|
|
231
|
+
return http_options
|
|
232
|
+
|
|
233
|
+
@staticmethod
|
|
234
|
+
def _get_transcoded_request(http_options, request):
|
|
235
|
+
pb_request = service.GetDeviceSessionRequest.pb(request)
|
|
236
|
+
transcoded_request = path_template.transcode(http_options, pb_request)
|
|
237
|
+
return transcoded_request
|
|
238
|
+
|
|
239
|
+
@staticmethod
|
|
240
|
+
def _get_query_params_json(transcoded_request):
|
|
241
|
+
query_params = json.loads(
|
|
242
|
+
json_format.MessageToJson(
|
|
243
|
+
transcoded_request["query_params"],
|
|
244
|
+
use_integers_for_enums=True,
|
|
245
|
+
)
|
|
246
|
+
)
|
|
247
|
+
query_params.update(
|
|
248
|
+
_BaseDirectAccessServiceRestTransport._BaseGetDeviceSession._get_unset_required_fields(
|
|
249
|
+
query_params
|
|
250
|
+
)
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
query_params["$alt"] = "json;enum-encoding=int"
|
|
254
|
+
return query_params
|
|
255
|
+
|
|
256
|
+
class _BaseListDeviceSessions:
|
|
257
|
+
def __hash__(self): # pragma: NO COVER
|
|
258
|
+
return NotImplementedError("__hash__ must be implemented.")
|
|
259
|
+
|
|
260
|
+
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
|
|
261
|
+
|
|
262
|
+
@classmethod
|
|
263
|
+
def _get_unset_required_fields(cls, message_dict):
|
|
264
|
+
return {
|
|
265
|
+
k: v
|
|
266
|
+
for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
|
|
267
|
+
if k not in message_dict
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@staticmethod
|
|
271
|
+
def _get_http_options():
|
|
272
|
+
http_options: List[Dict[str, str]] = [
|
|
273
|
+
{
|
|
274
|
+
"method": "get",
|
|
275
|
+
"uri": "/v1/{parent=projects/*}/deviceSessions",
|
|
276
|
+
},
|
|
277
|
+
]
|
|
278
|
+
return http_options
|
|
279
|
+
|
|
280
|
+
@staticmethod
|
|
281
|
+
def _get_transcoded_request(http_options, request):
|
|
282
|
+
pb_request = service.ListDeviceSessionsRequest.pb(request)
|
|
283
|
+
transcoded_request = path_template.transcode(http_options, pb_request)
|
|
284
|
+
return transcoded_request
|
|
285
|
+
|
|
286
|
+
@staticmethod
|
|
287
|
+
def _get_query_params_json(transcoded_request):
|
|
288
|
+
query_params = json.loads(
|
|
289
|
+
json_format.MessageToJson(
|
|
290
|
+
transcoded_request["query_params"],
|
|
291
|
+
use_integers_for_enums=True,
|
|
292
|
+
)
|
|
293
|
+
)
|
|
294
|
+
query_params.update(
|
|
295
|
+
_BaseDirectAccessServiceRestTransport._BaseListDeviceSessions._get_unset_required_fields(
|
|
296
|
+
query_params
|
|
297
|
+
)
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
query_params["$alt"] = "json;enum-encoding=int"
|
|
301
|
+
return query_params
|
|
302
|
+
|
|
303
|
+
class _BaseUpdateDeviceSession:
|
|
304
|
+
def __hash__(self): # pragma: NO COVER
|
|
305
|
+
return NotImplementedError("__hash__ must be implemented.")
|
|
306
|
+
|
|
307
|
+
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
|
|
308
|
+
|
|
309
|
+
@classmethod
|
|
310
|
+
def _get_unset_required_fields(cls, message_dict):
|
|
311
|
+
return {
|
|
312
|
+
k: v
|
|
313
|
+
for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
|
|
314
|
+
if k not in message_dict
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
@staticmethod
|
|
318
|
+
def _get_http_options():
|
|
319
|
+
http_options: List[Dict[str, str]] = [
|
|
320
|
+
{
|
|
321
|
+
"method": "patch",
|
|
322
|
+
"uri": "/v1/{device_session.name=projects/*/deviceSessions/*}",
|
|
323
|
+
"body": "device_session",
|
|
324
|
+
},
|
|
325
|
+
]
|
|
326
|
+
return http_options
|
|
327
|
+
|
|
328
|
+
@staticmethod
|
|
329
|
+
def _get_transcoded_request(http_options, request):
|
|
330
|
+
pb_request = service.UpdateDeviceSessionRequest.pb(request)
|
|
331
|
+
transcoded_request = path_template.transcode(http_options, pb_request)
|
|
332
|
+
return transcoded_request
|
|
333
|
+
|
|
334
|
+
@staticmethod
|
|
335
|
+
def _get_request_body_json(transcoded_request):
|
|
336
|
+
# Jsonify the request body
|
|
337
|
+
|
|
338
|
+
body = json_format.MessageToJson(
|
|
339
|
+
transcoded_request["body"], use_integers_for_enums=True
|
|
340
|
+
)
|
|
341
|
+
return body
|
|
342
|
+
|
|
343
|
+
@staticmethod
|
|
344
|
+
def _get_query_params_json(transcoded_request):
|
|
345
|
+
query_params = json.loads(
|
|
346
|
+
json_format.MessageToJson(
|
|
347
|
+
transcoded_request["query_params"],
|
|
348
|
+
use_integers_for_enums=True,
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
query_params.update(
|
|
352
|
+
_BaseDirectAccessServiceRestTransport._BaseUpdateDeviceSession._get_unset_required_fields(
|
|
353
|
+
query_params
|
|
354
|
+
)
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
query_params["$alt"] = "json;enum-encoding=int"
|
|
358
|
+
return query_params
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
__all__ = ("_BaseDirectAccessServiceRestTransport",)
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
from .adb_service import (
|
|
17
|
+
AdbMessage,
|
|
18
|
+
Close,
|
|
19
|
+
DeviceMessage,
|
|
20
|
+
Fail,
|
|
21
|
+
Okay,
|
|
22
|
+
Open,
|
|
23
|
+
StatusUpdate,
|
|
24
|
+
StreamData,
|
|
25
|
+
StreamStatus,
|
|
26
|
+
)
|
|
27
|
+
from .service import (
|
|
28
|
+
AndroidDevice,
|
|
29
|
+
CancelDeviceSessionRequest,
|
|
30
|
+
CreateDeviceSessionRequest,
|
|
31
|
+
DeviceSession,
|
|
32
|
+
GetDeviceSessionRequest,
|
|
33
|
+
ListDeviceSessionsRequest,
|
|
34
|
+
ListDeviceSessionsResponse,
|
|
35
|
+
UpdateDeviceSessionRequest,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
__all__ = (
|
|
39
|
+
"AdbMessage",
|
|
40
|
+
"Close",
|
|
41
|
+
"DeviceMessage",
|
|
42
|
+
"Fail",
|
|
43
|
+
"Okay",
|
|
44
|
+
"Open",
|
|
45
|
+
"StatusUpdate",
|
|
46
|
+
"StreamData",
|
|
47
|
+
"StreamStatus",
|
|
48
|
+
"AndroidDevice",
|
|
49
|
+
"CancelDeviceSessionRequest",
|
|
50
|
+
"CreateDeviceSessionRequest",
|
|
51
|
+
"DeviceSession",
|
|
52
|
+
"GetDeviceSessionRequest",
|
|
53
|
+
"ListDeviceSessionsRequest",
|
|
54
|
+
"ListDeviceSessionsResponse",
|
|
55
|
+
"UpdateDeviceSessionRequest",
|
|
56
|
+
)
|