diff --git a/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_billing/async_client.py b/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_billing/async_client.py index 5f3683fd3de2..3ac8721d64af 100644 --- a/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_billing/async_client.py +++ b/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_billing/async_client.py @@ -219,9 +219,9 @@ async def get_billing_account( from google.cloud import billing_v1 - def sample_get_billing_account(): + async def sample_get_billing_account(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.GetBillingAccountRequest( @@ -229,7 +229,7 @@ def sample_get_billing_account(): ) # Make the request - response = client.get_billing_account(request=request) + response = await client.get_billing_account(request=request) # Handle the response print(response) @@ -327,9 +327,9 @@ async def list_billing_accounts( from google.cloud import billing_v1 - def sample_list_billing_accounts(): + async def sample_list_billing_accounts(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.ListBillingAccountsRequest( @@ -339,7 +339,7 @@ def sample_list_billing_accounts(): page_result = client.list_billing_accounts(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -422,9 +422,9 @@ async def update_billing_account( from google.cloud import billing_v1 - def sample_update_billing_account(): + async def sample_update_billing_account(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.UpdateBillingAccountRequest( @@ -432,7 +432,7 @@ def sample_update_billing_account(): ) # Make the request - response = client.update_billing_account(request=request) + response = await client.update_billing_account(request=request) # Handle the response print(response) @@ -547,16 +547,16 @@ async def create_billing_account( from google.cloud import billing_v1 - def sample_create_billing_account(): + async def sample_create_billing_account(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.CreateBillingAccountRequest( ) # Make the request - response = client.create_billing_account(request=request) + response = await client.create_billing_account(request=request) # Handle the response print(response) @@ -644,9 +644,9 @@ async def list_project_billing_info( from google.cloud import billing_v1 - def sample_list_project_billing_info(): + async def sample_list_project_billing_info(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.ListProjectBillingInfoRequest( @@ -657,7 +657,7 @@ def sample_list_project_billing_info(): page_result = client.list_project_billing_info(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -764,9 +764,9 @@ async def get_project_billing_info( from google.cloud import billing_v1 - def sample_get_project_billing_info(): + async def sample_get_project_billing_info(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.GetProjectBillingInfoRequest( @@ -774,7 +774,7 @@ def sample_get_project_billing_info(): ) # Make the request - response = client.get_project_billing_info(request=request) + response = await client.get_project_billing_info(request=request) # Handle the response print(response) @@ -909,9 +909,9 @@ async def update_project_billing_info( from google.cloud import billing_v1 - def sample_update_project_billing_info(): + async def sample_update_project_billing_info(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = billing_v1.UpdateProjectBillingInfoRequest( @@ -919,7 +919,7 @@ def sample_update_project_billing_info(): ) # Make the request - response = client.update_project_billing_info(request=request) + response = await client.update_project_billing_info(request=request) # Handle the response print(response) @@ -1032,9 +1032,9 @@ async def get_iam_policy( from google.cloud import billing_v1 from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_get_iam_policy(): + async def sample_get_iam_policy(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = iam_policy_pb2.GetIamPolicyRequest( @@ -1042,7 +1042,7 @@ def sample_get_iam_policy(): ) # Make the request - response = client.get_iam_policy(request=request) + response = await client.get_iam_policy(request=request) # Handle the response print(response) @@ -1205,9 +1205,9 @@ async def set_iam_policy( from google.cloud import billing_v1 from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_set_iam_policy(): + async def sample_set_iam_policy(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = iam_policy_pb2.SetIamPolicyRequest( @@ -1215,7 +1215,7 @@ def sample_set_iam_policy(): ) # Make the request - response = client.set_iam_policy(request=request) + response = await client.set_iam_policy(request=request) # Handle the response print(response) @@ -1379,9 +1379,9 @@ async def test_iam_permissions( from google.cloud import billing_v1 from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_test_iam_permissions(): + async def sample_test_iam_permissions(): # Create a client - client = billing_v1.CloudBillingClient() + client = billing_v1.CloudBillingAsyncClient() # Initialize request argument(s) request = iam_policy_pb2.TestIamPermissionsRequest( @@ -1390,7 +1390,7 @@ def sample_test_iam_permissions(): ) # Make the request - response = client.test_iam_permissions(request=request) + response = await client.test_iam_permissions(request=request) # Handle the response print(response) diff --git a/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_catalog/async_client.py b/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_catalog/async_client.py index 0c98dad3b2cc..968b69f8e8be 100644 --- a/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_catalog/async_client.py +++ b/packages/google-cloud-billing/google/cloud/billing_v1/services/cloud_catalog/async_client.py @@ -218,9 +218,9 @@ async def list_services( from google.cloud import billing_v1 - def sample_list_services(): + async def sample_list_services(): # Create a client - client = billing_v1.CloudCatalogClient() + client = billing_v1.CloudCatalogAsyncClient() # Initialize request argument(s) request = billing_v1.ListServicesRequest( @@ -230,7 +230,7 @@ def sample_list_services(): page_result = client.list_services(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -297,9 +297,9 @@ async def list_skus( from google.cloud import billing_v1 - def sample_list_skus(): + async def sample_list_skus(): # Create a client - client = billing_v1.CloudCatalogClient() + client = billing_v1.CloudCatalogAsyncClient() # Initialize request argument(s) request = billing_v1.ListSkusRequest( @@ -310,7 +310,7 @@ def sample_list_skus(): page_result = client.list_skus(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: diff --git a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py index a100f3990a23..5c4559e66a86 100644 --- a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py +++ b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py @@ -751,7 +751,7 @@ def test_get_billing_account_field_headers(): # a field header. Set these to a non-empty value. request = cloud_billing.GetBillingAccountRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -769,7 +769,7 @@ def test_get_billing_account_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -783,7 +783,7 @@ async def test_get_billing_account_field_headers_async(): # a field header. Set these to a non-empty value. request = cloud_billing.GetBillingAccountRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -803,7 +803,7 @@ async def test_get_billing_account_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1033,7 +1033,7 @@ def test_list_billing_accounts_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, cloud_billing.BillingAccount) for i in results) @@ -1299,7 +1299,7 @@ def test_update_billing_account_field_headers(): # a field header. Set these to a non-empty value. request = cloud_billing.UpdateBillingAccountRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1317,7 +1317,7 @@ def test_update_billing_account_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1331,7 +1331,7 @@ async def test_update_billing_account_field_headers_async(): # a field header. Set these to a non-empty value. request = cloud_billing.UpdateBillingAccountRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1351,7 +1351,7 @@ async def test_update_billing_account_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1750,7 +1750,7 @@ def test_list_project_billing_info_field_headers(): # a field header. Set these to a non-empty value. request = cloud_billing.ListProjectBillingInfoRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1768,7 +1768,7 @@ def test_list_project_billing_info_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1782,7 +1782,7 @@ async def test_list_project_billing_info_field_headers_async(): # a field header. Set these to a non-empty value. request = cloud_billing.ListProjectBillingInfoRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1802,7 +1802,7 @@ async def test_list_project_billing_info_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1939,7 +1939,7 @@ def test_list_project_billing_info_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, cloud_billing.ProjectBillingInfo) for i in results) @@ -2205,7 +2205,7 @@ def test_get_project_billing_info_field_headers(): # a field header. Set these to a non-empty value. request = cloud_billing.GetProjectBillingInfoRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2223,7 +2223,7 @@ def test_get_project_billing_info_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2237,7 +2237,7 @@ async def test_get_project_billing_info_field_headers_async(): # a field header. Set these to a non-empty value. request = cloud_billing.GetProjectBillingInfoRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2257,7 +2257,7 @@ async def test_get_project_billing_info_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2464,7 +2464,7 @@ def test_update_project_billing_info_field_headers(): # a field header. Set these to a non-empty value. request = cloud_billing.UpdateProjectBillingInfoRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2482,7 +2482,7 @@ def test_update_project_billing_info_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2496,7 +2496,7 @@ async def test_update_project_billing_info_field_headers_async(): # a field header. Set these to a non-empty value. request = cloud_billing.UpdateProjectBillingInfoRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2516,7 +2516,7 @@ async def test_update_project_billing_info_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2718,7 +2718,7 @@ def test_get_iam_policy_field_headers(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2734,7 +2734,7 @@ def test_get_iam_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "resource=resource/value", + "resource=resource_value", ) in kw["metadata"] @@ -2748,7 +2748,7 @@ async def test_get_iam_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2764,7 +2764,7 @@ async def test_get_iam_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "resource=resource/value", + "resource=resource_value", ) in kw["metadata"] @@ -2967,7 +2967,7 @@ def test_set_iam_policy_field_headers(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2983,7 +2983,7 @@ def test_set_iam_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "resource=resource/value", + "resource=resource_value", ) in kw["metadata"] @@ -2997,7 +2997,7 @@ async def test_set_iam_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -3013,7 +3013,7 @@ async def test_set_iam_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "resource=resource/value", + "resource=resource_value", ) in kw["metadata"] @@ -3220,7 +3220,7 @@ def test_test_iam_permissions_field_headers(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3238,7 +3238,7 @@ def test_test_iam_permissions_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "resource=resource/value", + "resource=resource_value", ) in kw["metadata"] @@ -3252,7 +3252,7 @@ async def test_test_iam_permissions_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3272,7 +3272,7 @@ async def test_test_iam_permissions_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "resource=resource/value", + "resource=resource_value", ) in kw["metadata"] diff --git a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py index 2633449f7613..db8a4a83538d 100644 --- a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py +++ b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py @@ -762,7 +762,7 @@ def test_list_services_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, cloud_catalog.Service) for i in results) @@ -1003,7 +1003,7 @@ def test_list_skus_field_headers(): # a field header. Set these to a non-empty value. request = cloud_catalog.ListSkusRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_skus), "__call__") as call: @@ -1019,7 +1019,7 @@ def test_list_skus_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1033,7 +1033,7 @@ async def test_list_skus_field_headers_async(): # a field header. Set these to a non-empty value. request = cloud_catalog.ListSkusRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_skus), "__call__") as call: @@ -1051,7 +1051,7 @@ async def test_list_skus_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1182,7 +1182,7 @@ def test_list_skus_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, cloud_catalog.Sku) for i in results)