From 0207480800ff3d134c0b55a4427dca8f2c9bc025 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 13 Apr 2022 20:48:44 -0400 Subject: [PATCH] chore: use gapic-generator-python 0.65.1 (#199) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: https://github.com/googleapis/googleapis/commit/2a273915b3f70fe86c9d2a75470a0b83e48d0abf Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/budget_service/async_client.py | 7 +- .../services/budget_service/client.py | 7 +- .../budget_service/transports/base.py | 5 + .../budget_service/transports/grpc.py | 4 + .../billing/budgets_v1/types/budget_model.py | 2 +- .../services/budget_service/async_client.py | 7 +- .../services/budget_service/client.py | 7 +- .../budget_service/transports/base.py | 5 + .../budget_service/transports/grpc.py | 4 + .../budgets_v1beta1/types/budget_model.py | 2 +- .../snippet_metadata_budgets_v1.json | 424 +++++++++++++++++- .../snippet_metadata_budgets_v1beta1.json | 368 ++++++++++++++- .../gapic/budgets_v1/test_budget_service.py | 81 +++- .../budgets_v1beta1/test_budget_service.py | 81 +++- 14 files changed, 900 insertions(+), 104 deletions(-) diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/async_client.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/async_client.py index 7482c70f2917..f0b74a6fe311 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/async_client.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -222,7 +222,6 @@ async def create_budget( information on the limits of the number of budgets you can create. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -337,7 +336,6 @@ async def update_budget( fields that are not exposed in this API will not be changed by this method. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -469,7 +467,6 @@ async def get_budget( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -586,7 +583,6 @@ async def list_budgets( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -705,7 +701,6 @@ async def delete_budget( r"""Deletes a budget. Returns successfully if already deleted. - .. code-block:: python from google.cloud.billing import budgets_v1 diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/client.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/client.py index fd44350b2b03..ce9308cf18c9 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/client.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -441,7 +441,6 @@ def create_budget( information on the limits of the number of budgets you can create. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -556,7 +555,6 @@ def update_budget( fields that are not exposed in this API will not be changed by this method. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -678,7 +676,6 @@ def get_budget( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -785,7 +782,6 @@ def list_budgets( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1 @@ -894,7 +890,6 @@ def delete_budget( r"""Deletes a budget. Returns successfully if already deleted. - .. code-block:: python from google.cloud.billing import budgets_v1 diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/base.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/base.py index c862e0c2e605..601130b4facd 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/base.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -249,5 +250,9 @@ def delete_budget( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("BudgetServiceTransport",) diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/grpc.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/grpc.py index 8837cce88c25..d7e8cb175f01 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/grpc.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/services/budget_service/transports/grpc.py @@ -384,5 +384,9 @@ def delete_budget( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("BudgetServiceGrpcTransport",) diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/types/budget_model.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/types/budget_model.py index a9bbaa0c4b34..01483a54cc2c 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/types/budget_model.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1/types/budget_model.py @@ -329,7 +329,7 @@ class Filter(proto.Message): account, usage from the parent account will be included. If the field is omitted, the report will include usage from the parent account and all subaccounts, if they exist. - labels (Sequence[google.cloud.billing.budgets_v1.types.Filter.LabelsEntry]): + labels (Mapping[str, google.protobuf.struct_pb2.ListValue]): Optional. A single label and value pair specifying that usage from only this set of labeled resources should be included in the diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/async_client.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/async_client.py index cd9aab05074a..1965677ca774 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/async_client.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -219,7 +219,6 @@ async def create_budget( information on the limits of the number of budgets you can create. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -303,7 +302,6 @@ async def update_budget( fields that are not exposed in this API will not be changed by this method. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -399,7 +397,6 @@ async def get_budget( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -494,7 +491,6 @@ async def list_budgets( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -590,7 +586,6 @@ async def delete_budget( r"""Deletes a budget. Returns successfully if already deleted. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/client.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/client.py index a72f3b17a880..2a813770bd34 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/client.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -438,7 +438,6 @@ def create_budget( information on the limits of the number of budgets you can create. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -523,7 +522,6 @@ def update_budget( fields that are not exposed in this API will not be changed by this method. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -610,7 +608,6 @@ def get_budget( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -696,7 +693,6 @@ def list_budgets( the return value, though they may have been set in the Cloud Console. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 @@ -783,7 +779,6 @@ def delete_budget( r"""Deletes a budget. Returns successfully if already deleted. - .. code-block:: python from google.cloud.billing import budgets_v1beta1 diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/base.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/base.py index c75ee93ac380..bc37c58a9491 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/base.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -249,5 +250,9 @@ def delete_budget( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("BudgetServiceTransport",) diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/grpc.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/grpc.py index 44f82e0851ac..da79d88c1bd4 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/grpc.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/services/budget_service/transports/grpc.py @@ -384,5 +384,9 @@ def delete_budget( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("BudgetServiceGrpcTransport",) diff --git a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/types/budget_model.py b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/types/budget_model.py index 87fa252dc0e7..8081043f8837 100644 --- a/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/types/budget_model.py +++ b/packages/google-cloud-billing-budgets/google/cloud/billing/budgets_v1beta1/types/budget_model.py @@ -344,7 +344,7 @@ class Filter(proto.Message): account, usage from the parent account will be included. If omitted, the report will include usage from the parent account and all subaccounts, if they exist. - labels (Sequence[google.cloud.billing.budgets_v1beta1.types.Filter.LabelsEntry]): + labels (Mapping[str, google.protobuf.struct_pb2.ListValue]): Optional. A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget. If omitted, the report will include diff --git a/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1.json b/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1.json index c61960505067..465fffe63b18 100644 --- a/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1.json +++ b/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1.json @@ -1,16 +1,65 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.billing.budgets.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-billing-budgets" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient.create_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.CreateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "CreateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.CreateBudgetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "budget", + "type": "google.cloud.billing.budgets_v1.types.Budget" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.types.Budget", + "shortName": "create_budget" }, + "description": "Sample for CreateBudget", "file": "billingbudgets_v1_generated_budget_service_create_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_CreateBudget_async", "segments": [ { @@ -43,18 +92,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_create_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient.create_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.CreateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "CreateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.CreateBudgetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "budget", + "type": "google.cloud.billing.budgets_v1.types.Budget" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.types.Budget", + "shortName": "create_budget" }, + "description": "Sample for CreateBudget", "file": "billingbudgets_v1_generated_budget_service_create_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_CreateBudget_sync", "segments": [ { @@ -87,19 +176,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_create_budget_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient.delete_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.DeleteBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "DeleteBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.DeleteBudgetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_budget" }, + "description": "Sample for DeleteBudget", "file": "billingbudgets_v1_generated_budget_service_delete_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_DeleteBudget_async", "segments": [ { @@ -130,18 +254,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_delete_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient.delete_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.DeleteBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "DeleteBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.DeleteBudgetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_budget" }, + "description": "Sample for DeleteBudget", "file": "billingbudgets_v1_generated_budget_service_delete_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_DeleteBudget_sync", "segments": [ { @@ -172,19 +331,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_delete_budget_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient.get_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.GetBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "GetBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.GetBudgetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.types.Budget", + "shortName": "get_budget" }, + "description": "Sample for GetBudget", "file": "billingbudgets_v1_generated_budget_service_get_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_GetBudget_async", "segments": [ { @@ -217,18 +412,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_get_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient.get_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.GetBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "GetBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.GetBudgetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.types.Budget", + "shortName": "get_budget" }, + "description": "Sample for GetBudget", "file": "billingbudgets_v1_generated_budget_service_get_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_GetBudget_sync", "segments": [ { @@ -261,19 +492,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_get_budget_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient.list_budgets", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.ListBudgets", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "ListBudgets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.ListBudgetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.services.budget_service.pagers.ListBudgetsAsyncPager", + "shortName": "list_budgets" }, + "description": "Sample for ListBudgets", "file": "billingbudgets_v1_generated_budget_service_list_budgets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_ListBudgets_async", "segments": [ { @@ -306,18 +573,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_list_budgets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient.list_budgets", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.ListBudgets", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "ListBudgets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.ListBudgetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.services.budget_service.pagers.ListBudgetsPager", + "shortName": "list_budgets" }, + "description": "Sample for ListBudgets", "file": "billingbudgets_v1_generated_budget_service_list_budgets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_ListBudgets_sync", "segments": [ { @@ -350,19 +653,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_list_budgets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceAsyncClient.update_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.UpdateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "UpdateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.UpdateBudgetRequest" + }, + { + "name": "budget", + "type": "google.cloud.billing.budgets_v1.types.Budget" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.types.Budget", + "shortName": "update_budget" }, + "description": "Sample for UpdateBudget", "file": "billingbudgets_v1_generated_budget_service_update_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_UpdateBudget_async", "segments": [ { @@ -395,18 +738,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_update_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1.BudgetServiceClient.update_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService.UpdateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1.BudgetService", "shortName": "BudgetService" }, "shortName": "UpdateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1.types.UpdateBudgetRequest" + }, + { + "name": "budget", + "type": "google.cloud.billing.budgets_v1.types.Budget" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1.types.Budget", + "shortName": "update_budget" }, + "description": "Sample for UpdateBudget", "file": "billingbudgets_v1_generated_budget_service_update_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1_generated_BudgetService_UpdateBudget_sync", "segments": [ { @@ -439,7 +822,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1_generated_budget_service_update_budget_sync.py" } ] } diff --git a/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1beta1.json b/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1beta1.json index 7c18f3541be8..24fb61e898ad 100644 --- a/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1beta1.json +++ b/packages/google-cloud-billing-budgets/samples/generated_samples/snippet_metadata_budgets_v1beta1.json @@ -1,16 +1,57 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.billing.budgets.v1beta1", + "version": "v1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-billing-budgets" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient.create_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.CreateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "CreateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.CreateBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.types.Budget", + "shortName": "create_budget" }, + "description": "Sample for CreateBudget", "file": "billingbudgets_v1beta1_generated_budget_service_create_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_CreateBudget_async", "segments": [ { @@ -43,18 +84,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_create_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient.create_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.CreateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "CreateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.CreateBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.types.Budget", + "shortName": "create_budget" }, + "description": "Sample for CreateBudget", "file": "billingbudgets_v1beta1_generated_budget_service_create_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_CreateBudget_sync", "segments": [ { @@ -87,19 +160,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_create_budget_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient.delete_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.DeleteBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "DeleteBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.DeleteBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_budget" }, + "description": "Sample for DeleteBudget", "file": "billingbudgets_v1beta1_generated_budget_service_delete_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_DeleteBudget_async", "segments": [ { @@ -130,18 +234,49 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_delete_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient.delete_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.DeleteBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "DeleteBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.DeleteBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_budget" }, + "description": "Sample for DeleteBudget", "file": "billingbudgets_v1beta1_generated_budget_service_delete_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_DeleteBudget_sync", "segments": [ { @@ -172,19 +307,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_delete_budget_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient.get_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.GetBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "GetBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.GetBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.types.Budget", + "shortName": "get_budget" }, + "description": "Sample for GetBudget", "file": "billingbudgets_v1beta1_generated_budget_service_get_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_GetBudget_async", "segments": [ { @@ -217,18 +384,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_get_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient.get_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.GetBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "GetBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.GetBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.types.Budget", + "shortName": "get_budget" }, + "description": "Sample for GetBudget", "file": "billingbudgets_v1beta1_generated_budget_service_get_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_GetBudget_sync", "segments": [ { @@ -261,19 +460,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_get_budget_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient.list_budgets", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.ListBudgets", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "ListBudgets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.ListBudgetsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.services.budget_service.pagers.ListBudgetsAsyncPager", + "shortName": "list_budgets" }, + "description": "Sample for ListBudgets", "file": "billingbudgets_v1beta1_generated_budget_service_list_budgets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_ListBudgets_async", "segments": [ { @@ -306,18 +537,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_list_budgets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient.list_budgets", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.ListBudgets", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "ListBudgets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.ListBudgetsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.services.budget_service.pagers.ListBudgetsPager", + "shortName": "list_budgets" }, + "description": "Sample for ListBudgets", "file": "billingbudgets_v1beta1_generated_budget_service_list_budgets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_ListBudgets_sync", "segments": [ { @@ -350,19 +613,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_list_budgets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient", + "shortName": "BudgetServiceAsyncClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceAsyncClient.update_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.UpdateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "UpdateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.UpdateBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.types.Budget", + "shortName": "update_budget" }, + "description": "Sample for UpdateBudget", "file": "billingbudgets_v1beta1_generated_budget_service_update_budget_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_UpdateBudget_async", "segments": [ { @@ -395,18 +690,50 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_update_budget_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient", + "shortName": "BudgetServiceClient" + }, + "fullName": "google.cloud.billing.budgets_v1beta1.BudgetServiceClient.update_budget", "method": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService.UpdateBudget", "service": { + "fullName": "google.cloud.billing.budgets.v1beta1.BudgetService", "shortName": "BudgetService" }, "shortName": "UpdateBudget" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.billing.budgets_v1beta1.types.UpdateBudgetRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.billing.budgets_v1beta1.types.Budget", + "shortName": "update_budget" }, + "description": "Sample for UpdateBudget", "file": "billingbudgets_v1beta1_generated_budget_service_update_budget_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "billingbudgets_v1beta1_generated_BudgetService_UpdateBudget_sync", "segments": [ { @@ -439,7 +766,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "billingbudgets_v1beta1_generated_budget_service_update_budget_sync.py" } ] } diff --git a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py index 06436f82adbb..fe1ec231ba5e 100644 --- a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py +++ b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py @@ -92,24 +92,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BudgetServiceClient, - BudgetServiceAsyncClient, + (BudgetServiceClient, "grpc"), + (BudgetServiceAsyncClient, "grpc_asyncio"), ], ) -def test_budget_service_client_from_service_account_info(client_class): +def test_budget_service_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "billingbudgets.googleapis.com:443" + assert client.transport._host == ("billingbudgets.googleapis.com:443") @pytest.mark.parametrize( @@ -138,27 +138,31 @@ def test_budget_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BudgetServiceClient, - BudgetServiceAsyncClient, + (BudgetServiceClient, "grpc"), + (BudgetServiceAsyncClient, "grpc_asyncio"), ], ) -def test_budget_service_client_from_service_account_file(client_class): +def test_budget_service_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "billingbudgets.googleapis.com:443" + assert client.transport._host == ("billingbudgets.googleapis.com:443") def test_budget_service_client_get_transport_class(): @@ -1745,7 +1749,7 @@ async def test_list_budgets_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1791,7 +1795,9 @@ async def test_list_budgets_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_budgets(request={})).pages: + async for page_ in ( + await client.list_budgets(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2108,6 +2114,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = BudgetServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = BudgetServiceClient( @@ -2154,6 +2173,14 @@ def test_budget_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_budget_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2311,24 +2338,40 @@ def test_budget_service_grpc_transport_client_cert_source_for_mtls(transport_cla ) -def test_budget_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_budget_service_host_no_port(transport_name): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="billingbudgets.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "billingbudgets.googleapis.com:443" + assert client.transport._host == ("billingbudgets.googleapis.com:443") -def test_budget_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_budget_service_host_with_port(transport_name): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="billingbudgets.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "billingbudgets.googleapis.com:8000" + assert client.transport._host == ("billingbudgets.googleapis.com:8000") def test_budget_service_grpc_transport_channel(): diff --git a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py index 3dd538aadec1..3a5b253f087a 100644 --- a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py +++ b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py @@ -94,24 +94,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BudgetServiceClient, - BudgetServiceAsyncClient, + (BudgetServiceClient, "grpc"), + (BudgetServiceAsyncClient, "grpc_asyncio"), ], ) -def test_budget_service_client_from_service_account_info(client_class): +def test_budget_service_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "billingbudgets.googleapis.com:443" + assert client.transport._host == ("billingbudgets.googleapis.com:443") @pytest.mark.parametrize( @@ -140,27 +140,31 @@ def test_budget_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - BudgetServiceClient, - BudgetServiceAsyncClient, + (BudgetServiceClient, "grpc"), + (BudgetServiceAsyncClient, "grpc_asyncio"), ], ) -def test_budget_service_client_from_service_account_file(client_class): +def test_budget_service_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "billingbudgets.googleapis.com:443" + assert client.transport._host == ("billingbudgets.googleapis.com:443") def test_budget_service_client_get_transport_class(): @@ -1405,7 +1409,7 @@ async def test_list_budgets_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1451,7 +1455,9 @@ async def test_list_budgets_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_budgets(request={})).pages: + async for page_ in ( + await client.list_budgets(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1688,6 +1694,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = BudgetServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = BudgetServiceClient( @@ -1734,6 +1753,14 @@ def test_budget_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_budget_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1891,24 +1918,40 @@ def test_budget_service_grpc_transport_client_cert_source_for_mtls(transport_cla ) -def test_budget_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_budget_service_host_no_port(transport_name): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="billingbudgets.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "billingbudgets.googleapis.com:443" + assert client.transport._host == ("billingbudgets.googleapis.com:443") -def test_budget_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_budget_service_host_with_port(transport_name): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="billingbudgets.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "billingbudgets.googleapis.com:8000" + assert client.transport._host == ("billingbudgets.googleapis.com:8000") def test_budget_service_grpc_transport_channel():