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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#154)
Browse files Browse the repository at this point in the history
- [ ] 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: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent 590e484 commit cfccdf0
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 299 deletions.
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.billing.budgets_v1.services.budget_service import pagers
from google.cloud.billing.budgets_v1.types import budget_model
from google.cloud.billing.budgets_v1.types import budget_service
Expand Down Expand Up @@ -168,11 +170,11 @@ def __init__(

async def create_budget(
self,
request: budget_service.CreateBudgetRequest = None,
request: Union[budget_service.CreateBudgetRequest, dict] = None,
*,
parent: str = None,
budget: budget_model.Budget = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> budget_model.Budget:
Expand All @@ -182,7 +184,7 @@ async def create_budget(
create.
Args:
request (:class:`google.cloud.billing.budgets_v1.types.CreateBudgetRequest`):
request (Union[google.cloud.billing.budgets_v1.types.CreateBudgetRequest, dict]):
The request object. Request for CreateBudget
parent (:class:`str`):
Required. The name of the billing account to create the
Expand Down Expand Up @@ -257,11 +259,11 @@ async def create_budget(

async def update_budget(
self,
request: budget_service.UpdateBudgetRequest = None,
request: Union[budget_service.UpdateBudgetRequest, dict] = None,
*,
budget: budget_model.Budget = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> budget_model.Budget:
Expand All @@ -272,7 +274,7 @@ async def update_budget(
changed by this method.
Args:
request (:class:`google.cloud.billing.budgets_v1.types.UpdateBudgetRequest`):
request (Union[google.cloud.billing.budgets_v1.types.UpdateBudgetRequest, dict]):
The request object. Request for UpdateBudget
budget (:class:`google.cloud.billing.budgets_v1.types.Budget`):
Required. The updated budget object.
Expand Down Expand Up @@ -365,10 +367,10 @@ async def update_budget(

async def get_budget(
self,
request: budget_service.GetBudgetRequest = None,
request: Union[budget_service.GetBudgetRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> budget_model.Budget:
Expand All @@ -380,7 +382,7 @@ async def get_budget(
Cloud Console.
Args:
request (:class:`google.cloud.billing.budgets_v1.types.GetBudgetRequest`):
request (Union[google.cloud.billing.budgets_v1.types.GetBudgetRequest, dict]):
The request object. Request for GetBudget
name (:class:`str`):
Required. Name of budget to get. Values are of the form
Expand Down Expand Up @@ -457,10 +459,10 @@ async def get_budget(

async def list_budgets(
self,
request: budget_service.ListBudgetsRequest = None,
request: Union[budget_service.ListBudgetsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBudgetsAsyncPager:
Expand All @@ -472,7 +474,7 @@ async def list_budgets(
Cloud Console.
Args:
request (:class:`google.cloud.billing.budgets_v1.types.ListBudgetsRequest`):
request (Union[google.cloud.billing.budgets_v1.types.ListBudgetsRequest, dict]):
The request object. Request for ListBudgets
parent (:class:`str`):
Required. Name of billing account to list budgets under.
Expand Down Expand Up @@ -551,18 +553,18 @@ async def list_budgets(

async def delete_budget(
self,
request: budget_service.DeleteBudgetRequest = None,
request: Union[budget_service.DeleteBudgetRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes a budget. Returns successfully if already
deleted.
Args:
request (:class:`google.cloud.billing.budgets_v1.types.DeleteBudgetRequest`):
request (Union[google.cloud.billing.budgets_v1.types.DeleteBudgetRequest, dict]):
The request object. Request for DeleteBudget
name (:class:`str`):
Required. Name of the budget to delete. Values are of
Expand Down
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.billing.budgets_v1.services.budget_service import pagers
from google.cloud.billing.budgets_v1.types import budget_model
from google.cloud.billing.budgets_v1.types import budget_service
Expand Down Expand Up @@ -355,7 +357,7 @@ def create_budget(
*,
parent: str = None,
budget: budget_model.Budget = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> budget_model.Budget:
Expand Down Expand Up @@ -444,7 +446,7 @@ def update_budget(
*,
budget: budget_model.Budget = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> budget_model.Budget:
Expand Down Expand Up @@ -541,7 +543,7 @@ def get_budget(
request: Union[budget_service.GetBudgetRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> budget_model.Budget:
Expand Down Expand Up @@ -623,7 +625,7 @@ def list_budgets(
request: Union[budget_service.ListBudgetsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBudgetsPager:
Expand Down Expand Up @@ -707,7 +709,7 @@ def delete_budget(
request: Union[budget_service.DeleteBudgetRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

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

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class BudgetServiceTransport(abc.ABC):
"""Abstract transport class for BudgetService."""
Expand Down Expand Up @@ -100,7 +90,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -133,29 +123,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Expand Up @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down
18 changes: 18 additions & 0 deletions google/cloud/billing/budgets_v1/types/budget_model.py
Expand Up @@ -102,6 +102,13 @@ class Budget(proto.Message):
class BudgetAmount(proto.Message):
r"""The budgeted amount for each usage period.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
specified_amount (google.type.money_pb2.Money):
A specified amount to use as the budget. ``currency_code``
Expand All @@ -110,13 +117,15 @@ class BudgetAmount(proto.Message):
updating a budget, it must match the currency_code of the
existing budget. The ``currency_code`` is provided on
output.
This field is a member of `oneof`_ ``budget_amount``.
last_period_amount (google.cloud.billing.budgets_v1.types.LastPeriodAmount):
Use the last period's actual spend as the budget for the
present period. LastPeriodAmount can only be set when the
budget's time period is a
[Filter.calendar_period][google.cloud.billing.budgets.v1.Filter.calendar_period].
It cannot be set in combination with
[Filter.custom_period][google.cloud.billing.budgets.v1.Filter.custom_period].
This field is a member of `oneof`_ ``budget_amount``.
"""

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

class CreditTypesTreatment(proto.Enum):
Expand Down

0 comments on commit cfccdf0

Please sign in to comment.