Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit cfccdf0

Browse files
chore: use gapic-generator-python 0.53.4 (#154)
- [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency fix: fix extras_require typo in setup.py committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: googleapis/googleapis@83d81b0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
1 parent 590e484 commit cfccdf0

File tree

14 files changed

+109
-299
lines changed

14 files changed

+109
-299
lines changed

google/cloud/billing/budgets_v1/services/budget_service/async_client.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
from typing import Dict, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

22-
import google.api_core.client_options as ClientOptions # type: ignore
22+
from google.api_core.client_options import ClientOptions # type: ignore
2323
from google.api_core import exceptions as core_exceptions # type: ignore
2424
from google.api_core import gapic_v1 # type: ignore
2525
from google.api_core import retry as retries # type: ignore
2626
from google.auth import credentials as ga_credentials # type: ignore
2727
from google.oauth2 import service_account # type: ignore
2828

29+
OptionalRetry = Union[retries.Retry, object]
30+
2931
from google.cloud.billing.budgets_v1.services.budget_service import pagers
3032
from google.cloud.billing.budgets_v1.types import budget_model
3133
from google.cloud.billing.budgets_v1.types import budget_service
@@ -168,11 +170,11 @@ def __init__(
168170

169171
async def create_budget(
170172
self,
171-
request: budget_service.CreateBudgetRequest = None,
173+
request: Union[budget_service.CreateBudgetRequest, dict] = None,
172174
*,
173175
parent: str = None,
174176
budget: budget_model.Budget = None,
175-
retry: retries.Retry = gapic_v1.method.DEFAULT,
177+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
176178
timeout: float = None,
177179
metadata: Sequence[Tuple[str, str]] = (),
178180
) -> budget_model.Budget:
@@ -182,7 +184,7 @@ async def create_budget(
182184
create.
183185
184186
Args:
185-
request (:class:`google.cloud.billing.budgets_v1.types.CreateBudgetRequest`):
187+
request (Union[google.cloud.billing.budgets_v1.types.CreateBudgetRequest, dict]):
186188
The request object. Request for CreateBudget
187189
parent (:class:`str`):
188190
Required. The name of the billing account to create the
@@ -257,11 +259,11 @@ async def create_budget(
257259

258260
async def update_budget(
259261
self,
260-
request: budget_service.UpdateBudgetRequest = None,
262+
request: Union[budget_service.UpdateBudgetRequest, dict] = None,
261263
*,
262264
budget: budget_model.Budget = None,
263265
update_mask: field_mask_pb2.FieldMask = None,
264-
retry: retries.Retry = gapic_v1.method.DEFAULT,
266+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
265267
timeout: float = None,
266268
metadata: Sequence[Tuple[str, str]] = (),
267269
) -> budget_model.Budget:
@@ -272,7 +274,7 @@ async def update_budget(
272274
changed by this method.
273275
274276
Args:
275-
request (:class:`google.cloud.billing.budgets_v1.types.UpdateBudgetRequest`):
277+
request (Union[google.cloud.billing.budgets_v1.types.UpdateBudgetRequest, dict]):
276278
The request object. Request for UpdateBudget
277279
budget (:class:`google.cloud.billing.budgets_v1.types.Budget`):
278280
Required. The updated budget object.
@@ -365,10 +367,10 @@ async def update_budget(
365367

366368
async def get_budget(
367369
self,
368-
request: budget_service.GetBudgetRequest = None,
370+
request: Union[budget_service.GetBudgetRequest, dict] = None,
369371
*,
370372
name: str = None,
371-
retry: retries.Retry = gapic_v1.method.DEFAULT,
373+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
372374
timeout: float = None,
373375
metadata: Sequence[Tuple[str, str]] = (),
374376
) -> budget_model.Budget:
@@ -380,7 +382,7 @@ async def get_budget(
380382
Cloud Console.
381383
382384
Args:
383-
request (:class:`google.cloud.billing.budgets_v1.types.GetBudgetRequest`):
385+
request (Union[google.cloud.billing.budgets_v1.types.GetBudgetRequest, dict]):
384386
The request object. Request for GetBudget
385387
name (:class:`str`):
386388
Required. Name of budget to get. Values are of the form
@@ -457,10 +459,10 @@ async def get_budget(
457459

458460
async def list_budgets(
459461
self,
460-
request: budget_service.ListBudgetsRequest = None,
462+
request: Union[budget_service.ListBudgetsRequest, dict] = None,
461463
*,
462464
parent: str = None,
463-
retry: retries.Retry = gapic_v1.method.DEFAULT,
465+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
464466
timeout: float = None,
465467
metadata: Sequence[Tuple[str, str]] = (),
466468
) -> pagers.ListBudgetsAsyncPager:
@@ -472,7 +474,7 @@ async def list_budgets(
472474
Cloud Console.
473475
474476
Args:
475-
request (:class:`google.cloud.billing.budgets_v1.types.ListBudgetsRequest`):
477+
request (Union[google.cloud.billing.budgets_v1.types.ListBudgetsRequest, dict]):
476478
The request object. Request for ListBudgets
477479
parent (:class:`str`):
478480
Required. Name of billing account to list budgets under.
@@ -551,18 +553,18 @@ async def list_budgets(
551553

552554
async def delete_budget(
553555
self,
554-
request: budget_service.DeleteBudgetRequest = None,
556+
request: Union[budget_service.DeleteBudgetRequest, dict] = None,
555557
*,
556558
name: str = None,
557-
retry: retries.Retry = gapic_v1.method.DEFAULT,
559+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
558560
timeout: float = None,
559561
metadata: Sequence[Tuple[str, str]] = (),
560562
) -> None:
561563
r"""Deletes a budget. Returns successfully if already
562564
deleted.
563565
564566
Args:
565-
request (:class:`google.cloud.billing.budgets_v1.types.DeleteBudgetRequest`):
567+
request (Union[google.cloud.billing.budgets_v1.types.DeleteBudgetRequest, dict]):
566568
The request object. Request for DeleteBudget
567569
name (:class:`str`):
568570
Required. Name of the budget to delete. Values are of

google/cloud/billing/budgets_v1/services/budget_service/client.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from google.auth.exceptions import MutualTLSChannelError # type: ignore
3131
from google.oauth2 import service_account # type: ignore
3232

33+
OptionalRetry = Union[retries.Retry, object]
34+
3335
from google.cloud.billing.budgets_v1.services.budget_service import pagers
3436
from google.cloud.billing.budgets_v1.types import budget_model
3537
from google.cloud.billing.budgets_v1.types import budget_service
@@ -355,7 +357,7 @@ def create_budget(
355357
*,
356358
parent: str = None,
357359
budget: budget_model.Budget = None,
358-
retry: retries.Retry = gapic_v1.method.DEFAULT,
360+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
359361
timeout: float = None,
360362
metadata: Sequence[Tuple[str, str]] = (),
361363
) -> budget_model.Budget:
@@ -444,7 +446,7 @@ def update_budget(
444446
*,
445447
budget: budget_model.Budget = None,
446448
update_mask: field_mask_pb2.FieldMask = None,
447-
retry: retries.Retry = gapic_v1.method.DEFAULT,
449+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
448450
timeout: float = None,
449451
metadata: Sequence[Tuple[str, str]] = (),
450452
) -> budget_model.Budget:
@@ -541,7 +543,7 @@ def get_budget(
541543
request: Union[budget_service.GetBudgetRequest, dict] = None,
542544
*,
543545
name: str = None,
544-
retry: retries.Retry = gapic_v1.method.DEFAULT,
546+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
545547
timeout: float = None,
546548
metadata: Sequence[Tuple[str, str]] = (),
547549
) -> budget_model.Budget:
@@ -623,7 +625,7 @@ def list_budgets(
623625
request: Union[budget_service.ListBudgetsRequest, dict] = None,
624626
*,
625627
parent: str = None,
626-
retry: retries.Retry = gapic_v1.method.DEFAULT,
628+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
627629
timeout: float = None,
628630
metadata: Sequence[Tuple[str, str]] = (),
629631
) -> pagers.ListBudgetsPager:
@@ -707,7 +709,7 @@ def delete_budget(
707709
request: Union[budget_service.DeleteBudgetRequest, dict] = None,
708710
*,
709711
name: str = None,
710-
retry: retries.Retry = gapic_v1.method.DEFAULT,
712+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
711713
timeout: float = None,
712714
metadata: Sequence[Tuple[str, str]] = (),
713715
) -> None:

google/cloud/billing/budgets_v1/services/budget_service/transports/base.py

+1-34
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#
1616
import abc
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18-
import packaging.version
1918
import pkg_resources
2019

2120
import google.auth # type: ignore
@@ -39,15 +38,6 @@
3938
except pkg_resources.DistributionNotFound:
4039
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
4140

42-
try:
43-
# google.auth.__version__ was added in 1.26.0
44-
_GOOGLE_AUTH_VERSION = google.auth.__version__
45-
except AttributeError:
46-
try: # try pkg_resources if it is available
47-
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
48-
except pkg_resources.DistributionNotFound: # pragma: NO COVER
49-
_GOOGLE_AUTH_VERSION = None
50-
5141

5242
class BudgetServiceTransport(abc.ABC):
5343
"""Abstract transport class for BudgetService."""
@@ -100,7 +90,7 @@ def __init__(
10090
host += ":443"
10191
self._host = host
10292

103-
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
93+
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
10494

10595
# Save the scopes.
10696
self._scopes = scopes
@@ -133,29 +123,6 @@ def __init__(
133123
# Save the credentials.
134124
self._credentials = credentials
135125

136-
# TODO(busunkim): This method is in the base transport
137-
# to avoid duplicating code across the transport classes. These functions
138-
# should be deleted once the minimum required versions of google-auth is increased.
139-
140-
# TODO: Remove this function once google-auth >= 1.25.0 is required
141-
@classmethod
142-
def _get_scopes_kwargs(
143-
cls, host: str, scopes: Optional[Sequence[str]]
144-
) -> Dict[str, Optional[Sequence[str]]]:
145-
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""
146-
147-
scopes_kwargs = {}
148-
149-
if _GOOGLE_AUTH_VERSION and (
150-
packaging.version.parse(_GOOGLE_AUTH_VERSION)
151-
>= packaging.version.parse("1.25.0")
152-
):
153-
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
154-
else:
155-
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}
156-
157-
return scopes_kwargs
158-
159126
def _prep_wrapped_messages(self, client_info):
160127
# Precompute the wrapped methods.
161128
self._wrapped_methods = {

google/cloud/billing/budgets_v1/services/budget_service/transports/grpc_asyncio.py

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from google.api_core import grpc_helpers_async # type: ignore
2121
from google.auth import credentials as ga_credentials # type: ignore
2222
from google.auth.transport.grpc import SslCredentials # type: ignore
23-
import packaging.version
2423

2524
import grpc # type: ignore
2625
from grpc.experimental import aio # type: ignore

google/cloud/billing/budgets_v1/types/budget_model.py

+18
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ class Budget(proto.Message):
102102
class BudgetAmount(proto.Message):
103103
r"""The budgeted amount for each usage period.
104104
105+
This message has `oneof`_ fields (mutually exclusive fields).
106+
For each oneof, at most one member field can be set at the same time.
107+
Setting any member of the oneof automatically clears all other
108+
members.
109+
110+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
111+
105112
Attributes:
106113
specified_amount (google.type.money_pb2.Money):
107114
A specified amount to use as the budget. ``currency_code``
@@ -110,13 +117,15 @@ class BudgetAmount(proto.Message):
110117
updating a budget, it must match the currency_code of the
111118
existing budget. The ``currency_code`` is provided on
112119
output.
120+
This field is a member of `oneof`_ ``budget_amount``.
113121
last_period_amount (google.cloud.billing.budgets_v1.types.LastPeriodAmount):
114122
Use the last period's actual spend as the budget for the
115123
present period. LastPeriodAmount can only be set when the
116124
budget's time period is a
117125
[Filter.calendar_period][google.cloud.billing.budgets.v1.Filter.calendar_period].
118126
It cannot be set in combination with
119127
[Filter.custom_period][google.cloud.billing.budgets.v1.Filter.custom_period].
128+
This field is a member of `oneof`_ ``budget_amount``.
120129
"""
121130

122131
specified_amount = proto.Field(
@@ -226,6 +235,13 @@ class Filter(proto.Message):
226235
r"""A filter for a budget, limiting the scope of the cost to
227236
calculate.
228237
238+
This message has `oneof`_ fields (mutually exclusive fields).
239+
For each oneof, at most one member field can be set at the same time.
240+
Setting any member of the oneof automatically clears all other
241+
members.
242+
243+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
244+
229245
Attributes:
230246
projects (Sequence[str]):
231247
Optional. A set of projects of the form
@@ -282,11 +298,13 @@ class Filter(proto.Message):
282298
After that, it will track usage from July 1 to
283299
September 30 when the current calendar month is
284300
July, August, September, so on.
301+
This field is a member of `oneof`_ ``usage_period``.
285302
custom_period (google.cloud.billing.budgets_v1.types.CustomPeriod):
286303
Optional. Specifies to track usage from any
287304
start date (required) to any end date
288305
(optional). This time period is static, it does
289306
not recur.
307+
This field is a member of `oneof`_ ``usage_period``.
290308
"""
291309

292310
class CreditTypesTreatment(proto.Enum):

0 commit comments

Comments
 (0)