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.
Files changed (26) hide show
  1. google/cloud/devicestreaming/__init__.py +69 -0
  2. google/cloud/devicestreaming/gapic_version.py +16 -0
  3. google/cloud/devicestreaming/py.typed +2 -0
  4. google/cloud/devicestreaming_v1/__init__.py +67 -0
  5. google/cloud/devicestreaming_v1/gapic_metadata.json +118 -0
  6. google/cloud/devicestreaming_v1/gapic_version.py +16 -0
  7. google/cloud/devicestreaming_v1/py.typed +2 -0
  8. google/cloud/devicestreaming_v1/services/__init__.py +15 -0
  9. google/cloud/devicestreaming_v1/services/direct_access_service/__init__.py +22 -0
  10. google/cloud/devicestreaming_v1/services/direct_access_service/async_client.py +1001 -0
  11. google/cloud/devicestreaming_v1/services/direct_access_service/client.py +1410 -0
  12. google/cloud/devicestreaming_v1/services/direct_access_service/pagers.py +197 -0
  13. google/cloud/devicestreaming_v1/services/direct_access_service/transports/__init__.py +38 -0
  14. google/cloud/devicestreaming_v1/services/direct_access_service/transports/base.py +262 -0
  15. google/cloud/devicestreaming_v1/services/direct_access_service/transports/grpc.py +512 -0
  16. google/cloud/devicestreaming_v1/services/direct_access_service/transports/grpc_asyncio.py +592 -0
  17. google/cloud/devicestreaming_v1/services/direct_access_service/transports/rest.py +1234 -0
  18. google/cloud/devicestreaming_v1/services/direct_access_service/transports/rest_base.py +361 -0
  19. google/cloud/devicestreaming_v1/types/__init__.py +56 -0
  20. google/cloud/devicestreaming_v1/types/adb_service.py +317 -0
  21. google/cloud/devicestreaming_v1/types/service.py +410 -0
  22. google_cloud_devicestreaming-0.1.0.dist-info/LICENSE +202 -0
  23. google_cloud_devicestreaming-0.1.0.dist-info/METADATA +228 -0
  24. google_cloud_devicestreaming-0.1.0.dist-info/RECORD +26 -0
  25. google_cloud_devicestreaming-0.1.0.dist-info/WHEEL +5 -0
  26. google_cloud_devicestreaming-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,197 @@
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 typing import (
17
+ Any,
18
+ AsyncIterator,
19
+ Awaitable,
20
+ Callable,
21
+ Iterator,
22
+ Optional,
23
+ Sequence,
24
+ Tuple,
25
+ Union,
26
+ )
27
+
28
+ from google.api_core import gapic_v1
29
+ from google.api_core import retry as retries
30
+ from google.api_core import retry_async as retries_async
31
+
32
+ try:
33
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
34
+ OptionalAsyncRetry = Union[
35
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
36
+ ]
37
+ except AttributeError: # pragma: NO COVER
38
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
39
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
40
+
41
+ from google.cloud.devicestreaming_v1.types import service
42
+
43
+
44
+ class ListDeviceSessionsPager:
45
+ """A pager for iterating through ``list_device_sessions`` requests.
46
+
47
+ This class thinly wraps an initial
48
+ :class:`google.cloud.devicestreaming_v1.types.ListDeviceSessionsResponse` object, and
49
+ provides an ``__iter__`` method to iterate through its
50
+ ``device_sessions`` field.
51
+
52
+ If there are more pages, the ``__iter__`` method will make additional
53
+ ``ListDeviceSessions`` requests and continue to iterate
54
+ through the ``device_sessions`` field on the
55
+ corresponding responses.
56
+
57
+ All the usual :class:`google.cloud.devicestreaming_v1.types.ListDeviceSessionsResponse`
58
+ attributes are available on the pager. If multiple requests are made, only
59
+ the most recent response is retained, and thus used for attribute lookup.
60
+ """
61
+
62
+ def __init__(
63
+ self,
64
+ method: Callable[..., service.ListDeviceSessionsResponse],
65
+ request: service.ListDeviceSessionsRequest,
66
+ response: service.ListDeviceSessionsResponse,
67
+ *,
68
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
69
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
71
+ ):
72
+ """Instantiate the pager.
73
+
74
+ Args:
75
+ method (Callable): The method that was originally called, and
76
+ which instantiated this pager.
77
+ request (google.cloud.devicestreaming_v1.types.ListDeviceSessionsRequest):
78
+ The initial request object.
79
+ response (google.cloud.devicestreaming_v1.types.ListDeviceSessionsResponse):
80
+ The initial response object.
81
+ retry (google.api_core.retry.Retry): Designation of what errors,
82
+ if any, should be retried.
83
+ timeout (float): The timeout for this request.
84
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
85
+ sent along with the request as metadata. Normally, each value must be of type `str`,
86
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
87
+ be of type `bytes`.
88
+ """
89
+ self._method = method
90
+ self._request = service.ListDeviceSessionsRequest(request)
91
+ self._response = response
92
+ self._retry = retry
93
+ self._timeout = timeout
94
+ self._metadata = metadata
95
+
96
+ def __getattr__(self, name: str) -> Any:
97
+ return getattr(self._response, name)
98
+
99
+ @property
100
+ def pages(self) -> Iterator[service.ListDeviceSessionsResponse]:
101
+ yield self._response
102
+ while self._response.next_page_token:
103
+ self._request.page_token = self._response.next_page_token
104
+ self._response = self._method(
105
+ self._request,
106
+ retry=self._retry,
107
+ timeout=self._timeout,
108
+ metadata=self._metadata,
109
+ )
110
+ yield self._response
111
+
112
+ def __iter__(self) -> Iterator[service.DeviceSession]:
113
+ for page in self.pages:
114
+ yield from page.device_sessions
115
+
116
+ def __repr__(self) -> str:
117
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
118
+
119
+
120
+ class ListDeviceSessionsAsyncPager:
121
+ """A pager for iterating through ``list_device_sessions`` requests.
122
+
123
+ This class thinly wraps an initial
124
+ :class:`google.cloud.devicestreaming_v1.types.ListDeviceSessionsResponse` object, and
125
+ provides an ``__aiter__`` method to iterate through its
126
+ ``device_sessions`` field.
127
+
128
+ If there are more pages, the ``__aiter__`` method will make additional
129
+ ``ListDeviceSessions`` requests and continue to iterate
130
+ through the ``device_sessions`` field on the
131
+ corresponding responses.
132
+
133
+ All the usual :class:`google.cloud.devicestreaming_v1.types.ListDeviceSessionsResponse`
134
+ attributes are available on the pager. If multiple requests are made, only
135
+ the most recent response is retained, and thus used for attribute lookup.
136
+ """
137
+
138
+ def __init__(
139
+ self,
140
+ method: Callable[..., Awaitable[service.ListDeviceSessionsResponse]],
141
+ request: service.ListDeviceSessionsRequest,
142
+ response: service.ListDeviceSessionsResponse,
143
+ *,
144
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
145
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
146
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
147
+ ):
148
+ """Instantiates the pager.
149
+
150
+ Args:
151
+ method (Callable): The method that was originally called, and
152
+ which instantiated this pager.
153
+ request (google.cloud.devicestreaming_v1.types.ListDeviceSessionsRequest):
154
+ The initial request object.
155
+ response (google.cloud.devicestreaming_v1.types.ListDeviceSessionsResponse):
156
+ The initial response object.
157
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
158
+ if any, should be retried.
159
+ timeout (float): The timeout for this request.
160
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
161
+ sent along with the request as metadata. Normally, each value must be of type `str`,
162
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
163
+ be of type `bytes`.
164
+ """
165
+ self._method = method
166
+ self._request = service.ListDeviceSessionsRequest(request)
167
+ self._response = response
168
+ self._retry = retry
169
+ self._timeout = timeout
170
+ self._metadata = metadata
171
+
172
+ def __getattr__(self, name: str) -> Any:
173
+ return getattr(self._response, name)
174
+
175
+ @property
176
+ async def pages(self) -> AsyncIterator[service.ListDeviceSessionsResponse]:
177
+ yield self._response
178
+ while self._response.next_page_token:
179
+ self._request.page_token = self._response.next_page_token
180
+ self._response = await self._method(
181
+ self._request,
182
+ retry=self._retry,
183
+ timeout=self._timeout,
184
+ metadata=self._metadata,
185
+ )
186
+ yield self._response
187
+
188
+ def __aiter__(self) -> AsyncIterator[service.DeviceSession]:
189
+ async def async_generator():
190
+ async for page in self.pages:
191
+ for response in page.device_sessions:
192
+ yield response
193
+
194
+ return async_generator()
195
+
196
+ def __repr__(self) -> str:
197
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
@@ -0,0 +1,38 @@
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 collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import DirectAccessServiceTransport
20
+ from .grpc import DirectAccessServiceGrpcTransport
21
+ from .grpc_asyncio import DirectAccessServiceGrpcAsyncIOTransport
22
+ from .rest import DirectAccessServiceRestInterceptor, DirectAccessServiceRestTransport
23
+
24
+ # Compile a registry of transports.
25
+ _transport_registry = (
26
+ OrderedDict()
27
+ ) # type: Dict[str, Type[DirectAccessServiceTransport]]
28
+ _transport_registry["grpc"] = DirectAccessServiceGrpcTransport
29
+ _transport_registry["grpc_asyncio"] = DirectAccessServiceGrpcAsyncIOTransport
30
+ _transport_registry["rest"] = DirectAccessServiceRestTransport
31
+
32
+ __all__ = (
33
+ "DirectAccessServiceTransport",
34
+ "DirectAccessServiceGrpcTransport",
35
+ "DirectAccessServiceGrpcAsyncIOTransport",
36
+ "DirectAccessServiceRestTransport",
37
+ "DirectAccessServiceRestInterceptor",
38
+ )
@@ -0,0 +1,262 @@
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 abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ import google.api_core
20
+ from google.api_core import exceptions as core_exceptions
21
+ from google.api_core import gapic_v1
22
+ from google.api_core import retry as retries
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.oauth2 import service_account # type: ignore
26
+ from google.protobuf import empty_pb2 # type: ignore
27
+
28
+ from google.cloud.devicestreaming_v1 import gapic_version as package_version
29
+ from google.cloud.devicestreaming_v1.types import adb_service, service
30
+
31
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32
+ gapic_version=package_version.__version__
33
+ )
34
+
35
+
36
+ class DirectAccessServiceTransport(abc.ABC):
37
+ """Abstract transport class for DirectAccessService."""
38
+
39
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
40
+
41
+ DEFAULT_HOST: str = "devicestreaming.googleapis.com"
42
+
43
+ def __init__(
44
+ self,
45
+ *,
46
+ host: str = DEFAULT_HOST,
47
+ credentials: Optional[ga_credentials.Credentials] = None,
48
+ credentials_file: Optional[str] = None,
49
+ scopes: Optional[Sequence[str]] = None,
50
+ quota_project_id: Optional[str] = None,
51
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
52
+ always_use_jwt_access: Optional[bool] = False,
53
+ api_audience: Optional[str] = None,
54
+ **kwargs,
55
+ ) -> None:
56
+ """Instantiate the transport.
57
+
58
+ Args:
59
+ host (Optional[str]):
60
+ The hostname to connect to (default: 'devicestreaming.googleapis.com').
61
+ credentials (Optional[google.auth.credentials.Credentials]): The
62
+ authorization credentials to attach to requests. These
63
+ credentials identify the application to the service; if none
64
+ are specified, the client will attempt to ascertain the
65
+ credentials from the environment.
66
+ credentials_file (Optional[str]): A file with credentials that can
67
+ be loaded with :func:`google.auth.load_credentials_from_file`.
68
+ This argument is mutually exclusive with credentials.
69
+ scopes (Optional[Sequence[str]]): A list of scopes.
70
+ quota_project_id (Optional[str]): An optional project to use for billing
71
+ and quota.
72
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
73
+ The client info used to send a user-agent string along with
74
+ API requests. If ``None``, then default info will be used.
75
+ Generally, you only need to set this if you're developing
76
+ your own client library.
77
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
78
+ be used for service account credentials.
79
+ """
80
+
81
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
82
+
83
+ # Save the scopes.
84
+ self._scopes = scopes
85
+ if not hasattr(self, "_ignore_credentials"):
86
+ self._ignore_credentials: bool = False
87
+
88
+ # If no credentials are provided, then determine the appropriate
89
+ # defaults.
90
+ if credentials and credentials_file:
91
+ raise core_exceptions.DuplicateCredentialArgs(
92
+ "'credentials_file' and 'credentials' are mutually exclusive"
93
+ )
94
+
95
+ if credentials_file is not None:
96
+ credentials, _ = google.auth.load_credentials_from_file(
97
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
98
+ )
99
+ elif credentials is None and not self._ignore_credentials:
100
+ credentials, _ = google.auth.default(
101
+ **scopes_kwargs, quota_project_id=quota_project_id
102
+ )
103
+ # Don't apply audience if the credentials file passed from user.
104
+ if hasattr(credentials, "with_gdch_audience"):
105
+ credentials = credentials.with_gdch_audience(
106
+ api_audience if api_audience else host
107
+ )
108
+
109
+ # If the credentials are service account credentials, then always try to use self signed JWT.
110
+ if (
111
+ always_use_jwt_access
112
+ and isinstance(credentials, service_account.Credentials)
113
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
114
+ ):
115
+ credentials = credentials.with_always_use_jwt_access(True)
116
+
117
+ # Save the credentials.
118
+ self._credentials = credentials
119
+
120
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
121
+ if ":" not in host:
122
+ host += ":443"
123
+ self._host = host
124
+
125
+ @property
126
+ def host(self):
127
+ return self._host
128
+
129
+ def _prep_wrapped_messages(self, client_info):
130
+ # Precompute the wrapped methods.
131
+ self._wrapped_methods = {
132
+ self.create_device_session: gapic_v1.method.wrap_method(
133
+ self.create_device_session,
134
+ default_timeout=20.0,
135
+ client_info=client_info,
136
+ ),
137
+ self.list_device_sessions: gapic_v1.method.wrap_method(
138
+ self.list_device_sessions,
139
+ default_retry=retries.Retry(
140
+ initial=1.0,
141
+ maximum=10.0,
142
+ multiplier=1.3,
143
+ predicate=retries.if_exception_type(
144
+ core_exceptions.ServiceUnavailable,
145
+ ),
146
+ deadline=20.0,
147
+ ),
148
+ default_timeout=20.0,
149
+ client_info=client_info,
150
+ ),
151
+ self.get_device_session: gapic_v1.method.wrap_method(
152
+ self.get_device_session,
153
+ default_retry=retries.Retry(
154
+ initial=1.0,
155
+ maximum=10.0,
156
+ multiplier=1.3,
157
+ predicate=retries.if_exception_type(
158
+ core_exceptions.ServiceUnavailable,
159
+ ),
160
+ deadline=20.0,
161
+ ),
162
+ default_timeout=20.0,
163
+ client_info=client_info,
164
+ ),
165
+ self.cancel_device_session: gapic_v1.method.wrap_method(
166
+ self.cancel_device_session,
167
+ default_retry=retries.Retry(
168
+ initial=1.0,
169
+ maximum=10.0,
170
+ multiplier=1.3,
171
+ predicate=retries.if_exception_type(
172
+ core_exceptions.ServiceUnavailable,
173
+ ),
174
+ deadline=20.0,
175
+ ),
176
+ default_timeout=20.0,
177
+ client_info=client_info,
178
+ ),
179
+ self.update_device_session: gapic_v1.method.wrap_method(
180
+ self.update_device_session,
181
+ default_timeout=20.0,
182
+ client_info=client_info,
183
+ ),
184
+ self.adb_connect: gapic_v1.method.wrap_method(
185
+ self.adb_connect,
186
+ default_timeout=1800.0,
187
+ client_info=client_info,
188
+ ),
189
+ }
190
+
191
+ def close(self):
192
+ """Closes resources associated with the transport.
193
+
194
+ .. warning::
195
+ Only call this method if the transport is NOT shared
196
+ with other clients - this may cause errors in other clients!
197
+ """
198
+ raise NotImplementedError()
199
+
200
+ @property
201
+ def create_device_session(
202
+ self,
203
+ ) -> Callable[
204
+ [service.CreateDeviceSessionRequest],
205
+ Union[service.DeviceSession, Awaitable[service.DeviceSession]],
206
+ ]:
207
+ raise NotImplementedError()
208
+
209
+ @property
210
+ def list_device_sessions(
211
+ self,
212
+ ) -> Callable[
213
+ [service.ListDeviceSessionsRequest],
214
+ Union[
215
+ service.ListDeviceSessionsResponse,
216
+ Awaitable[service.ListDeviceSessionsResponse],
217
+ ],
218
+ ]:
219
+ raise NotImplementedError()
220
+
221
+ @property
222
+ def get_device_session(
223
+ self,
224
+ ) -> Callable[
225
+ [service.GetDeviceSessionRequest],
226
+ Union[service.DeviceSession, Awaitable[service.DeviceSession]],
227
+ ]:
228
+ raise NotImplementedError()
229
+
230
+ @property
231
+ def cancel_device_session(
232
+ self,
233
+ ) -> Callable[
234
+ [service.CancelDeviceSessionRequest],
235
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
236
+ ]:
237
+ raise NotImplementedError()
238
+
239
+ @property
240
+ def update_device_session(
241
+ self,
242
+ ) -> Callable[
243
+ [service.UpdateDeviceSessionRequest],
244
+ Union[service.DeviceSession, Awaitable[service.DeviceSession]],
245
+ ]:
246
+ raise NotImplementedError()
247
+
248
+ @property
249
+ def adb_connect(
250
+ self,
251
+ ) -> Callable[
252
+ [adb_service.AdbMessage],
253
+ Union[adb_service.DeviceMessage, Awaitable[adb_service.DeviceMessage]],
254
+ ]:
255
+ raise NotImplementedError()
256
+
257
+ @property
258
+ def kind(self) -> str:
259
+ raise NotImplementedError()
260
+
261
+
262
+ __all__ = ("DirectAccessServiceTransport",)