google-cloud-dataproc 5.18.1__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 (103) hide show
  1. google/cloud/dataproc/__init__.py +409 -0
  2. google/cloud/dataproc/gapic_version.py +16 -0
  3. google/cloud/dataproc/py.typed +2 -0
  4. google/cloud/dataproc_v1/__init__.py +389 -0
  5. google/cloud/dataproc_v1/gapic_metadata.json +821 -0
  6. google/cloud/dataproc_v1/gapic_version.py +16 -0
  7. google/cloud/dataproc_v1/py.typed +2 -0
  8. google/cloud/dataproc_v1/services/__init__.py +15 -0
  9. google/cloud/dataproc_v1/services/autoscaling_policy_service/__init__.py +22 -0
  10. google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py +1488 -0
  11. google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py +1924 -0
  12. google/cloud/dataproc_v1/services/autoscaling_policy_service/pagers.py +201 -0
  13. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/__init__.py +41 -0
  14. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py +361 -0
  15. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py +635 -0
  16. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py +743 -0
  17. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest.py +2358 -0
  18. google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest_base.py +671 -0
  19. google/cloud/dataproc_v1/services/batch_controller/__init__.py +22 -0
  20. google/cloud/dataproc_v1/services/batch_controller/async_client.py +1330 -0
  21. google/cloud/dataproc_v1/services/batch_controller/client.py +1786 -0
  22. google/cloud/dataproc_v1/services/batch_controller/pagers.py +197 -0
  23. google/cloud/dataproc_v1/services/batch_controller/transports/__init__.py +36 -0
  24. google/cloud/dataproc_v1/services/batch_controller/transports/base.py +308 -0
  25. google/cloud/dataproc_v1/services/batch_controller/transports/grpc.py +606 -0
  26. google/cloud/dataproc_v1/services/batch_controller/transports/grpc_asyncio.py +682 -0
  27. google/cloud/dataproc_v1/services/batch_controller/transports/rest.py +2118 -0
  28. google/cloud/dataproc_v1/services/batch_controller/transports/rest_base.py +592 -0
  29. google/cloud/dataproc_v1/services/cluster_controller/__init__.py +22 -0
  30. google/cloud/dataproc_v1/services/cluster_controller/async_client.py +2096 -0
  31. google/cloud/dataproc_v1/services/cluster_controller/client.py +2587 -0
  32. google/cloud/dataproc_v1/services/cluster_controller/pagers.py +197 -0
  33. google/cloud/dataproc_v1/services/cluster_controller/transports/__init__.py +36 -0
  34. google/cloud/dataproc_v1/services/cluster_controller/transports/base.py +423 -0
  35. google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py +729 -0
  36. google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py +885 -0
  37. google/cloud/dataproc_v1/services/cluster_controller/transports/rest.py +3062 -0
  38. google/cloud/dataproc_v1/services/cluster_controller/transports/rest_base.py +821 -0
  39. google/cloud/dataproc_v1/services/job_controller/__init__.py +22 -0
  40. google/cloud/dataproc_v1/services/job_controller/async_client.py +1787 -0
  41. google/cloud/dataproc_v1/services/job_controller/client.py +2195 -0
  42. google/cloud/dataproc_v1/services/job_controller/pagers.py +197 -0
  43. google/cloud/dataproc_v1/services/job_controller/transports/__init__.py +36 -0
  44. google/cloud/dataproc_v1/services/job_controller/transports/base.py +408 -0
  45. google/cloud/dataproc_v1/services/job_controller/transports/grpc.py +678 -0
  46. google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py +838 -0
  47. google/cloud/dataproc_v1/services/job_controller/transports/rest.py +2753 -0
  48. google/cloud/dataproc_v1/services/job_controller/transports/rest_base.py +765 -0
  49. google/cloud/dataproc_v1/services/node_group_controller/__init__.py +22 -0
  50. google/cloud/dataproc_v1/services/node_group_controller/async_client.py +1255 -0
  51. google/cloud/dataproc_v1/services/node_group_controller/client.py +1695 -0
  52. google/cloud/dataproc_v1/services/node_group_controller/transports/__init__.py +38 -0
  53. google/cloud/dataproc_v1/services/node_group_controller/transports/base.py +295 -0
  54. google/cloud/dataproc_v1/services/node_group_controller/transports/grpc.py +585 -0
  55. google/cloud/dataproc_v1/services/node_group_controller/transports/grpc_asyncio.py +656 -0
  56. google/cloud/dataproc_v1/services/node_group_controller/transports/rest.py +2017 -0
  57. google/cloud/dataproc_v1/services/node_group_controller/transports/rest_base.py +554 -0
  58. google/cloud/dataproc_v1/services/session_controller/__init__.py +22 -0
  59. google/cloud/dataproc_v1/services/session_controller/async_client.py +1488 -0
  60. google/cloud/dataproc_v1/services/session_controller/client.py +1960 -0
  61. google/cloud/dataproc_v1/services/session_controller/pagers.py +197 -0
  62. google/cloud/dataproc_v1/services/session_controller/transports/__init__.py +36 -0
  63. google/cloud/dataproc_v1/services/session_controller/transports/base.py +323 -0
  64. google/cloud/dataproc_v1/services/session_controller/transports/grpc.py +633 -0
  65. google/cloud/dataproc_v1/services/session_controller/transports/grpc_asyncio.py +716 -0
  66. google/cloud/dataproc_v1/services/session_controller/transports/rest.py +2416 -0
  67. google/cloud/dataproc_v1/services/session_controller/transports/rest_base.py +650 -0
  68. google/cloud/dataproc_v1/services/session_template_controller/__init__.py +22 -0
  69. google/cloud/dataproc_v1/services/session_template_controller/async_client.py +1442 -0
  70. google/cloud/dataproc_v1/services/session_template_controller/client.py +1886 -0
  71. google/cloud/dataproc_v1/services/session_template_controller/pagers.py +201 -0
  72. google/cloud/dataproc_v1/services/session_template_controller/transports/__init__.py +41 -0
  73. google/cloud/dataproc_v1/services/session_template_controller/transports/base.py +331 -0
  74. google/cloud/dataproc_v1/services/session_template_controller/transports/grpc.py +628 -0
  75. google/cloud/dataproc_v1/services/session_template_controller/transports/grpc_asyncio.py +708 -0
  76. google/cloud/dataproc_v1/services/session_template_controller/transports/rest.py +2349 -0
  77. google/cloud/dataproc_v1/services/session_template_controller/transports/rest_base.py +649 -0
  78. google/cloud/dataproc_v1/services/workflow_template_service/__init__.py +22 -0
  79. google/cloud/dataproc_v1/services/workflow_template_service/async_client.py +1885 -0
  80. google/cloud/dataproc_v1/services/workflow_template_service/client.py +2370 -0
  81. google/cloud/dataproc_v1/services/workflow_template_service/pagers.py +201 -0
  82. google/cloud/dataproc_v1/services/workflow_template_service/transports/__init__.py +41 -0
  83. google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py +431 -0
  84. google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py +760 -0
  85. google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py +916 -0
  86. google/cloud/dataproc_v1/services/workflow_template_service/transports/rest.py +2882 -0
  87. google/cloud/dataproc_v1/services/workflow_template_service/transports/rest_base.py +799 -0
  88. google/cloud/dataproc_v1/types/__init__.py +342 -0
  89. google/cloud/dataproc_v1/types/autoscaling_policies.py +448 -0
  90. google/cloud/dataproc_v1/types/batches.py +642 -0
  91. google/cloud/dataproc_v1/types/clusters.py +2671 -0
  92. google/cloud/dataproc_v1/types/jobs.py +1822 -0
  93. google/cloud/dataproc_v1/types/node_groups.py +166 -0
  94. google/cloud/dataproc_v1/types/operations.py +395 -0
  95. google/cloud/dataproc_v1/types/session_templates.py +284 -0
  96. google/cloud/dataproc_v1/types/sessions.py +504 -0
  97. google/cloud/dataproc_v1/types/shared.py +1010 -0
  98. google/cloud/dataproc_v1/types/workflow_templates.py +1229 -0
  99. google_cloud_dataproc-5.18.1.dist-info/LICENSE +202 -0
  100. google_cloud_dataproc-5.18.1.dist-info/METADATA +229 -0
  101. google_cloud_dataproc-5.18.1.dist-info/RECORD +103 -0
  102. google_cloud_dataproc-5.18.1.dist-info/WHEEL +5 -0
  103. google_cloud_dataproc-5.18.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,201 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 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.dataproc_v1.types import autoscaling_policies
42
+
43
+
44
+ class ListAutoscalingPoliciesPager:
45
+ """A pager for iterating through ``list_autoscaling_policies`` requests.
46
+
47
+ This class thinly wraps an initial
48
+ :class:`google.cloud.dataproc_v1.types.ListAutoscalingPoliciesResponse` object, and
49
+ provides an ``__iter__`` method to iterate through its
50
+ ``policies`` field.
51
+
52
+ If there are more pages, the ``__iter__`` method will make additional
53
+ ``ListAutoscalingPolicies`` requests and continue to iterate
54
+ through the ``policies`` field on the
55
+ corresponding responses.
56
+
57
+ All the usual :class:`google.cloud.dataproc_v1.types.ListAutoscalingPoliciesResponse`
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[..., autoscaling_policies.ListAutoscalingPoliciesResponse],
65
+ request: autoscaling_policies.ListAutoscalingPoliciesRequest,
66
+ response: autoscaling_policies.ListAutoscalingPoliciesResponse,
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.dataproc_v1.types.ListAutoscalingPoliciesRequest):
78
+ The initial request object.
79
+ response (google.cloud.dataproc_v1.types.ListAutoscalingPoliciesResponse):
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 = autoscaling_policies.ListAutoscalingPoliciesRequest(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[autoscaling_policies.ListAutoscalingPoliciesResponse]:
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[autoscaling_policies.AutoscalingPolicy]:
113
+ for page in self.pages:
114
+ yield from page.policies
115
+
116
+ def __repr__(self) -> str:
117
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
118
+
119
+
120
+ class ListAutoscalingPoliciesAsyncPager:
121
+ """A pager for iterating through ``list_autoscaling_policies`` requests.
122
+
123
+ This class thinly wraps an initial
124
+ :class:`google.cloud.dataproc_v1.types.ListAutoscalingPoliciesResponse` object, and
125
+ provides an ``__aiter__`` method to iterate through its
126
+ ``policies`` field.
127
+
128
+ If there are more pages, the ``__aiter__`` method will make additional
129
+ ``ListAutoscalingPolicies`` requests and continue to iterate
130
+ through the ``policies`` field on the
131
+ corresponding responses.
132
+
133
+ All the usual :class:`google.cloud.dataproc_v1.types.ListAutoscalingPoliciesResponse`
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[
141
+ ..., Awaitable[autoscaling_policies.ListAutoscalingPoliciesResponse]
142
+ ],
143
+ request: autoscaling_policies.ListAutoscalingPoliciesRequest,
144
+ response: autoscaling_policies.ListAutoscalingPoliciesResponse,
145
+ *,
146
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
147
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
148
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
149
+ ):
150
+ """Instantiates the pager.
151
+
152
+ Args:
153
+ method (Callable): The method that was originally called, and
154
+ which instantiated this pager.
155
+ request (google.cloud.dataproc_v1.types.ListAutoscalingPoliciesRequest):
156
+ The initial request object.
157
+ response (google.cloud.dataproc_v1.types.ListAutoscalingPoliciesResponse):
158
+ The initial response object.
159
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
160
+ if any, should be retried.
161
+ timeout (float): The timeout for this request.
162
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
163
+ sent along with the request as metadata. Normally, each value must be of type `str`,
164
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
165
+ be of type `bytes`.
166
+ """
167
+ self._method = method
168
+ self._request = autoscaling_policies.ListAutoscalingPoliciesRequest(request)
169
+ self._response = response
170
+ self._retry = retry
171
+ self._timeout = timeout
172
+ self._metadata = metadata
173
+
174
+ def __getattr__(self, name: str) -> Any:
175
+ return getattr(self._response, name)
176
+
177
+ @property
178
+ async def pages(
179
+ self,
180
+ ) -> AsyncIterator[autoscaling_policies.ListAutoscalingPoliciesResponse]:
181
+ yield self._response
182
+ while self._response.next_page_token:
183
+ self._request.page_token = self._response.next_page_token
184
+ self._response = await self._method(
185
+ self._request,
186
+ retry=self._retry,
187
+ timeout=self._timeout,
188
+ metadata=self._metadata,
189
+ )
190
+ yield self._response
191
+
192
+ def __aiter__(self) -> AsyncIterator[autoscaling_policies.AutoscalingPolicy]:
193
+ async def async_generator():
194
+ async for page in self.pages:
195
+ for response in page.policies:
196
+ yield response
197
+
198
+ return async_generator()
199
+
200
+ def __repr__(self) -> str:
201
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 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 AutoscalingPolicyServiceTransport
20
+ from .grpc import AutoscalingPolicyServiceGrpcTransport
21
+ from .grpc_asyncio import AutoscalingPolicyServiceGrpcAsyncIOTransport
22
+ from .rest import (
23
+ AutoscalingPolicyServiceRestInterceptor,
24
+ AutoscalingPolicyServiceRestTransport,
25
+ )
26
+
27
+ # Compile a registry of transports.
28
+ _transport_registry = (
29
+ OrderedDict()
30
+ ) # type: Dict[str, Type[AutoscalingPolicyServiceTransport]]
31
+ _transport_registry["grpc"] = AutoscalingPolicyServiceGrpcTransport
32
+ _transport_registry["grpc_asyncio"] = AutoscalingPolicyServiceGrpcAsyncIOTransport
33
+ _transport_registry["rest"] = AutoscalingPolicyServiceRestTransport
34
+
35
+ __all__ = (
36
+ "AutoscalingPolicyServiceTransport",
37
+ "AutoscalingPolicyServiceGrpcTransport",
38
+ "AutoscalingPolicyServiceGrpcAsyncIOTransport",
39
+ "AutoscalingPolicyServiceRestTransport",
40
+ "AutoscalingPolicyServiceRestInterceptor",
41
+ )
@@ -0,0 +1,361 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 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.iam.v1 import iam_policy_pb2 # type: ignore
26
+ from google.iam.v1 import policy_pb2 # type: ignore
27
+ from google.longrunning import operations_pb2 # type: ignore
28
+ from google.oauth2 import service_account # type: ignore
29
+ from google.protobuf import empty_pb2 # type: ignore
30
+
31
+ from google.cloud.dataproc_v1 import gapic_version as package_version
32
+ from google.cloud.dataproc_v1.types import autoscaling_policies
33
+
34
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35
+ gapic_version=package_version.__version__
36
+ )
37
+
38
+
39
+ class AutoscalingPolicyServiceTransport(abc.ABC):
40
+ """Abstract transport class for AutoscalingPolicyService."""
41
+
42
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
43
+
44
+ DEFAULT_HOST: str = "dataproc.googleapis.com"
45
+
46
+ def __init__(
47
+ self,
48
+ *,
49
+ host: str = DEFAULT_HOST,
50
+ credentials: Optional[ga_credentials.Credentials] = None,
51
+ credentials_file: Optional[str] = None,
52
+ scopes: Optional[Sequence[str]] = None,
53
+ quota_project_id: Optional[str] = None,
54
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
55
+ always_use_jwt_access: Optional[bool] = False,
56
+ api_audience: Optional[str] = None,
57
+ **kwargs,
58
+ ) -> None:
59
+ """Instantiate the transport.
60
+
61
+ Args:
62
+ host (Optional[str]):
63
+ The hostname to connect to (default: 'dataproc.googleapis.com').
64
+ credentials (Optional[google.auth.credentials.Credentials]): The
65
+ authorization credentials to attach to requests. These
66
+ credentials identify the application to the service; if none
67
+ are specified, the client will attempt to ascertain the
68
+ credentials from the environment.
69
+ credentials_file (Optional[str]): A file with credentials that can
70
+ be loaded with :func:`google.auth.load_credentials_from_file`.
71
+ This argument is mutually exclusive with credentials.
72
+ scopes (Optional[Sequence[str]]): A list of scopes.
73
+ quota_project_id (Optional[str]): An optional project to use for billing
74
+ and quota.
75
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
76
+ The client info used to send a user-agent string along with
77
+ API requests. If ``None``, then default info will be used.
78
+ Generally, you only need to set this if you're developing
79
+ your own client library.
80
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
81
+ be used for service account credentials.
82
+ """
83
+
84
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
85
+
86
+ # Save the scopes.
87
+ self._scopes = scopes
88
+ if not hasattr(self, "_ignore_credentials"):
89
+ self._ignore_credentials: bool = False
90
+
91
+ # If no credentials are provided, then determine the appropriate
92
+ # defaults.
93
+ if credentials and credentials_file:
94
+ raise core_exceptions.DuplicateCredentialArgs(
95
+ "'credentials_file' and 'credentials' are mutually exclusive"
96
+ )
97
+
98
+ if credentials_file is not None:
99
+ credentials, _ = google.auth.load_credentials_from_file(
100
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
101
+ )
102
+ elif credentials is None and not self._ignore_credentials:
103
+ credentials, _ = google.auth.default(
104
+ **scopes_kwargs, quota_project_id=quota_project_id
105
+ )
106
+ # Don't apply audience if the credentials file passed from user.
107
+ if hasattr(credentials, "with_gdch_audience"):
108
+ credentials = credentials.with_gdch_audience(
109
+ api_audience if api_audience else host
110
+ )
111
+
112
+ # If the credentials are service account credentials, then always try to use self signed JWT.
113
+ if (
114
+ always_use_jwt_access
115
+ and isinstance(credentials, service_account.Credentials)
116
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
117
+ ):
118
+ credentials = credentials.with_always_use_jwt_access(True)
119
+
120
+ # Save the credentials.
121
+ self._credentials = credentials
122
+
123
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
124
+ if ":" not in host:
125
+ host += ":443"
126
+ self._host = host
127
+
128
+ @property
129
+ def host(self):
130
+ return self._host
131
+
132
+ def _prep_wrapped_messages(self, client_info):
133
+ # Precompute the wrapped methods.
134
+ self._wrapped_methods = {
135
+ self.create_autoscaling_policy: gapic_v1.method.wrap_method(
136
+ self.create_autoscaling_policy,
137
+ default_timeout=600.0,
138
+ client_info=client_info,
139
+ ),
140
+ self.update_autoscaling_policy: gapic_v1.method.wrap_method(
141
+ self.update_autoscaling_policy,
142
+ default_retry=retries.Retry(
143
+ initial=0.1,
144
+ maximum=60.0,
145
+ multiplier=1.3,
146
+ predicate=retries.if_exception_type(
147
+ core_exceptions.DeadlineExceeded,
148
+ core_exceptions.ServiceUnavailable,
149
+ ),
150
+ deadline=600.0,
151
+ ),
152
+ default_timeout=600.0,
153
+ client_info=client_info,
154
+ ),
155
+ self.get_autoscaling_policy: gapic_v1.method.wrap_method(
156
+ self.get_autoscaling_policy,
157
+ default_retry=retries.Retry(
158
+ initial=0.1,
159
+ maximum=60.0,
160
+ multiplier=1.3,
161
+ predicate=retries.if_exception_type(
162
+ core_exceptions.DeadlineExceeded,
163
+ core_exceptions.ServiceUnavailable,
164
+ ),
165
+ deadline=600.0,
166
+ ),
167
+ default_timeout=600.0,
168
+ client_info=client_info,
169
+ ),
170
+ self.list_autoscaling_policies: gapic_v1.method.wrap_method(
171
+ self.list_autoscaling_policies,
172
+ default_retry=retries.Retry(
173
+ initial=0.1,
174
+ maximum=60.0,
175
+ multiplier=1.3,
176
+ predicate=retries.if_exception_type(
177
+ core_exceptions.DeadlineExceeded,
178
+ core_exceptions.ServiceUnavailable,
179
+ ),
180
+ deadline=600.0,
181
+ ),
182
+ default_timeout=600.0,
183
+ client_info=client_info,
184
+ ),
185
+ self.delete_autoscaling_policy: gapic_v1.method.wrap_method(
186
+ self.delete_autoscaling_policy,
187
+ default_timeout=600.0,
188
+ client_info=client_info,
189
+ ),
190
+ self.get_iam_policy: gapic_v1.method.wrap_method(
191
+ self.get_iam_policy,
192
+ default_timeout=None,
193
+ client_info=client_info,
194
+ ),
195
+ self.set_iam_policy: gapic_v1.method.wrap_method(
196
+ self.set_iam_policy,
197
+ default_timeout=None,
198
+ client_info=client_info,
199
+ ),
200
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
201
+ self.test_iam_permissions,
202
+ default_timeout=None,
203
+ client_info=client_info,
204
+ ),
205
+ self.cancel_operation: gapic_v1.method.wrap_method(
206
+ self.cancel_operation,
207
+ default_timeout=None,
208
+ client_info=client_info,
209
+ ),
210
+ self.delete_operation: gapic_v1.method.wrap_method(
211
+ self.delete_operation,
212
+ default_timeout=None,
213
+ client_info=client_info,
214
+ ),
215
+ self.get_operation: gapic_v1.method.wrap_method(
216
+ self.get_operation,
217
+ default_timeout=None,
218
+ client_info=client_info,
219
+ ),
220
+ self.list_operations: gapic_v1.method.wrap_method(
221
+ self.list_operations,
222
+ default_timeout=None,
223
+ client_info=client_info,
224
+ ),
225
+ }
226
+
227
+ def close(self):
228
+ """Closes resources associated with the transport.
229
+
230
+ .. warning::
231
+ Only call this method if the transport is NOT shared
232
+ with other clients - this may cause errors in other clients!
233
+ """
234
+ raise NotImplementedError()
235
+
236
+ @property
237
+ def create_autoscaling_policy(
238
+ self,
239
+ ) -> Callable[
240
+ [autoscaling_policies.CreateAutoscalingPolicyRequest],
241
+ Union[
242
+ autoscaling_policies.AutoscalingPolicy,
243
+ Awaitable[autoscaling_policies.AutoscalingPolicy],
244
+ ],
245
+ ]:
246
+ raise NotImplementedError()
247
+
248
+ @property
249
+ def update_autoscaling_policy(
250
+ self,
251
+ ) -> Callable[
252
+ [autoscaling_policies.UpdateAutoscalingPolicyRequest],
253
+ Union[
254
+ autoscaling_policies.AutoscalingPolicy,
255
+ Awaitable[autoscaling_policies.AutoscalingPolicy],
256
+ ],
257
+ ]:
258
+ raise NotImplementedError()
259
+
260
+ @property
261
+ def get_autoscaling_policy(
262
+ self,
263
+ ) -> Callable[
264
+ [autoscaling_policies.GetAutoscalingPolicyRequest],
265
+ Union[
266
+ autoscaling_policies.AutoscalingPolicy,
267
+ Awaitable[autoscaling_policies.AutoscalingPolicy],
268
+ ],
269
+ ]:
270
+ raise NotImplementedError()
271
+
272
+ @property
273
+ def list_autoscaling_policies(
274
+ self,
275
+ ) -> Callable[
276
+ [autoscaling_policies.ListAutoscalingPoliciesRequest],
277
+ Union[
278
+ autoscaling_policies.ListAutoscalingPoliciesResponse,
279
+ Awaitable[autoscaling_policies.ListAutoscalingPoliciesResponse],
280
+ ],
281
+ ]:
282
+ raise NotImplementedError()
283
+
284
+ @property
285
+ def delete_autoscaling_policy(
286
+ self,
287
+ ) -> Callable[
288
+ [autoscaling_policies.DeleteAutoscalingPolicyRequest],
289
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
290
+ ]:
291
+ raise NotImplementedError()
292
+
293
+ @property
294
+ def list_operations(
295
+ self,
296
+ ) -> Callable[
297
+ [operations_pb2.ListOperationsRequest],
298
+ Union[
299
+ operations_pb2.ListOperationsResponse,
300
+ Awaitable[operations_pb2.ListOperationsResponse],
301
+ ],
302
+ ]:
303
+ raise NotImplementedError()
304
+
305
+ @property
306
+ def get_operation(
307
+ self,
308
+ ) -> Callable[
309
+ [operations_pb2.GetOperationRequest],
310
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
311
+ ]:
312
+ raise NotImplementedError()
313
+
314
+ @property
315
+ def cancel_operation(
316
+ self,
317
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
318
+ raise NotImplementedError()
319
+
320
+ @property
321
+ def delete_operation(
322
+ self,
323
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None,]:
324
+ raise NotImplementedError()
325
+
326
+ @property
327
+ def set_iam_policy(
328
+ self,
329
+ ) -> Callable[
330
+ [iam_policy_pb2.SetIamPolicyRequest],
331
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
332
+ ]:
333
+ raise NotImplementedError()
334
+
335
+ @property
336
+ def get_iam_policy(
337
+ self,
338
+ ) -> Callable[
339
+ [iam_policy_pb2.GetIamPolicyRequest],
340
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
341
+ ]:
342
+ raise NotImplementedError()
343
+
344
+ @property
345
+ def test_iam_permissions(
346
+ self,
347
+ ) -> Callable[
348
+ [iam_policy_pb2.TestIamPermissionsRequest],
349
+ Union[
350
+ iam_policy_pb2.TestIamPermissionsResponse,
351
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
352
+ ],
353
+ ]:
354
+ raise NotImplementedError()
355
+
356
+ @property
357
+ def kind(self) -> str:
358
+ raise NotImplementedError()
359
+
360
+
361
+ __all__ = ("AutoscalingPolicyServiceTransport",)